aboutsummaryrefslogtreecommitdiff
path: root/src/components/Grid.js
diff options
context:
space:
mode:
authorMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-08-23 18:43:47 +0530
committerMikunoNaka <bokuwakanojogahoshii@yahoo.com>2021-08-23 18:43:47 +0530
commit6036a220e251a9963e62508ae7dfeb68b2f289a2 (patch)
treeb531a5b0e9459e9aade3a55c35f32f0c6902f0a4 /src/components/Grid.js
parentcf81a281889a7f498632b6545acb3ee310f4a4e3 (diff)
changed draw message and now the winner doesn't get extra turn
Diffstat (limited to 'src/components/Grid.js')
-rw-r--r--src/components/Grid.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/components/Grid.js b/src/components/Grid.js
index 289f142..c10b0aa 100644
--- a/src/components/Grid.js
+++ b/src/components/Grid.js
@@ -49,13 +49,13 @@ const Grid = (props) => {
const endGame = (winner) => {
const gameWinner = winner < 2 ? (winner === 1 ? "X" : "O") : "Draw";
- props.setMessage(`WINNER: ${gameWinner}`);
+ props.setMessage(`${gameWinner === "Draw" ? "" : "WINNER: "}${gameWinner}`);
props.setShowMessage(true);
gameWinner === "Draw" || (gameWinner === "X"
? props.setScoreX(props.scoreX + 1)
: props.setScoreO(props.scoreO + 1));
setBoard([2,2,2,2,2,2,2,2,2]);
- winner < 2 && props.setTurn(winner); // set turn to prev. winner
+ // winner < 2 && props.setTurn(winner); // set turn to prev. winner
}
useEffect(() => {