I am trying to recreate M.E.N.A.C.E. (Machine Educable Naughts And Crosses Engine) on the TI-83/84/+. So far I have the display, and player inputs created. Now I have to finish building the AI. But before I do so I wanted to be able to check the win conditions. I am not using a matrix to do this because the AI requires a list of the moves played to properly function. I have considered using a second list and copying over all the even elements, checking if it contains any of the combinations, then checking the odd elements. However that seems to be a bit of a brute force algorithm, and I was hoping someone would know of a way to do this without using brute force.

While I could change the system to use all prime numbers, since it is displayed on the graphscreen I am using relative coordinates to output the naughts, crosses, and the selected box indicator. This would be extremely time consuming, and would make the code a fair bit longer.

A bit more on the AI, which is partially started: The AI uses a “choice” wherein each event starts equally likely. As the AI learns, the probabilities change. The AI starts with a list which corresponds to the gameboards current state. This list contains the partial probabilites of each play. It then selects one of these at random based on the partial probabilities. If the AI wins, the moves it played each get +3 partial prob. A tie is +1, and a loss is -1.

Explanation of partial probability list:

List corresponds to gameboard: 1,2,3,4,5,6,7,8,9

1 2 3

4 5 6

7 8 9

If the board is:

X _ O

X X

_ _ O

And the list is 0,4,0,0,0,23,2,5,0

4/34 chance of spot 2

23/34 chance of spot 6

2/34 chance of spot 7

5/34 chance of spot 8

If the list happens to be: 0,0,0,0,0,0,0,0,0 the AI will resign as it believes it cannot win