tictactoe

TicTacToe strategic reduction

I decided to write a small program that solves TicTacToe in order to try out the effect of some pruning techniques on a trivial game. The full game tree using minimax to solve it only ends up with 549,946 possible games. With alpha-beta pruning, the number of states required to evaluate was reduced to 18,297. Then I applied a transpos...

Compact way of representing all valid "rows" in a tic-tac-toe grid

I've been writing tic-tac-toe in a variety of languages as an exercise, and one pattern that has emerged is that every representation I've come up with for the defining valid winning rows has been disappointingly hard-coded. They've generally fallen into two categories: First, the board is represented as a one- or two-dimensional array...

What's the best way to approach this simple problem of TicTacToe?

Everything is working up to here, I just need to create the method that checks whether someone has won. Any suggestions on how to tackle this problem effectively? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windo...

Minimax explained for an idiot.

I've wasted my entire day trying to use the minimax algorithm to make an unbeatable tictactoe AI. I missed something along the way (brain fried). I'm not looking for code here, just a better explanation of where I went wrong. Here is my current code (the minimax method always returns 0 for some reason): from copy import deepcopy cla...