Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Лаб2 #134

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"liveServer.settings.port": 5501

"liveServer.settings.port": 5501
}
18 changes: 1 addition & 17 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,7 @@ const configure_ai = () => {
});
};

FBInstant.initializeAsync()
.then(function(){
var progress = 0;
var interval = setInterval(function() {
if(progress>=95){
clearInterval(interval);
FBInstant.startGameAsync().then(
function() {
console.log("Game Loaded");
}
)
};
FBInstant.setLoadingProgress(progress);
progress += 5;
}, 100);
}
);


// RESET GAME TO TWO PLAYER MODE
const twoPlayer = () => {
Expand Down
Empty file added git
Empty file.
40 changes: 28 additions & 12 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Заголовок і метатеги -->
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
// Заголовок
<title>TTC</title>
<!--Adding Favicon-->
<link rel="shortcut icon" href="favicon.png" type="image/x-icon">

<!-- Add mute button icon library -->
<!-- FontAwesome для кнопок -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

<!-- Bootstrap для стилів -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2"
crossorigin="anonymous"
/>
<!-- Стилі для сторінки -->
<link rel="stylesheet" href="style.css" type="text/css" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script
async
src="https://www.googletagmanager.com/gtag/js?id=UA-113861388-2"
></script>
<script src="index.mjs" defer></script>
<script>
// Підключення Google Analytics.
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
Expand All @@ -34,22 +37,27 @@
</script>
</head>
<body>

<!-- Навігаційний блок -->
<nav class="navbar fixed-top" id="hero">
<!-- Кнопка для управління аудіо -->
<button class="btn btn-primary" onclick="playAudio(this)" type="button">Play Music</button>
<!-- Слайдер гучності -->
<input type="range" id="volume-slider">
<a class="navbar-brand" href="about.html">About</a>
<a class="navbar-brand" href="#">Play Game</a>
<a class="navbar-brand" href="contributors.html">Contributors</a>
<!-- Кнопка для переключення теми -->
<button class="btn btn-info" onclick="myFunction()">Dark Mode</button>
</nav>
</br>

<!-- Аудіоплеєр -->
<audio id="myAudio">
<source src="music.mp3" type="audio/ogg">
</audio>

<script>
// JavaScript для управління аудіоплеєром.
var x = document.getElementById("myAudio");
var sliderLevel = document.querySelector('#volume-slider')
x.volume = sliderLevel.value/100
Expand All @@ -68,9 +76,10 @@
}
}
</script>
<!-- instructions phase starts here -->
<!-- Фаза інструкцій -->
<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>
Expand All @@ -90,6 +99,7 @@ <h1>HOW CAN I WIN AT TIC-TAC-TOE?</h1>
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>
<!-- Таблиця з кнопками для вибору режиму гри -->
<table>
<tr>
<th><button type="button" class="player1-btn start-btn" name="button" onclick="singlePlayer()">Single Player</button></th>
Expand All @@ -98,17 +108,18 @@ <h1>HOW CAN I WIN AT TIC-TAC-TOE?</h1>
</table>
</div>
</div>
<!-- instruction phase ends here -->
<!-- Контейнер для гри -->
<div class="container-custom">
<h1>Tic-Tac-Toe</h1>
<h4>Scoreboard</h4>
<!-- Таблиця з результатами гри -->
<table>
<tr>
<th><button type="button" name="button" onclick="singlePlayer()">Single Player</button></th>
<th><button type="button" name="button" onclick="twoPlayer()">2 Players</button></th>
</tr>
</table>

<!-- Таблиця зі статистикою -->
<table class="table">
<thead>
<tr style="color: crimson;">
Expand Down Expand Up @@ -136,7 +147,7 @@ <h2 id = "move">PLAYER MOVE!</h2>
</tr>
</tbody>
</table>

<!-- Дошка для гри -->
<div class="play-area" id="play">
<div id="block_0" class="block"></div>
<div id="block_1" class="block"></div>
Expand All @@ -148,9 +159,10 @@ <h2 id = "move">PLAYER MOVE!</h2>
<div id="block_7" class="block"></div>
<div id="block_8" class="block"></div>
</div>
<!-- <button onclick="myFunction()">Toggle dark mode</button> -->

<!-- Скрипти для взаємодії з грою -->
<script>
// Функція для зміни теми сторінки.
function myFunction() {
var main = document.body;
var hero = document.getElementsByClassName('navbar')[0]
Expand All @@ -174,22 +186,26 @@ <h2 id = "move">PLAYER MOVE!</h2>
container.classList.toggle("dark-play")
}
</script>
<!-- Вибір рівня складності -->
<select id="ai_level">
<option value="easy" selected>Easy</option>
<option value="normal">Normal</option>
<option value="hard">Hard</option>
</select>
<!-- Кнопки для скидання дошки та скасування останнього ходу -->
<div class="div-end-of-game">
<!-- <button onclick="reset_board()">RESET BOARD</button> -->
<button onclick="undoLastMove()">Undo Move</button>
<button id="selectXButton" onclick="selectFirstPlayer('X')">Play O first</button>
<button id="selectOButton" onclick="selectFirstPlayer('O')">Play X first</button>

</div>
<!-- Виведення результатів гри -->
<h2 id="winner"></h2>
</div>

<!-- Підключення скрипту для Facebook Instant Games -->
<script src="https://connect.facebook.net/en_US/fbinstant.6.3.js"></script>
<!-- Підключення основного скрипту гри -->
<script src="app.js"></script>
</body>
</html>
Empty file added lab2
Empty file.
19 changes: 19 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "lab1",
"version": "1.0.0",
"description": "lite",
"main": "app",
"scripts": {
"start": "node app.js",
"test": "test"
},
"repository": {
"type": "git",
"url": "git"
},
"keywords": [
"lab1"
],
"author": "im",
"license": "ISC"
}
1 change: 1 addition & 0 deletions tictactoe-lab1
Submodule tictactoe-lab1 added at 0aa7a2