Projects / tictactoe


This implementation of tictactoe can have an NxN sized board, where N is an odd number >= 3. What makes this implementation different from others is that it does not use lookahead, and still never loses. It is more of an experiment than anything else.

Operating Systems

Recent releases

  •  18 Dec 2001 12:23

    Release Notes: Another losing case was fixed. The program is stable enough that any losses can be fixed by only manipulating different scores.

    •  15 Dec 2001 21:38

      Release Notes: This release adds documentation and changes sticky scores to fix one losing case.

      •  09 Oct 2001 10:58

        Release Notes: Board size can now be determined at run time. Default board size is still specified at compile time. Only odd- or 0-sized boards are allowed at run time.

        •  05 Oct 2001 04:37

          No changes have been submitted for this release.

          Recent comments

          04 Jun 2007 05:34 bluesmoon

          Re: I am weasle episode.. Tic Tac Toe one in a row!
          Nice to know. What do you mean by larger boards though? My version works with boards of infinite length (assuming you have the memory) as long as it's a positive odd integer - 0 being the only even number allowed.

          04 Jun 2007 03:26 hewittjam

          Re: I am weasle episode.. Tic Tac Toe one in a row!
          maru ( uses this logic for tic tac toe but it is more developed and works on larger boards. Not sure if it should be called tictactoe though, probably maru batsu as the name of the domain suggests it.

          18 Dec 2001 08:50 bluesmoon

          Re: can't loose, but doesn't win when it can...

          Well, the computer's move was correct, it's its next move that is wrong:

          X O X

          _ X _

          _ _ O

          when it should have put the X at 3,1, it puts it at 1,3.

          I'm still tweaking the scores, and every post like this helps me make it better, so thank you. I'll add this to my test cases.


          15 Dec 2001 20:09 liadb

          can't loose, but doesn't win when it can...
          I know, I'm bored, but I usually check all TicTacToe implementation using standard strategies. This one failed one of them. It seems that the software wants to draw, not to win! which I find a bit weird (but that just me :).

          I'm reffering to the classic mistake: (computer is X)

          - 0 -
          - X -
          - - -

          Obviously, I lost, but the computer responded with:

          X 0 -
          - X -
          - - -

          Which means that I can draw the game again. Trying to put the 0 in different places but with the same strategy resulted the same (0 in 1/2, 2/1, 3/2, 2,3).

          As I said, I was bored...

          05 Oct 2001 06:43 bluesmoon

          Re: I am weasle episode.. Tic Tac Toe one in a row!

          > I did see that in the freshmeat listing.
          > Its just having recently seen the
          > episode i thought it would be amusing.

          Darn. Must've missed that one.

          Either way, with board size 0 or 1, run
          tictactoe X, to invert the winner.

          The ultimate goal would be to get it to
          play itself, but first I'd have to
          remove the explicit win and dont_lose
          rules. For now, run it on two terminals,
          one with tictactoe O, and the other
          tictactoe X, pass moves from one to the
          other manually (If Tomorrow Comes ;)


          Project Spotlight


          A Fluent OpenStack client API for Java.


          Project Spotlight

          TurnKey TWiki Appliance

          A TWiki appliance that is easy to use and lightweight.