ATmega32 plays TIC-TAC-TOE game (tris)

I used my ATmega16/32 demoboard wich features a 128×64 T6963C dot-matrix LCD and and a 4-wire resistive touchscreen (salvaged from a crappy chinese mp4 player).

A static minimization algorithm has been implemented to determine the best move among all the possibilities available at the current game stage.

Since the algorithm plays optimally, the game leads either to draw or defeat of the human player.
If “easy” level is selected, the computer makes the first 3 moves randomly.

The touchscreen is hooked to the AVR using 2 ADC lines and 2 standard IO pins.

Also, a chromatic scale note player has been implemented, it plays notes from C3 to C4 through the buzzer.

T6963C drivers come from http://en.radzio.dxp.pl/t6963/

Have fun!