From 6d938aa0ca03abec3b65790676b94ea55b9c8db4 Mon Sep 17 00:00:00 2001
From: JimmyTheCat <154287729+JimmyTheCatOwO@users.noreply.github.com>
Date: Thu, 9 Jan 2025 15:15:58 +0100
Subject: [PATCH] 2nd Board constructor

---
 Board.java  | 9 ++++++++-
 Main.java   | 1 -
 Player.java | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/Board.java b/Board.java
index 5b24e65..e1fddbe 100644
--- a/Board.java
+++ b/Board.java
@@ -27,12 +27,19 @@ public class Board extends Thread {
      * Creates the Tiles and Players and sets the player who starts the game.
      */
     Board() {
-        for(int i = 0; i < tiles.length; i++) tiles[i] = new Tile(0,0,0);
+        for(int i = 0; i < tiles.length; i++) tiles[i] = new Tile(this,0,0,0);
         for(int i = 0; i < players.length; i++) players[i] = new Player(i+1);
         currentPlayer = 0;
         marks = 0;
     }
 
+    Board(Player[] players) {
+        for(int i = 0; i < tiles.length; i++) tiles[i] = new Tile(this,0,0,0);
+        this.players = players;
+        currentPlayer = 0;
+        marks = 0;
+    }
+
     /**Ends the turn by increasing the mark counter and changing the player.
      * Additionally it ends the game when certain conditions are met.
      */
diff --git a/Main.java b/Main.java
index c310864..b0955d5 100644
--- a/Main.java
+++ b/Main.java
@@ -3,7 +3,6 @@ public class Main {
     public static void main(String[] args) {
         GameUI gui = new GameUI();
         gui.call(args);
-        Board board = new Board();
         //System.out.println("hi");
     }
 
diff --git a/Player.java b/Player.java
index 79e6d04..37b2d27 100644
--- a/Player.java
+++ b/Player.java
@@ -5,7 +5,7 @@ public class Player {
 
     public Player(int playerNumber) {
         this.playerNumber = playerNumber;
-        playerScore = 0;
+        this.playerScore = 0;
     }
 
     public int getPlayerNumber() {
-- 
GitLab