updated tic tac toe

This commit is contained in:
Christopher Edwards 2020-11-14 18:50:55 -05:00
parent c4a6f91b73
commit dca41e40ba
6 changed files with 67 additions and 44 deletions

View File

@ -53,9 +53,8 @@
</div> </div>
<main>
<h1 class="display-4">Face Painting, Balloon Twisting & More!</h1>
<h1 class="display-4">Face Painting, Balloon Twisting & More!</h1>
@ -233,7 +232,10 @@
</div> </div>
</div> </div>
</main>
<footer> <footer>

View File

@ -4,7 +4,7 @@
<head> <head>
<!-- Required meta tags --> <!-- Required meta tags -->
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
<link rel="shortcut icon" href="assets/images/logo.png" /> <link rel="shortcut icon" href="assets/images/logo.png" />
<link href="https://fonts.googleapis.com/css2?family=Sansita+Swashed:wght@500&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Sansita+Swashed:wght@500&display=swap" rel="stylesheet">
@ -44,7 +44,8 @@
</form> </form>
</div> </div>
</nav> </nav>
<hr>
<main>
<h1 class="display-3">Painted You</h1> <h1 class="display-3">Painted You</h1>
<div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel"> <div id="carouselExampleCaptions" class="carousel slide" data-ride="carousel">
@ -184,7 +185,7 @@
take-home gift.</p> take-home gift.</p>
</div> </div>
</div> </div>
</main>

View File

@ -1,3 +1,6 @@
body{
box-sizing: border-box;
}
nav{ nav{
background-image: url(assets/images/bg3.jpg) ; background-image: url(assets/images/bg3.jpg) ;
background-color: pink; background-color: pink;
@ -34,7 +37,7 @@ footer{
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
width: 100vw; width: 100%;
background-color: rgb(241, 147, 233); background-color: rgb(241, 147, 233);
text-align: center; text-align: center;
margin-top: 20px; margin-top: 20px;
@ -47,4 +50,11 @@ footer{
.formFooter{ .formFooter{
display:none !important; display:none !important;
}
hr{
background-color: #9966CC;
height: 10px;
margin: 0;
padding: 0%;
} }

View File

@ -3,6 +3,7 @@
<head> <head>
<meta name="theme-color" content="#999999"> <meta name="theme-color" content="#999999">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=yes">
<link rel="icon" type="image/ico" href="tictac.ico"> <link rel="icon" type="image/ico" href="tictac.ico">
<link rel="stylesheet" type="text/css" href="../menu.css"> <link rel="stylesheet" type="text/css" href="../menu.css">
@ -16,7 +17,7 @@
</div> </div>
<script src="../menu.js"></script> <script src="../menu.js"></script>
<br /><br /><br /> <br /><br /><br />
<center> <main>
</br> </br>
</br> </br>
@ -38,8 +39,7 @@
<div id="level"> <div id="level">
<h1> CHOOSE A LEVEL</h1> <h1> CHOOSE A LEVEL</h1>
</div> </div>
</center>
<center>
<pre> <pre>
"Our home-amusements by the warm peat-fire "Our home-amusements by the warm peat-fire
At evening, when with pencil, and smooth slate At evening, when with pencil, and smooth slate
@ -57,7 +57,7 @@ Even for the very service they had wrought,
But husbanded through many a long campaign." But husbanded through many a long campaign."
- Wordsworth - Wordsworth
</pre> </pre>
</center> </main>
<script src="tictac.js"> <script src="tictac.js">
</script> </script>
</body> </body>

View File

@ -2,14 +2,28 @@ body {
background: -webkit-linear-gradient(45deg, hsla(0, 0%, 97%, 1) 0%, hsla(0, 0%, 97%, 0) 70%), -webkit-linear-gradient(315deg, hsla(0, 0%, 38%, 1) 10%, hsla(0, 0%, 38%, 0) 80%), -webkit-linear-gradient(225deg, hsla(0, 0%, 63%, 1) 10%, hsla(0, 0%, 63%, 0) 80%), -webkit-linear-gradient(135deg, hsla(0, 0%, 29%, 1) 100%, hsla(0, 0%, 29%, 0) 70%); background: -webkit-linear-gradient(45deg, hsla(0, 0%, 97%, 1) 0%, hsla(0, 0%, 97%, 0) 70%), -webkit-linear-gradient(315deg, hsla(0, 0%, 38%, 1) 10%, hsla(0, 0%, 38%, 0) 80%), -webkit-linear-gradient(225deg, hsla(0, 0%, 63%, 1) 10%, hsla(0, 0%, 63%, 0) 80%), -webkit-linear-gradient(135deg, hsla(0, 0%, 29%, 1) 100%, hsla(0, 0%, 29%, 0) 70%);
background: linear-gradient(45deg, hsla(0, 0%, 97%, 1) 0%, hsla(0, 0%, 97%, 0) 70%), linear-gradient(135deg, hsla(0, 0%, 38%, 1) 10%, hsla(0, 0%, 38%, 0) 80%), linear-gradient(225deg, hsla(0, 0%, 63%, 1) 10%, hsla(0, 0%, 63%, 0) 80%), linear-gradient(315deg, hsla(0, 0%, 29%, 1) 100%, hsla(0, 0%, 29%, 0) 70%); background: linear-gradient(45deg, hsla(0, 0%, 97%, 1) 0%, hsla(0, 0%, 97%, 0) 70%), linear-gradient(135deg, hsla(0, 0%, 38%, 1) 10%, hsla(0, 0%, 38%, 0) 80%), linear-gradient(225deg, hsla(0, 0%, 63%, 1) 10%, hsla(0, 0%, 63%, 0) 80%), linear-gradient(315deg, hsla(0, 0%, 29%, 1) 100%, hsla(0, 0%, 29%, 0) 70%);
} }
td{
border: 3px solid black;
height: 100px;
width: 100px;
}
#game { #game {
background-color: #E60000; background-color:#ce4949;
text-align: center; text-align: center;
box-shadow: 5px 5px 5px #888888; box-shadow: 5px 5px 5px #888888;
-webkit-animation: rubberBand 1s; height: 300px;
/* Chrome, Safari, Opera */ width: 300px;
animation: rubberBand 1s; border-collapse: collapse;
/* color:#1A1A1A; */
}
tr{
}
#game:hover{
cursor: pointer;
} }
#button { #button {
@ -30,5 +44,22 @@ body {
} }
.t2 { .t2 {
color: red;
} }
.cells{
text-align: center;
}
#tic{
display: flex;
justify-content: center;
}
main{
margin: auto;
display: flex;
justify-content: center;
flex-direction: column;
}
pre{
text-align: center;
}
/* style=" color:#1A1A1A" border="3" cellspacing="10" cellpadding="30" */

View File

@ -1,26 +1,3 @@
var isLame = {
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i) || navigator.userAgent.match(/WPDesktop/i) || navigator.appName.match(/Microsoft|Explorer|IE/i);
},
any: function() {
return (isLame.iOS() || isLame.Opera() || isLame.Windows());
}
};
if ( isLame.any() ) {
document.getElementById("ham").removeAttribute("tabindex");document.getElementById("ham").removeAttribute("onblur");document.getElementById("ham").removeAttribute("onfocusout");
//alert(navigator.userAgent)
}
var board = [] var board = []
var i = Number(i) var i = Number(i)
var j, a, error,xmove, omove, xwin, owin, draw, start; var j, a, error,xmove, omove, xwin, owin, draw, start;
@ -34,13 +11,13 @@ columns = 3
function drawboard(ary){ function drawboard(ary){
document.getElementById("tic").innerHTML = "" document.getElementById("tic").innerHTML = ""
str = "" str = ""
str += '<table id="game" align="center" style="border-collapse: collapse;width:95px; height:95px; color:#1A1A1A" border="3" cellspacing="10" cellpadding="30">' str += '<table id="game">'
for(p = 1, q=1; p < rows; p++){ for(p = 1, q=1; p < rows; p++){
str += '<tr>' str += '<tr>'
for (j = 0; j < columns; q++,j++){ for (j = 0; j < columns; q++,j++){
str += '<td style = color:#FFFFFF id="cell'+q+'">' +ary[q]+'</td>'; str += '<td style = color:#FFFFFF class="cells" id="cell'+q+'">' +ary[q]+'</td>';
} }
str += '</tr>' str += '</tr>'
@ -79,6 +56,8 @@ function cell9(){ if (board[9] == 9 && endgame == false){ board[9] = turn; docum
function changeTurn(){ function changeTurn(){
if(turn == 'X'){ if(turn == 'X'){
// document.getElementsByTagName("td").style.color = "#19FF19";
turn = 'O'; turn = 'O';
} else { } else {
turn = 'X'; turn = 'X';