OK this is a quick thought on how to get the machine to pick the right place to place their chip. The easiest way to do it would be to simply follow these rules; 1. if you can win, then do it! (ie. if you can get three in a row) 2. if you'll lose next move then block it (ie. opponent has 2 in a row) 3. if you already have a token in play then add to it's line or row by adding to the location that has the most connected rows or columns (and diagonals). 4. occupy the location that has the most winnable rows/columns or diagonal. The trouble is I want a _mathematical_ way to determine all this - just for kicks :) I do like the idea of assigning a prime number to <empty>, 'X' and 'O' that way a single number will tell me what the content of the row or column or diagnoal are for example <empty> = 1 'X' = 2 'O' = 3 so an empty tripple is 1 (1*1*1), an X win is 8 (2*2*2) and O win is 27 In order to acknowledge he aforementioned rules let's look at the combination numbers. <empty><empty><empty> = 1 <empty><empty>X = 2 <empty><empty>O = 3 <empty>XX = 4 <empty>OO = 9 <empty>XO = 6 any other combination isn't really worth considering since it means there's no empty space. Let's see what happens if we alter this slightly, no longer apply a number to a token, but to whose token it is! <empty><empty><empty> = 1 <empty><empty><mine> = 2 <empty><empty><theirs> = 3 <empty><mine><mine> = 4 <empty><theirs><theirs> = 9 <empty><mine><theirs> = 6 let's start by sorting them in descending order; <empty><theirs><theirs> = 9 <empty><mine><theirs> = 6 <empty><mine><mine> = 4 <empty><empty><theirs> = 3 <empty><empty><mine> = 2 <empty><empty><empty> = 1 Looks like I can't just use the order of these and pick the top most available move as that would have the player miss a winning move with it's value of 6 So we need to make the <empty><mine><mine> value the highest followed by <empty><theirs><theirs> = 9 somehow need to make 2 the same be more than individuals, let's try one positive and one negative. <mine> = -3 <theirs> = 5 for example <empty><theirs><theirs> = 25 <empty><mine><mine> = 9 <empty><empty><theirs> = 5 <empty><empty><empty> = 1 <empty><empty><mine> = -3 <empty><mine><theirs> = -15 interesting, but the winning move is missed, so let's just swap those 2 values. <mine> = 5 <theirs> = -3 for example <empty><mine><mine> = 25 <empty><theirs><theirs> = 9 <empty><empty><mine> = 5 <empty><empty><empty> = 1 <empty><empty><theirs> = -3 <empty><mine><theirs> = -15 this looks like a winning combination :)