PDA

View Full Version : AI for connect 4 in Scheme



Mr.Macdonald
February 1st, 2009, 09:40 PM
I am trying to write an AI for Connnect 4. I plan to use backtracking. But I don't know whether I should backtrack for every move or just until I have a path that lets me win.

If I try every move, then I will be able to find the fasted way to win. But it might take too long. and be to processor intensive.

If I only try enough moves to ensure my win (all of the enemies moves and only the first few of mine). Then it will find it alot faster, but it will not be the smartest AI.

Another alternative, it to desend the tree of moves equally (desend all branches at same time), and quit when I find a way to win.


My concern is because I did this in Python along time ago and I tried backtracking all the possablities. This made it take an incredibly long time.

Please don't post code, just help with the concept. I want to learn!

mike_g
February 1st, 2009, 09:57 PM
You might want to have a look at alpha beta pruning (http://en.wikipedia.org/wiki/Alpha-beta_pruning) for optimising your search.