Hello! I have just started making a Tic-Tac-Toe program, and I have run into some problems and was hoping for assistance. I used matrices to store the game board data, 1 being Player 1 and -1 being Player 2. The below code takes a matrix, converts it into three lists (rows/columns), and checks to see if someone has won yet (1,1,1 or -1,-1,-1 will have a sum(abs(3))).
//Checks Columns for 3 in a Row Matr>list([A],L1,L2,L3 If sum(abs(L1)=3 or sum(abs(L2)=3 or sum(abs(L3)=3 10->F //Checks Rows for 3 in a Row Matr>list([A]^^T,L1,L2,L3 If sum(abs(L1)=3 or sum(abs(L2)=3 or sum(abs(L3)=3 10->F
What I am wondering is how would/should I go about checking for three in a row on diagonals? Also, any ideas on how to incorporate an AI so it can check a matrix and choose where to play? I just want it to check if it can win and if the player can win. I don't want an "impossible AI", I want it to be beatable. Thanks in advance!