diff --git a/FrontendTemplate/src/components/GutiButton.jsx b/FrontendTemplate/src/components/GutiButton.jsx index 1caa921..66af45c 100644 --- a/FrontendTemplate/src/components/GutiButton.jsx +++ b/FrontendTemplate/src/components/GutiButton.jsx @@ -7,7 +7,14 @@ import chor from "../assets/chor.png"; import dakat from "../assets/dakat.png"; import { Button } from "antd"; -const GutiButton = ({ playerName, shufArray, restart, scores, addScore, setScore }) => { +const GutiButton = ({ + playerName, + shufArray, + restart, + scores, + addScore, + setScore, +}) => { const [showButton, setShowButton] = useState(true); const [showImage, setShowImage] = useState(false); const [selectedButton, setSelectedButton] = useState(null); @@ -17,7 +24,7 @@ const GutiButton = ({ playerName, shufArray, restart, scores, addScore, setScore const [policeGuess, setPoliceGuess] = useState(-1); const [isChor, setIsChor] = useState(true); const gotImage = [chor, dakat, police, babu]; - const bangla = ["চোর", "ডাকাত", "পুলিশ", "বাবু"]; + const bangla = ["চোর", "ডাকাত", "পুলিশ", "বাবু"]; var curscore = [0, 0, 0, 0]; var selectedIndex; @@ -36,7 +43,7 @@ const GutiButton = ({ playerName, shufArray, restart, scores, addScore, setScore const tmp = shufArray[index]; shufArray[index] = shufArray[0]; shufArray[0] = tmp; - //console.log("after" + shufArray); + console.log("after" + shufArray); setSelectedImage(shufArray[0]); // TODO : DISTRIBUTE 3 to ai @@ -60,32 +67,28 @@ const GutiButton = ({ playerName, shufArray, restart, scores, addScore, setScore } } - function getChorDakat(){ + function getChorDakat() { var ans = []; - for(var i = 0; i < 4; i++){ - if(shufArray[i] < 2) ans.push(i); + for (var i = 0; i < 4; i++) { + if (shufArray[i] < 2) ans.push(playerName[i]); } return ans; } - function isPoliceCorrect(){ - if(isChor && shufArray[policeGuess] == 0) return true; -else if(!isChor && shufArray[policeGuess] == 1) return true; - else{ + function isPoliceCorrect() { + if(policeGuess === -1) { const currentTimestamp = new Date().getTime(); - const randomValue = currentTimestamp % 2; - - if(randomValue==0){ - return true; - } - else return false; + const randomValue = currentTimestamp % 2; + setPoliceGuess(getChorDakat()[randomValue]); } + if (isChor && policeGuess === getPolice(0)) return true; + else if (!isChor && policeGuess === getPolice(1)) return true; return false; } function getScore() { const newScores = [0, 0, 0, 0]; // Create a new array to store the updated scores - + for (let i = 0; i < 4; i++) { if (shufArray[i] === 3) newScores[i] = 100; else if (shufArray[i] === 2 && isPoliceCorrect()) newScores[i] = 80; @@ -99,10 +102,9 @@ else if(!isChor && shufArray[policeGuess] == 1) return true; } else newScores[i] = 40; } } - + return newScores; } - return ( @@ -110,16 +112,22 @@ else if(!isChor && shufArray[policeGuess] == 1) return true;
{lastState && (
- {isPoliceCorrect() ? "পুলিশ সঠিক ধরেছেন" : "পুলিশ ভূল ধরেছেন"}
- চোর {isChor && isPoliceCorrect() ? "+০" : "+৪০"}
- ডাকাত {!isChor && isPoliceCorrect() ? "+০" : "+৬০"}
+ {isPoliceCorrect() ? "পুলিশ সঠিক ধরেছেন" : "পুলিশ ভূল ধরেছেন"}{" "} +
+ চোর {isChor && isPoliceCorrect() ? "+০" : "+৪০"}{" "} +
+ ডাকাত + {!isChor && isPoliceCorrect() ? "+০" : "+৬০"} + {" "} +
বাবু +১০০
পুলিশ {isPoliceCorrect() ? "+৮০" : "+০"}
-
{isChor == true ? "চোর কে ধরুন" : "ডাকাত কে ধরুন" }
+
+ {" "} +
+ {" "} + {isChor == true ? "চোর কে ধরুন" : "ডাকাত কে ধরুন"}{" "} +
{" "} +
{selectedImage == 2 && (
@@ -160,21 +174,21 @@ else if(!isChor && shufArray[policeGuess] == 1) return true; className="jayga" onClick={() => { setLastState(true); - setPoliceState(false); - setPoliceGuess((getChorDakat())[0]); + setPoliceState(false); + setPoliceGuess(getChorDakat()[0]); }} > - {(getChorDakat())[0]} + {getChorDakat()[0]}
)} diff --git a/FrontendTemplate/src/components/Players.jsx b/FrontendTemplate/src/components/Players.jsx index b7ac6fd..4fb9e4a 100644 --- a/FrontendTemplate/src/components/Players.jsx +++ b/FrontendTemplate/src/components/Players.jsx @@ -89,17 +89,22 @@ const Wrapper = styled.section` flex-direction: column; justify-content: center; align-items: center; - height: 275px; + height: 150px; + } + .color-name { + font-size: 15px; } .player-container .image { - margin-top: -20px; + /* margin-top: -20px; */ max-height: 70%; } .player-container .r8 { - margin-top: -80px; + margin-top: -30px; + font-size: 15px; } .r8 { - margin-top: -30px; + /* margin-top: -10px; */ + font-size: 15px; padding: 0px; } .image { @@ -107,8 +112,7 @@ const Wrapper = styled.section` max-height: 100%; } .name { - font-size: 25px; - padding: 20px; + font-size: 15px; } } `; diff --git a/FrontendTemplate/src/components/ShakeHand.jsx b/FrontendTemplate/src/components/ShakeHand.jsx index a16fcf4..619887f 100644 --- a/FrontendTemplate/src/components/ShakeHand.jsx +++ b/FrontendTemplate/src/components/ShakeHand.jsx @@ -79,7 +79,9 @@ const Wrapper = styled.section ` font-size: 20px; height: 40px; width: 200px; - display: inline-block; + display: flex; + justify-content: center; + align-items: center; padding: 10px 20px; border: none; border-radius: 20px; diff --git a/FrontendTemplate/src/components/gameControllers.js b/FrontendTemplate/src/components/gameControllers.js index 4f922d9..a06d357 100644 --- a/FrontendTemplate/src/components/gameControllers.js +++ b/FrontendTemplate/src/components/gameControllers.js @@ -29,10 +29,10 @@ export function updateScore(scores, move, guess) { var police; for (let i = 0; i < 4; i++) { - if (move[i] == 0) score[i] = 40; - else if (move[i] == 1) score[i] = 60; - else if (move[i] == 3) score[i] = 100; - else if (move[i] == 2) { + if (move[i] === 0) score[i] = 40; + else if (move[i] === 1) score[i] = 60; + else if (move[i] === 3) score[i] = 100; + else if (move[i] === 2) { score[i] = 80; police = i; } diff --git a/FrontendTemplate/src/pages/ai_page/AIPage.css b/FrontendTemplate/src/pages/ai_page/AIPage.css index 872ff32..e1af49d 100644 --- a/FrontendTemplate/src/pages/ai_page/AIPage.css +++ b/FrontendTemplate/src/pages/ai_page/AIPage.css @@ -30,6 +30,13 @@ border: 1px solid black; } +.score-row-element{ + display:block; + width:100%; + height: 30px; + overflow: hidden; +} + @media (max-width: 768px) { .ai-canvas{ flex-direction: column; diff --git a/FrontendTemplate/src/pages/ai_page/AIPage.jsx b/FrontendTemplate/src/pages/ai_page/AIPage.jsx index fcccd76..4ebab4e 100644 --- a/FrontendTemplate/src/pages/ai_page/AIPage.jsx +++ b/FrontendTemplate/src/pages/ai_page/AIPage.jsx @@ -1,7 +1,6 @@ import "./AIPage.css"; import { FloatButton } from "antd"; import { CommentOutlined } from "@ant-design/icons"; -import ChatModal from "../../components/ChatModal"; import { useEffect, useState } from "react"; import GameBoard from "../../components/GameBoard"; @@ -58,7 +57,7 @@ export default function AIPage() { console.log("Scoreee isss: "); // console.log(scores[0][scores[0].length - 1]); var maxScore = Math.max(...totalScore); - if (maxScore >= 140) { + if (maxScore >= 1500) { setIsGameOver(true); console.log(isGameOver); console.log("yes i am true"); @@ -105,11 +104,13 @@ export default function AIPage() { const randomValue = currentTimestamp % 19; const a = peopleNames[randomValue]; const b = peopleNames[randomValue + 1]; - const c = peopleNames[randomValue + 2]; + const c = peopleNames[randomValue + 2]; setSelectedNames([userData.username, a, b, c]); + const tmpScore = [[userData.username], [a], [b], [c]]; + console.log(tmpScore); - setScore([[userData.username], [a], [b], [c]]); + setScore(tmpScore); initiated = true; } @@ -120,7 +121,7 @@ export default function AIPage() { return ( <> - {isGameOver ? ( + {isGameOver && ( - ) : ( - )} - - } - onClick={() => { - setIsModalOpen(true); - }} - />
(
{score.map((point, idx) => ( - + {point}
diff --git a/FrontendTemplate/src/pages/landing_page/LandingPage.css b/FrontendTemplate/src/pages/landing_page/LandingPage.css index 8657de3..12eca74 100644 --- a/FrontendTemplate/src/pages/landing_page/LandingPage.css +++ b/FrontendTemplate/src/pages/landing_page/LandingPage.css @@ -1,4 +1,8 @@ /* Default styles for larger screens */ +body { + background-image: linear-gradient(to right, #d3cce3, #e9e4f0); +} + .landing-canvas { display: flex; height: 100vh; @@ -44,6 +48,7 @@ /* Media query for mobile devices (max-width: 768px) */ @media screen and (max-width: 768px) { + .landing-canvas { margin-top: 5vh; flex-direction: column; diff --git a/FrontendTemplate/src/pages/landing_page/LandingPage.jsx b/FrontendTemplate/src/pages/landing_page/LandingPage.jsx index 4a73d1b..e17b934 100644 --- a/FrontendTemplate/src/pages/landing_page/LandingPage.jsx +++ b/FrontendTemplate/src/pages/landing_page/LandingPage.jsx @@ -16,7 +16,7 @@ export default function LandingPage() { } return ( - <> +
Chor Dakat Babu Police @@ -41,6 +41,6 @@ export default function LandingPage() { }}>continue
- +
); }