redribben

oldWinCheck

Nov 2nd, 2015
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. - (void)checkForWin {
  2.     if (([[xoSpots objectAtIndex:0]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:1]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:2]  isEqual: @"x"])) {
  3.         [self gameOver:1];
  4.     }
  5.     else if (([[xoSpots objectAtIndex:3]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:5]  isEqual: @"x"])) {
  6.         [self gameOver:1];
  7.     }
  8.     else if (([[xoSpots objectAtIndex:6]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:7]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:8]  isEqual: @"x"])) {
  9.         [self gameOver:1];
  10.     }
  11.     else if (([[xoSpots objectAtIndex:0]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:3]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:6]  isEqual: @"x"])) {
  12.         [self gameOver:1];
  13.     }
  14.     else if (([[xoSpots objectAtIndex:1]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:7]  isEqual: @"x"])) {
  15.         [self gameOver:1];
  16.     }
  17.     else if (([[xoSpots objectAtIndex:2]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:5]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:8]  isEqual: @"x"])) {
  18.         [self gameOver:1];
  19.     }
  20.     else if (([[xoSpots objectAtIndex:0]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:8]  isEqual: @"x"])) {
  21.         [self gameOver:1];
  22.     }
  23.     else if (([[xoSpots objectAtIndex:2]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"x"]) && ([[xoSpots objectAtIndex:6]  isEqual: @"x"])) {
  24.         [self gameOver:1];
  25.     }
  26.     else if (([[xoSpots objectAtIndex:0]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:1]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:2]  isEqual: @"o"])) {
  27.         [self gameOver:0];
  28.     }
  29.     else if (([[xoSpots objectAtIndex:3]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:5]  isEqual: @"o"])) {
  30.         [self gameOver:0];
  31.     }
  32.     else if (([[xoSpots objectAtIndex:6]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:7]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:8]  isEqual: @"o"])) {
  33.         [self gameOver:0];
  34.     }
  35.     else if (([[xoSpots objectAtIndex:0]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:3]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:6]  isEqual: @"o"])) {
  36.         [self gameOver:0];
  37.     }
  38.     else if (([[xoSpots objectAtIndex:1]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:7]  isEqual: @"o"])) {
  39.         [self gameOver:0];
  40.     }
  41.     else if (([[xoSpots objectAtIndex:2]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:5]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:8]  isEqual: @"o"])) {
  42.         [self gameOver:0];
  43.     }
  44.     else if (([[xoSpots objectAtIndex:0]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:8]  isEqual: @"o"])) {
  45.         [self gameOver:0];
  46.     }
  47.     else if (([[xoSpots objectAtIndex:2]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:4]  isEqual: @"o"]) && ([[xoSpots objectAtIndex:6]  isEqual: @"o"])) {
  48.         [self gameOver:0];
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment