From 5701c7babd82cfb27c628639ca4275208b4a7ee5 Mon Sep 17 00:00:00 2001 From: Mustafa Ahmadi <118629586+MustafaAhmadi1994@users.noreply.github.com> Date: Tue, 21 Nov 2023 16:03:59 +0330 Subject: [PATCH] Update App.js in tic-tac-toe Have added a logic for ' tie ' situations --- tic-tac-toe/src/App.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tic-tac-toe/src/App.js b/tic-tac-toe/src/App.js index 3ef8eb9..bb5be5c 100644 --- a/tic-tac-toe/src/App.js +++ b/tic-tac-toe/src/App.js @@ -36,6 +36,10 @@ const App = () => { itemArray[winSituations[i][0]] === itemArray[winSituations[i][2]]) { setWinMessage(`${itemArray[winSituations[i][0]]} wins!`); } + else if (!itemArray.includes("empty") && + itemArray[winSituations[i][0]] !== "empty") { + setWinMessage("Tie!"); + } } }