Ai

object Ai

Computer opponent.

  • Easy: mostly random, sometimes spots an immediate win.

  • Medium: always takes wins and blocks, otherwise mixes search with random play.

  • Hard: alpha-beta search — perfect on 3×3, depth-limited with a line heuristic on bigger boards.

Functions

Link copied to clipboard
fun chooseMove(board: Board, me: Mark, difficulty: Difficulty, random: Random = Random.Default): Int