Skip to content

guoguo12/tic-tac-toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-tac-toe in OCaml

This is a command-line, human-vs-computer implementation of tic-tac-toe.

The computer plays optimally using the minimax algorithm.

The computer will play optimally even if the state of the board guarantees that it will lose. This is achieved by scaling the win/loss value of a leaf node (+1 or -1) by the depth of the minimax tree, so that the agent will try to prolong the game as much as possible. (See the "Fighting the Good Fight: Depth" section in this article.)

Demo video

asciicast

Instructions

Clone this repo, run make to compile, then run ./game.native to play.

Dependencies

This project requires Core and Dune.

About

Tic-tac-toe in OCaml.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published