Skip to content

Commit

Permalink
added a how to play guide
Browse files Browse the repository at this point in the history
  • Loading branch information
hassana123 committed Aug 11, 2022
1 parent c411332 commit d56d4e1
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
24 changes: 24 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
async
src="https://www.googletagmanager.com/gtag/js?id=UA-113861388-2"
></script>
<script src="index.mjs" defer></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
Expand Down Expand Up @@ -64,7 +65,30 @@
}
}
</script>
<div class="popup-container">
<div class="instructions">
<p>You probably already know how to play Tic-Tac-Toe. It's a really simple game, right? That's what most people think. But if you really wrap your brain around it, you'll discover that Tic-Tac-Toe isn't quite as simple as you think!

Tic-Tac -Toe (along with a lot of other games) involves looking ahead and trying to figure out what the person playing against you might do next.</p>

<h1>RULES FOR TIC-TAC-TOE</h1>
<p>1. The game is played on a grid that's 3 squares by 3 squares. </p>
<p>2. You are X, your friend (or the computer in this case) is O. Players take turns putting their marks in empty squares.</p>
<p>3. The first player to get 3 of her marks in a row (up, down, across, or diagonally) is the winner.</p>
<p>4. When all 9 squares are full, the game is over. If no player has 3 marks in a row, the game ends in a tie.</p>
<h1>HOW CAN I WIN AT TIC-TAC-TOE?</h1>
<p>To beat the computer (or at least tie), you need to make use of a little bit of strategy. Strategy means figuring out what you need to do to win.

Part of your strategy is trying to figure out how to get three Xs in a row. The other part is trying to figure out how to stop the computer from getting three Os in a row.

After you put an X in a square, you start looking ahead. Where's the best place for your next X? You look at the empty squares and decide which ones are good choices—which ones might let you make three Xs in a row.

You also have to watch where the computer puts its O. That could change what you do next. If the computer gets two Os in a row, you have to put your next X in the last empty square in that row, or the computer will win. You are forced to play in a particular square or lose the game.

If you always pay attention and look ahead, you'll never lose a game of Tic-Tac-Toe. You may not win, but at least you'll tie.</p>
<button id="start-btn">Start Game</button>
</div>
</div>
<div class="container-custom">
<h1>Tic-Tac-Toe</h1>
<h4>Scoreboard</h4>
Expand Down
8 changes: 8 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
let instuctions = document.querySelector(".popup-container");
let startButtun = document.querySelector("#start-btn");
let customContainer = document.querySelector(".container-custom");

startButtun.addEventListener("click", () =>{
instuctions.style.display = "none";
customContainer.style.display = "flex";
})
8 changes: 8 additions & 0 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,16 @@ h1 {
.right {
text-align: right;
}
.container-custom{
display: none;
}

/* styling for instruction container */

.popup-container{
position: absolute;
width: 20%;
}

/*****************************/
/* Styling For Menu */
Expand Down
33 changes: 32 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,43 @@
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
}
.popup-container{
position: absolute;
width: 50%;
display: block;
font-size: 1rem;
background-color: green;
margin:2% 20%;
line-height: 2.5rem;
padding: 1%;
color: #ffff;
}
.instructions{
background-color: #fff;
color: #000;
padding: 4%;
}
.instructions h1{
color: green;
}
#start-btn{
margin: 2% 20%;
border: 2px solid green;
background-color: #fff;
color: green;
border-radius: 15px;
padding: 25px 90px;
}
#start-btn:hover{
background-color: green;
color: #fff;
}

.container-custom {
/* border: 5px solid black; */
padding-top: 10px;
min-height: 100vh;
display: flex;
display: none;
flex-direction: column;
align-items: center;
justify-content: center;
Expand Down

0 comments on commit d56d4e1

Please sign in to comment.