Tic Tac Toe solutions in newlisp

Started by duncanbojangles, May 06, 2008, 01:36:47 PM

Previous topic - Next topic

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.

(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

#1
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.com/downloads/reversi.lsp.txt">//http://unbalanced-parentheses.nfshost.com/downloads/reversi.lsp.txt



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

pjot

#2
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">http://www.turtle.dds.nl/newlisp/tictactoe.lsp





Peter