- (void)checkForWin {
if (([[xoSpots objectAtIndex:0] isEqual: @"x"]) && ([[xoSpots objectAtIndex:1] isEqual: @"x"]) && ([[xoSpots objectAtIndex:2] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:3] isEqual: @"x"]) && ([[xoSpots objectAtIndex:4] isEqual: @"x"]) && ([[xoSpots objectAtIndex:5] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:6] isEqual: @"x"]) && ([[xoSpots objectAtIndex:7] isEqual: @"x"]) && ([[xoSpots objectAtIndex:8] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:0] isEqual: @"x"]) && ([[xoSpots objectAtIndex:3] isEqual: @"x"]) && ([[xoSpots objectAtIndex:6] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:1] isEqual: @"x"]) && ([[xoSpots objectAtIndex:4] isEqual: @"x"]) && ([[xoSpots objectAtIndex:7] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:2] isEqual: @"x"]) && ([[xoSpots objectAtIndex:5] isEqual: @"x"]) && ([[xoSpots objectAtIndex:8] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:0] isEqual: @"x"]) && ([[xoSpots objectAtIndex:4] isEqual: @"x"]) && ([[xoSpots objectAtIndex:8] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:2] isEqual: @"x"]) && ([[xoSpots objectAtIndex:4] isEqual: @"x"]) && ([[xoSpots objectAtIndex:6] isEqual: @"x"])) {
[self gameOver:1];
}
else if (([[xoSpots objectAtIndex:0] isEqual: @"o"]) && ([[xoSpots objectAtIndex:1] isEqual: @"o"]) && ([[xoSpots objectAtIndex:2] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:3] isEqual: @"o"]) && ([[xoSpots objectAtIndex:4] isEqual: @"o"]) && ([[xoSpots objectAtIndex:5] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:6] isEqual: @"o"]) && ([[xoSpots objectAtIndex:7] isEqual: @"o"]) && ([[xoSpots objectAtIndex:8] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:0] isEqual: @"o"]) && ([[xoSpots objectAtIndex:3] isEqual: @"o"]) && ([[xoSpots objectAtIndex:6] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:1] isEqual: @"o"]) && ([[xoSpots objectAtIndex:4] isEqual: @"o"]) && ([[xoSpots objectAtIndex:7] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:2] isEqual: @"o"]) && ([[xoSpots objectAtIndex:5] isEqual: @"o"]) && ([[xoSpots objectAtIndex:8] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:0] isEqual: @"o"]) && ([[xoSpots objectAtIndex:4] isEqual: @"o"]) && ([[xoSpots objectAtIndex:8] isEqual: @"o"])) {
[self gameOver:0];
}
else if (([[xoSpots objectAtIndex:2] isEqual: @"o"]) && ([[xoSpots objectAtIndex:4] isEqual: @"o"]) && ([[xoSpots objectAtIndex:6] isEqual: @"o"])) {
[self gameOver:0];
}
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎