Skip to content

Latest commit

 

History

History
25 lines (24 loc) · 1.11 KB

README.md

File metadata and controls

25 lines (24 loc) · 1.11 KB

tictactoe

Simple text-based tic-tac-toe game written in C. Can be played with 0, 1, or 2 human players, with the computer using a minimax search with alpha-beta pruning for the remaining player(s). The search depth is unlimited, so the computer will always play perfectly. Where two or more moves have an equal evaluation, the computer will select randomly, with equal probability of choosing each move, except on the first move, when the computer will choose between playing in the center, corner, or edge with probability 1/3 of each, so that the probability of choosing a given specific non-center square is 1/12.

Instructions

make

then

./tictactoe

If it fails to compile, try removing -flto from the first line of the Makefile (sed -i 's/ -flto//' Makefile) and try again (or set your CFLAGS environment variable). In particular this is known to be necessary and sufficient to compile on Android in Termux with clang. Only the standard library is used, however a compiler supporting C99 is required.