Quote:
Originally Posted by stellyPC
thanks works great!
Anther question:
in the code i posted the catsgame is not working!
do you know wahts the prob ?
thanks??
|
i find out what was wrong the catsgame code was only running when there was a winner because it ws connected with if and the brakets where all closing after it HERE is the right way:
-(void)processLogic{
//The process Logic will check for a win, if one is present it will present
//a UIAlert. If one is not found it will display a Draw message if all the spaces are filled.
if([self checkForWin]){
if(playerToken==1){
myAlertView = [[UIAlertView alloc] initWithTitle:@"Winner!" message:@"Player X wins!" delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[myAlertView show];
[self resetBoard];
}
if(playerToken==2){
myAlertView = [[UIAlertView alloc] initWithTitle:@"Winner!" message:@"Player O wins!" delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[myAlertView show];
[self resetBoard];
}
}else{
if(numberOfPlays == 8){
myAlertView = [[UIAlertView alloc] initWithTitle:@"No Winner!" message:@"It's a cats game!" delegate:self cancelButtonTitle:@"Ok." otherButtonTitles:nil];
[myAlertView show];
[self resetBoard];
}
}
}