Skip to content

Commit

Permalink
Merge pull request #3 from Jarvl/small-update
Browse files Browse the repository at this point in the history
Small update
  • Loading branch information
Jarvl authored Feb 19, 2024
2 parents be9123e + 2b7940f commit 7d5f865
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 6 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# Use the official Nginx image from Docker Hub
FROM nginx:latest
COPY public /usr/share/nginx/html
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
## Setup

1. Install dependencies: `npm install`
2. Run webpack to watch for changes: `npm run dev`
3. Do something
2. Run webpack to watch for changes in background: `npm run dev &`
3. Start HTTP server: `python3 -m http.server -d public`
4. Have fun and remember to stop the background job with `kill %1`
9 changes: 9 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var pieceValues = {
[game.QUEEN]: 9,
[game.KING]: 1000,
}
var gameStarted = false;

// TODO: not fully working? I dont think it's calculating the piece values correctly. All board values are -1 when a rook/knight/etc. could be taken by white next turn
var getBoardValue = function(move) {
Expand Down Expand Up @@ -119,9 +120,17 @@ var onDrop = function (source, target) {
removeGreySquares();

displayMoveHistory(game.history());
if (!gameStarted) {
setSubtitle("Walked along the sand dunes of the Sahara desert for forty days and forty nights with nothing but a pack of Newports and a fifth of henny. I really do this shit.");
gameStarted = true;
}
window.setTimeout(makeBestMove, 1000);
};

var setSubtitle = function(text) {
document.getElementById("subtitle").textContent = text;
}

var onSnapEnd = function () {
board.position(game.fen());
};
Expand Down
19 changes: 18 additions & 1 deletion public/css/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
body {
font-family: Arial, sans-serif;
background-color: #333333;
color: white;
font-size: 1.1rem;
}

body > div {
width: 50%;
margin: 0 auto;
text-align: center;
}

.text-left {
text-align: left;
}

/* square */
.square-55d63 {
float: left;
Expand All @@ -22,4 +39,4 @@
.black-3c85d {
background-color: #b58863;
color: #f0d9b5;
}
}
10 changes: 8 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,14 @@
<title>Chess boi</title>
</head>
<body>
<div id="board1" style="width:400px;"></div>
<div id="moveHistory"></div>
<div>
<h1>Chess</h1>
<p id="subtitle">
You can't beat me. Don't even try... unless you want to wake up in a pool of your own tears with a deep sense of shame and humiliation.
</p>
</div>
<div id="board1"></div>
<div id="moveHistory" class="text-left"></div>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="
crossorigin="anonymous"></script>
Expand Down

0 comments on commit 7d5f865

Please sign in to comment.