Skip to content

Commit

Permalink
Fix functionality after compiler changes + fix linter warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
JanEricNitschke committed Aug 27, 2024
1 parent ff17f79 commit d1f7e28
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 9 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tictactoe_kotlin/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tictactoe_kotlin/.idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tictactoe_kotlin/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.NonSkippableComposable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -53,6 +54,7 @@ class MainActivity : ComponentActivity() {
}
}

@NonSkippableComposable
@Composable
fun GameBoard(
board: List<String>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.tictactoe_kotlin.tictactoe

import androidx.annotation.VisibleForTesting
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.toMutableStateList
Expand All @@ -21,7 +22,7 @@ object Game {
)
var winningSpots = mutableStateListOf<Int>()
var aiOpponent = mutableStateOf(false)
var aiStrength = mutableStateOf(0)
var aiStrength = mutableIntStateOf(0)

fun swapPlayer(currentPlayer: String): String {
if (currentPlayer == "X") {
Expand Down Expand Up @@ -169,10 +170,7 @@ object Game {
fun makeMove(spot: Int): Boolean {
if (gameState.value == GameState.Playing && _board[spot] == "") {
_board[spot] = player.value
if (gameOver()) {
return false
}
return true
return !gameOver()
}
return false
}
Expand Down

0 comments on commit d1f7e28

Please sign in to comment.