Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var last_move_won = false;
- if (last_x == last_y) {
- last_move_won |= three_diagonally_down(board, last_symbol);
- }
- if (last_x + last_y == 2) {
- last_move_won |= three_diagonally_up(board, last_symbol);
- }
- last_move_won |= three_horizontally(board, last_y, last_symbol) || three_vertically(board, last_x, last_symbol);
- if (last_move_won) {
- return last_symbol.toUpperCase() + " wins!";
- } else if (no_moves_left) {
- return "Draw!";
- } else {
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement