Jan 13, 2012

tic-tac-toe AI with two-ply minmax in scheme

Today, while I am reorganizing my old programming source code files, I stumbled upon this old gem —  an implementation of tic-tac-toe AI using two-ply min-max in scheme — which is my project for AI course in university.

Although it was only a half and a year ago, I have already forgot how it works. Besides at that time, I wrote it using plt-scheme, which has become racket now. So, I decided to find out whether the program still works under racket and went through this unbearable pang of downloading racket — a familiar emotion for Internet users inside Myanmar. After waiting for a few hours, I was ready to animate my old friend.



Yeah, it still works, and as far as I tested, the AI is unbeatable. Since this kind of projects are common in university AI courses, I decided to post it online to help some pour souls trying to meet his assignment deadline — that I was once.

Please, note that the evaluation function is too complex and poorly written that I even myself had a hard time understanding. So, you might want to rework that one.

To try out this program, just install racket & run.
sudo apt-get install racket
racket ttc.scm

3 comments:

  1. it doesn't look like Codes. it looks like a normal text with some annotations. @_@

    ReplyDelete
  2. when I try to run it on windows in drRacket i get this error toe.lisp:160:2: read: expected a `)' to close `(' possible cause: indentation suggests a missing `)' before line 162 .

    im trying to get this to run for my students and it will not work. I tried to use gnu clisp and it didn't work there either.

    ReplyDelete
  3. Hello, I made some corrections here : http://pastebin.com/MsCuPgzc (seems to work)
    i think the original developper made some mistakes while pasting here
    regards

    ReplyDelete