Skip to content

Commit 1180887

Browse files
committed
Small test
1 parent 1c8c9fc commit 1180887

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/ai.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fun depthLimitedSearch(board: Board, height: Int): Pair<Double, Direction> {
8787
copyBoard[i, j] = 4
8888
sum += depthLimitedSearch(copyBoard, height - 1).first * 0.1
8989
copyBoard[i, j] = 0
90-
count += 2
90+
count += 1
9191
}
9292
}
9393
}

src/tester.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fun main() {
2+
val board = Board(4, 4, 50.0, 50.0)
3+
val steps = 1000
4+
for (i in 0 until steps) {
5+
println("Step " + i + " Heuristic: " + staticEvaluator(board))
6+
val direction = enumValues<Direction>().toList().shuffled()[0]
7+
board.move(direction)
8+
if (board.gameState == GameState.LOST) {
9+
break
10+
}
11+
}
12+
}

0 commit comments

Comments
 (0)