ajout TP3
This commit is contained in:
38
TP3/fr/iut_fbleau/Nim/NimPly.java
Normal file
38
TP3/fr/iut_fbleau/Nim/NimPly.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package fr.iut_fbleau.Nim;
|
||||
|
||||
import fr.iut_fbleau.GameAPI.AbstractPly;
|
||||
import fr.iut_fbleau.GameAPI.Player;
|
||||
|
||||
/**
|
||||
* Représente un coup dans le jeu de Nim.
|
||||
* Un coup consiste à retirer un certain nombre d'allumettes.
|
||||
*/
|
||||
public class NimPly extends AbstractPly {
|
||||
|
||||
private Player joueur;
|
||||
private int nombreAllumettesPrises;
|
||||
|
||||
public NimPly(Player joueur, int nombreAllumettesPrises) {
|
||||
this.joueur = joueur;
|
||||
this.nombreAllumettesPrises = nombreAllumettesPrises;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return le joueur qui effectue le coup
|
||||
*/
|
||||
public Player getJoueur() {
|
||||
return this.joueur;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return le nombre d'allumettes prises
|
||||
*/
|
||||
public int getNombreAllumettesPrises() {
|
||||
return this.nombreAllumettesPrises;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Joueur " + joueur + " retire " + nombreAllumettesPrises + " allumette(s)";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user