From 3feb2963b6963c3f353bbea20e920c1e91938f28 Mon Sep 17 00:00:00 2001 From: Christos Houtouridis Date: Tue, 6 Nov 2018 16:27:18 +0200 Subject: [PATCH] number of players is now a requirement --- src/SnakePkg/Game.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/SnakePkg/Game.java b/src/SnakePkg/Game.java index 8cfe7cb..77b2b92 100644 --- a/src/SnakePkg/Game.java +++ b/src/SnakePkg/Game.java @@ -201,19 +201,21 @@ public class Game { int numOfSnakes = 3; int numOfLadders = 3; int numOfApples = 6; + int numOfPlayers = 2; // Print caption System.out.println("================== Snake Game =================="); - System.out.println ("Board: " +lines +"x" +columns +" with " +numOfSnakes +" snakes, " - +numOfLadders +" ladders and " +numOfApples +" apples."); - System.out.println ("Players: 2"); // For now + System.out.println("Board: " +lines +"x" +columns +" with " +numOfSnakes +" snakes, " + +numOfLadders +" ladders and " +numOfApples +" apples."); + System.out.println("Players: " + numOfPlayers); System.out.println(""); // Board creation Game game = new Game (lines, columns, numOfSnakes, numOfLadders, numOfApples); // game.getBoard().createElementBoard(); // Not explicitly required - game.registerPlayer(1, "Player 1"); // Player registration - game.registerPlayer(2, "Player 2"); + // Player registration + for (int i=0 ; i