Skip to content
Snippets Groups Projects
Commit ae53b68b authored by JimmyTheCat's avatar JimmyTheCat
Browse files

player flip by reset, board class mechanic and board constructor cleanup

parent 3b4e499d
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,11 @@ public class Board extends Thread { ...@@ -13,6 +13,11 @@ public class Board extends Thread {
*/ */
Player players[] = new Player[2]; Player players[] = new Player[2];
/**This Integer defines which character gets to draw first.
*
*/
int firstPlayer;
/**This Integer defines which character can currently draw on a tile. /**This Integer defines which character can currently draw on a tile.
* *
*/ */
...@@ -27,16 +32,20 @@ public class Board extends Thread { ...@@ -27,16 +32,20 @@ public class Board extends Thread {
* Creates the Tiles and Players and sets the player who starts the game. * Creates the Tiles and Players and sets the player who starts the game.
*/ */
Board() { Board() {
for(int i = 0; i < tiles.length; i++) tiles[i] = new Tile(0,0,0);
for(int i = 0; i < players.length; i++) players[i] = new Player(i+1); for(int i = 0; i < players.length; i++) players[i] = new Player(i+1);
currentPlayer = 0; firstPlayer = 0;
marks = 0; initBoard();
} }
Board(Player[] players) { Board(Player[] players, int firstPlayer) {
for(int i = 0; i < tiles.length; i++) tiles[i] = new Tile(0,0,0);
this.players = players; this.players = players;
currentPlayer = 0; this.firstPlayer = firstPlayer == 1 ? 0 : 1;
initBoard();
}
private void initBoard() {
for(int i = 0; i < tiles.length; i++) tiles[i] = new Tile(0,0,0);
currentPlayer = firstPlayer;
marks = 0; marks = 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment