@@ -8,7 +8,6 @@ import src/Render
88import src/Generate
99
1010
11-
1211def playGame(): Unit = {
1312
1413 // Returns the chosen Game Mode
@@ -81,6 +80,7 @@ def playGame(): Unit = {
8180 }
8281 }
8382
83+ // Core Game Loop
8484 def gameLoop(player: Cell, gameMode: GameMode): Unit / {WrongInput} = {
8585 var endGame: Bool = false
8686
@@ -95,28 +95,10 @@ def playGame(): Unit = {
9595
9696 printGameScreen(gameBoard, player)
9797
98- // if (player is Cross()) {
99- // println("You're starting the game!\nChoose the starting Small Board.")
100- // currentSmallBoard = chooseSmallBoard(gameBoard)
101- // gameBoard = newActiveSmallBoard(gameBoard, currentSmallBoard)
102- // } else {
103- // println("Opponent is starting the game!\n")
104- // if (gameMode is Computer()){
105- // currentSmallBoard = computerPlay(gameBoard.smallCopy, computer)
106- // gameBoard = newActiveSmallBoard(gameBoard, currentSmallBoard)
107- // }else{
108- // currentSmallBoard = chooseSmallBoard(gameBoard)
109- // gameBoard = newActiveSmallBoard(gameBoard, currentSmallBoard)
110- // }
111- // }
112- println("You're starting the game!\nChoose the starting Small Board.")
113- currentSmallBoard = chooseSmallBoard(gameBoard)
114- gameBoard = newActiveSmallBoard(gameBoard, currentSmallBoard)
98+ println(playerString(currentPlayer) ++ " - You're starting the game!\nChoose the starting Small Board.")
11599
116100 // INNER GAME LOOP OF ONE GAME
117101 while (not(endGame)){
118-
119-
120102 // Choose the new Small Board
121103 if (currentSmallBoard == 10) {
122104 if (gameMode is Computer()) {
@@ -167,11 +149,6 @@ def playGame(): Unit = {
167149 currentCell = 10
168150
169151 // Verify if the game has been won
170- if (checkWinSituation(gameBoard.smallCopy, currentPlayer) is Win()){
171- println(playerString(currentPlayer) ++ ", You won the game!")
172- consoleInput()
173- endGame = true
174- }
175152
176153 checkWinSituation(gameBoard.smallCopy, currentPlayer) match {
177154 case Win() => {
@@ -189,6 +166,8 @@ def playGame(): Unit = {
189166 // Change The Current Player
190167 if(currentPlayer is Cross()) currentPlayer = Nought()
191168 else currentPlayer = Cross()
169+
170+ printGameScreen(gameBoard, currentPlayer)
192171 ()
193172 }
194173 }
0 commit comments