Go to file
Erik Winter fb34c22ace minimax 2025-01-20 11:55:09 +01:00
README.md minimax 2025-01-20 11:55:09 +01:00
board.go submitted version 2025-01-15 13:59:49 +01:00
go.mod submitted version 2025-01-15 13:59:49 +01:00
main.go submitted version 2025-01-15 13:59:49 +01:00
player.go submitted version 2025-01-15 13:59:49 +01:00

README.md

Tic-Tac-Toe

A simple implementation of Tic-Tac-Toe that runs in the terminal.

For information about this game, check Wikipedia.

Run the game with:

go run .

It uses escape codes to clear the screen after each turn. If this is not supported by your terminal, or if you just don't like them, use the following command to run the game without them:

go run . plain

Bot Player

Simple

  • Implement Player interface
  • Select a random move

Complex

Implement the Minimax algorithm:

  • Implement a way to score the board
  • Recursively play all possible moves
    • Track score for each board state
  • Score each play sequence on minimum and maximum score
    • Use maximum score for states where bot is going to move
    • Use minimum score fot states where player is going to move
  • Pick best option

Example: https://www.neverstopbuilding.com/blog/minimax