8 Commits

Author SHA1 Message Date
Trianta
90c868d9e9 docker: add healthcheck 2024-11-09 04:37:30 -06:00
Trianta
452c35c1b0 snake: slightly increase speed 2024-11-09 03:18:42 -06:00
Trianta
9dea6014fe snake: remove dealt with comments 2024-11-09 02:57:12 -06:00
Trianta
e37d737d3a snake: decrease speed again 2024-11-09 02:50:24 -06:00
Trianta
65c7b930e3 meta: update package.json 2024-11-09 02:38:08 -06:00
Trianta
082176d75e snake: revert speed back 2024-11-09 02:32:14 -06:00
Trianta
18673c95c4 snake: decrease speed slightly more 2024-11-09 02:25:16 -06:00
Trianta
cb52bd1561 snake: slightly decrease game speed 2024-11-09 02:09:06 -06:00
3 changed files with 5 additions and 12 deletions
+3 -1
View File
@@ -1,6 +1,6 @@
FROM nginx:latest
RUN apt-get update && apt-get install -y nodejs npm
RUN apt-get update && apt-get install -y nodejs npm netcat-openbsd
WORKDIR /app
@@ -20,4 +20,6 @@ COPY src/*.css ./public
RUN cp /app/build/* ./public
HEALTHCHECK CMD nc -z 127.0.0.1 80
EXPOSE 80
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "trianta.dev",
"version": "0.1.0",
"version": "0.2.1",
"description": "My personal website",
"main": "index.html",
"scripts": {
+1 -10
View File
@@ -60,11 +60,10 @@ class SnakeCore {
foodAte: boolean;
constructor() {
// TODO: Add CSS stuff for page
this.canvas = document.getElementById('snake') as HTMLCanvasElement;
this.context = this.canvas.getContext('2d') as CanvasRenderingContext2D;
this.grid = 25; // size of grid squares
this.timeout = 20; // speed in ms
this.timeout = 32; // speed in ms
this.width = 25;
this.height = 15;
this.board = [];
@@ -213,7 +212,6 @@ class Bot {
}
}
// TODO: Fix trim function
trim() {
let reachedSnake = false;
this.path.push(this.pathUntrimmed.pop() as Point); // Push food location
@@ -240,13 +238,6 @@ class Bot {
}
}
/*
values:
0 = left
1 = up
2 = right
4 = down
*/
nextMove() {
// Get new path to food
if (this.path.length === 0)