Skip to content
Snippets Groups Projects
Commit a7253b93 authored by RAKOTOARISOA Andrianinarisaina cy's avatar RAKOTOARISOA Andrianinarisaina cy
Browse files

Tâche 7(10.2) : Création de la classe HumanPlayer, de ses deux constructeurs...

Tâche 7(10.2) : Création de la classe HumanPlayer, de ses deux constructeurs "HumanPlayer(String name, Cell startCell)" et HumanPlayer(Cell startCell)"
parent ff7b5a3d
No related branches found
No related tags found
No related merge requests found
package model;
public class HumanPlayer implements Player {
public String name;
public Cell startCell;
// Constructeur 1 : paramétre name et Cell
public void HumanPlayer(String name, Cell startCell) {
this.name = name ;
this.startCell = startCell ;
}
// Constructeur 2 : parametre name = player et Cell
public void HumanPlayer(Cell startCell) {
this.name = "player" ;
this.startCell = startCell ;
}
// Cette méthode permet de modifier le nom du joueur
@Override
public void setName(String name) {
this.name = name ;
}
// Cette méthode permet de récupérer le nom du joueur
@Override
public String getName() {
return this.name ;
}
// Cette méthode retourne la cellule de départ qui a été attribué au joueur.
@Override
public Cell getStartCell() {
return null;
}
// Cette méthode détermine si ce joueur est contrôlé par un humain ou par l’ordinateur.
public boolean isHuman() {
if (this.name == "player") return true ;
else return false ;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment