|
-
Client Software Programmer
along with what northcode said in terms of the 8 ways to win you should also store 1 variable, one that will store your next winning move, and than when its the ai's turn you give it a 50/50 chance to block your winning move or move somewhere random,
id store all the moves in an array like this
var game_slots={
slot1:[0,0,0],
slot2:[0,0,0],
slot3:[0,0,0]
};
and when you make you make a move on 3,3, slot 3 would look like
var game_slots={
slot1:[0,0,0],
slot2:[0,0,0],
slot3:[0,0,1]
};
and when the ai makes a move you can store its flag as a 2 since yours is a 1 lets say it made a move on 1,1 it would look like this
var game_slots={
slot1:[2,0,0],
slot2:[0,0,0],
slot3:[0,0,1]
};
Last edited by AS3.0; 01-04-2017 at 05:16 PM.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|