Advertisement
fabi0

Untitled

Nov 19th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1.     $combination = '1/2/3/2/3/1/1/3/2/4/5/6/5/6/4/4/6/5/';
  2.     $combination .= '7/8/9/8/9/7/7/9/8/1/4/7/4/7/1/1/7/4/';
  3.     $combination .= '2/5/8/5/8/2/2/8/5/3/6/9/6/9/3/3/9/6/';
  4.     $combination .= '1/5/9/5/9/1/1/9/5/2/5/7/5/7/2/2/7/5';
  5.  
  6.     $moves = array_chunk(explode('/', $combination), 3);
  7.     foreach ($moves as $move) {
  8.         if ($_SESSION['board'][$move[0]] == 'x' && $_SESSION['board'][$move[1]] == 'x' && $_SESSION['board'][$move[2]] == '') {
  9.             unset($_SESSION['_board'][$move[2]]);
  10.             $_SESSION['board'][$move[2]] = 'o';
  11.             header("Location: index.php");
  12.             exit();
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement