I've created a domino game using c2 and I am 80% completed.
What's got me stuck is trying to do some basic AI playing.
Design:
For a domino(sprite) i have 3 instance variables (boolean:isplayed, boolean:iscouple, number:playernum)
I have a group that runs a random array that 'shuffles' each domino an assigns to the 4 players. It also sets the playnum(player 1-4) and sets the iscouple(couples).
I have a global variable 'izturn' that I use to compare against playernum to validate which player can play.
I also have 2 global variables that i set what domino can play left or right (avbleft,avbright).
On each play i have groups that determine the location to play each domino, at which end of the board and angle.
My gameplay works perfectly if I play as each player manually, all the locations and angles for set perfectly. So now i'd like to automate cpu playing.
Logic:
After the user plays run automate group (with 3 sub groups)
1st sub group 'play couples':
loop through all dominoes,
domino not isplayed,
domino iscouple
playnum(domino) = playerturn
if these match, then sub-event checks if domino can play left or right:
if dom.top = avbleft -> stop loop, get IID, play by IID, close group
if dom.top = avbright -> stop loop, get IID, play by IID, close group
My problem is that the loop doesn't seem to stop. Why?
Other 2 sub groups are disabled for now as the also run loops and cause the same problems.
I've put in a MyTest variable to see how many iterations of the loop runs and i'm getting different figures from a few hundred to a few thousand.
I consider myself to be an intermediate programmer who has done quite a few loop scripts in vb and javscript and C2 has me stuck for days trying to figure this out. <img src="http://chezral.6te.net/group.jpg" border="0" />