no doc in git and add tokens on players
This commit is contained in:
@@ -39,19 +39,19 @@ public class GomokuGame {
|
||||
g.renderer.update();
|
||||
}
|
||||
|
||||
public void newGame(boolean bot, String name1, String name2) {
|
||||
public void newGame(boolean bot, String name1, String name2, int tokens) {
|
||||
Color[] possible = { Color.WHITE, Color.BLACK };
|
||||
int rnd = new Random().nextInt(possible.length);
|
||||
Color colorPlayer1 = possible[rnd];
|
||||
Color colorPlayer2 = colorPlayer1.inverse();
|
||||
|
||||
this.player1 = new Human(name1, colorPlayer1);
|
||||
this.player1 = new Human(name1, colorPlayer1, tokens);
|
||||
|
||||
if (bot) {
|
||||
this.player2 = new GomokuAI(name2, colorPlayer2);
|
||||
this.player2 = new GomokuAI(name2, colorPlayer2, tokens);
|
||||
|
||||
} else {
|
||||
this.player2 = new Human(name2, colorPlayer2);
|
||||
this.player2 = new Human(name2, colorPlayer2, tokens);
|
||||
}
|
||||
|
||||
this.board = new GomokuBoard(15, 15);
|
||||
@@ -71,6 +71,9 @@ public class GomokuGame {
|
||||
System.out.println("c'est gangée !");
|
||||
}
|
||||
*/
|
||||
while(this.nbTokens1 > 0 && this.nbTokens2 > 0){
|
||||
|
||||
}
|
||||
GomokuCell currentPlay = null;
|
||||
while (currentPlay == null) {
|
||||
currentPlay = this.play(this.currentPlayer);
|
||||
@@ -80,6 +83,7 @@ public class GomokuGame {
|
||||
if( NB_CELL_PLAY <= board.countMax(board.countAlignedCells(currentPlay)))
|
||||
{
|
||||
System.out.println("c'est gangée !");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user