number of players is now a requirement

This commit is contained in:
Christos Houtouridis 2018-11-06 16:27:18 +02:00
parent 8b60096e7b
commit 3feb2963b6

View File

@ -201,19 +201,21 @@ public class Game {
int numOfSnakes = 3; int numOfSnakes = 3;
int numOfLadders = 3; int numOfLadders = 3;
int numOfApples = 6; int numOfApples = 6;
int numOfPlayers = 2;
// Print caption // Print caption
System.out.println("================== Snake Game =================="); System.out.println("================== Snake Game ==================");
System.out.println ("Board: " +lines +"x" +columns +" with " +numOfSnakes +" snakes, " System.out.println("Board: " +lines +"x" +columns +" with " +numOfSnakes +" snakes, "
+numOfLadders +" ladders and " +numOfApples +" apples."); +numOfLadders +" ladders and " +numOfApples +" apples.");
System.out.println ("Players: 2"); // For now System.out.println("Players: " + numOfPlayers);
System.out.println(""); System.out.println("");
// Board creation // Board creation
Game game = new Game (lines, columns, numOfSnakes, numOfLadders, numOfApples); Game game = new Game (lines, columns, numOfSnakes, numOfLadders, numOfApples);
// game.getBoard().createElementBoard(); // Not explicitly required // game.getBoard().createElementBoard(); // Not explicitly required
game.registerPlayer(1, "Player 1"); // Player registration // Player registration
game.registerPlayer(2, "Player 2"); for (int i=0 ; i<numOfPlayers && i<MAX_PLAYERS; ++i)
game.registerPlayer(i+1, String.format("Player %d", i+1));
game.playOrder(); // Choose play order game.playOrder(); // Choose play order
Player winner; Player winner;