Tic Tac Toe solutions in newlisp

Notices and updates
Locked
duncanbojangles
Posts: 1
Joined: Sun Apr 27, 2008 9:15 pm

Tic Tac Toe solutions in newlisp

Post by duncanbojangles »

Hello. I've played with Scheme before coming to newlisp and to test out newlisp I wrote a program to find all the possible moves in a 3x3 tic tac toe game in a mostly functional manner. In an effort to learn more about newlisp I was wondering if anyone had any other tic tac toe or similar solvers written in a different style.

If anyone wants, I can post the code I have to this thread. Also, I stored the moves in a giant nested list, where each nest of the list represents all the possible next moves of the parent list.

Code: Select all

(parent
    (child
        (child child))
    (child
        (child
            (child child child))
        child)))
There's a little more to it, but that's the gist of it. The file that contains this list is 14 megabytes!

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post by cormullion »

Hi there! Hope you're enjoying newLISP.

It could be an interesting challenge - perhaps I'll take you up on it soon. I haven't done TicTacToe, but I did do a basic version of Othello/Reversi, which isn't a million miles away from TTT:

http://unbalanced-parentheses.nfshost.c ... si.lsp.txt

Although I'm not sure that calculating every possible move is desirable... (he said provocatively) :)

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post by pjot »

Yes, but it is kind of ugly (but it works). I tried to do something with AI but this was before the (bayes) stuff entered the language. Anyway for your reference:

http://www.turtle.dds.nl/newlisp/tictactoe.lsp


Peter

Locked