diff --git a/index.html b/index.html
index 9993521..57dd42e 100644
--- a/index.html
+++ b/index.html
@@ -3,8 +3,10 @@
diff --git a/script.js b/script.js
index 5c15604..2ce6100 100644
--- a/script.js
+++ b/script.js
@@ -93,7 +93,7 @@ function renderPieces(){
}
-//----fuctions to claculate all the moveable positions starts here-----
+//----functions to calculate all the moveable positions starts here-----
function getDropCutPlaces(piece){
var dropPlaces = []
@@ -141,11 +141,11 @@ function getPawnPlaces( x, y, dropPlaces, cutPlaces ){
dropPlaces.push( { x: x, y: y } )
}
y++
- if( y < 8 && isPlayer2Piece( occupiedBy ) ){
+ if( y < 8 && isPlayer2Piece( board[x][y].occupied ) ){
cutPlaces.push( { x: x, y: y } )
}
y-=2
- if( y > 0 && isPlayer2Piece( occupiedBy ) ){
+ if( y > 0 && isPlayer2Piece( board[x][y].occupied ) ){
cutPlaces.push( { x: x, y: y } )
}
}
@@ -158,11 +158,11 @@ function getPawnPlaces( x, y, dropPlaces, cutPlaces ){
dropPlaces.push( { x: x, y: y } )
}
y++
- if( y < 8 && isPlayer1Piece( occupiedBy ) ){
+ if( y < 8 && isPlayer1Piece( board[x][y].occupied ) ){
cutPlaces.push( { x: x, y: y } )
}
y-=2
- if( y > 0 && isPlayer1Piece( occupiedBy ) ){
+ if( y > 0 && isPlayer1Piece( board[x][y].occupied ) ){
cutPlaces.push( { x: x, y: y } )
}
}
@@ -307,6 +307,7 @@ function occupiedById( x, y ){
return board[x][y].occupied
}
+//--future feature
function isKingInDanger( KingPlayer ){
// var kingPosX, kingPosY
// if ( KingPlayer == 1 )
@@ -317,7 +318,7 @@ function isKingInDanger( KingPlayer ){
// if
}
-//higlights all the places where we can cut other player's piece
+//highlights all the places where we can cut other player's piece
function activateCutPlaces(arr){
var square, place
for(i in arr)
@@ -329,7 +330,7 @@ function activateCutPlaces(arr){
}
}
-//higlights all the places where we can place our piece
+//highlights all the places where we can place our piece
function activateDropPlaces(arr){
var square, place
for(i in arr){
@@ -340,7 +341,7 @@ function activateDropPlaces(arr){
}
}
-//invoke higlighting functions
+//invoke highlighting functions
function pick(e){
pieceId = Number(e.target.id)
piece = pieces[ pieceId ]
@@ -432,7 +433,7 @@ function drop(e){
clearBoard()
}
-//clear event listner and classes of chess board divs
+//clear event listener and classes of chess board divs
function clearBoard(){
for( i = 0 ; i < 8; i++ ){
for( j = 0 ; j < 8; j++ ){
@@ -529,6 +530,7 @@ function reset(){
board = []
pieces = []
playerChance = 1
+ undoMove = null
createBoard()
renderBoard()
createPieces()
diff --git a/style.css b/style.css
index 92b2444..c2ba1b6 100644
--- a/style.css
+++ b/style.css
@@ -1,18 +1,25 @@
-*{
- font-family: Arial, Helvetica, sans-serif;
+body{
+ font-family: 'Orbitron', sans-serif;
+ background-color: black;
+ color: white;
+}
+.main-heading{
+ text-align: center;
+ font-size: 40px;
+ margin: 10px auto;
}
.chessBoard{
display: grid;
border: 1px solid black;
- height: 600px;
- width: 600px;
+ height: 550px;
+ width: 550px;
grid-template-columns: repeat(8, 1fr);
grid-template-rows: repeat(8, 1fr);
}
.chessBoard > div{
text-align: center;
padding: 10px;
- background-color: #E6BA8F;
+ background-color: #DBDBDB;
}
.chessBoard > div:nth-child(16n+1),
.chessBoard > div:nth-child(16n+3),
@@ -22,13 +29,13 @@
.chessBoard > div:nth-child(16n+12),
.chessBoard > div:nth-child(16n+14),
.chessBoard > div:nth-child(16n+16){
- background-color: #BD7D40;
+ background-color: #639C56;
}
.white{
- color: white;
+ color: #AC2525;
}
.black{
- color: black;
+ color: #2A2A2A;
}
.picked{
background-color: orange !important;
@@ -44,6 +51,9 @@
display: flex;
align-items: center;
justify-content: space-evenly;
+ background-color: #30452B;
+ margin: 5px auto;
+ width: 90%;
}
.main-div > div {
margin: 20px;
@@ -57,12 +67,15 @@
}
.stats button{
font-size: 20px;
+ font-family: 'Orbitron', sans-serif;
padding: 10px 20px;
border: none;
background-color: lime;
+ color: white;
border-radius: 10px;
}
.stats input{
+ font-family: 'Orbitron', sans-serif;
font-size: 25px;
padding: 10px;
}