Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. var last_move_won = false;
  2.  
  3. if (last_x == last_y) {
  4. last_move_won |= three_diagonally_down(board, last_symbol);
  5. }
  6.  
  7. if (last_x + last_y == 2) {
  8. last_move_won |= three_diagonally_up(board, last_symbol);
  9. }
  10.  
  11. last_move_won |= three_horizontally(board, last_y, last_symbol) || three_vertically(board, last_x, last_symbol);
  12.  
  13. if (last_move_won) {
  14. return last_symbol.toUpperCase() + " wins!";
  15. } else if (no_moves_left) {
  16. return "Draw!";
  17. } else {
  18. return false;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement