https://github.com/anastalaz/tictactoe
TicTacToe provides various AI agents for the Tic Tac Toe game.
https://github.com/anastalaz/tictactoe
ai go minmax-algorithm tic-tac-toe
Last synced: 9 days ago
JSON representation
TicTacToe provides various AI agents for the Tic Tac Toe game.
- Host: GitHub
- URL: https://github.com/anastalaz/tictactoe
- Owner: anastalaz
- License: mit
- Created: 2019-09-26T21:26:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-10T19:09:28.000Z (over 6 years ago)
- Last Synced: 2024-06-20T06:37:32.906Z (over 1 year ago)
- Topics: ai, go, minmax-algorithm, tic-tac-toe
- Language: Go
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# TicTacToe  [](https://godoc.org/github.com/anastalaz/tictactoe)  [](https://goreportcard.com/report/github.com/anastalaz/tictactoe)
TicTacToe provides various AI agents for the Tic Tac Toe game.
## About
This package is inspired by a blog post by [Rob Heaton](https://robertheaton.com/2018/10/09/programming-projects-for-advanced-beginners-3-a/). As of now there are two agents implemented:
1. RandomAI: makes a random legal move.
2. MinMaxAI: uses the [MinMax](https://en.wikipedia.org/wiki/Minimax) algorithm to find the optimal move.
There are three game modes to choose from:
1. Human vs. Human
2. Human vs. AI
3. AI vs. AI

## Installation
```console
$ go get github.com/anastalaz/tictactoe
```
## Example
```go
package main
import (
"fmt"
ttt "github.com/anastalaz/tictactoe"
)
func main() {
p1, p2, err := ttt.Config()
if err != nil {
fmt.Println(err)
return
}
ttt.Play(p1, p2)
}
```