13 Commits

Author SHA1 Message Date
a754319374 Merge pull request 'core: reorganize some pieces for the future' (#10) from reorganize into main
Reviewed-on: Trianta/trianta.dev#10
2024-11-16 19:12:30 -06:00
Trianta
4aeed537d7 core: update package to v0.2.2 2024-11-16 19:01:52 -06:00
Trianta
f725b4e922 core: propagate changes throughout files 2024-11-16 02:45:38 -06:00
Trianta
8252f38bb7 core: move home page css to root and rename 2024-11-16 02:38:15 -06:00
Trianta
e4d9afdd68 pong: remove unused css file 2024-11-16 02:32:58 -06:00
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
7 changed files with 12 additions and 42 deletions
+4 -2
View File
@@ -1,6 +1,6 @@
FROM nginx:latest 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 WORKDIR /app
@@ -14,10 +14,12 @@ RUN npm run build
WORKDIR /usr/share/nginx/html WORKDIR /usr/share/nginx/html
COPY index.html . COPY index.html .
COPY default.css .
RUN mkdir -p /usr/share/nginx/html/public RUN mkdir -p /usr/share/nginx/html/public
COPY src/*.css ./public
RUN cp /app/build/* ./public RUN cp /app/build/* ./public
HEALTHCHECK CMD nc -z 127.0.0.1 80
EXPOSE 80 EXPOSE 80
View File
+1 -1
View File
@@ -3,7 +3,7 @@
<head> <head>
<meta charset="utf-8"/> <meta charset="utf-8"/>
<title>Trianta</title> <title>Trianta</title>
<link rel="stylesheet" href="public/home.css" /> <link rel="stylesheet" href="default.css" />
</head> </head>
<body> <body>
<div id="navigation"> <div id="navigation">
+5 -5
View File
@@ -1,21 +1,21 @@
{ {
"name": "trianta.dev", "name": "trianta.dev",
"version": "0.1.0", "version": "0.2.2",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "trianta.dev", "name": "trianta.dev",
"version": "0.1.0", "version": "0.2.2",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"typescript": "^5.5.4" "typescript": "^5.5.4"
} }
}, },
"node_modules/typescript": { "node_modules/typescript": {
"version": "5.5.4", "version": "5.6.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.3.tgz",
"integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==",
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
"tsc": "bin/tsc", "tsc": "bin/tsc",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "trianta.dev", "name": "trianta.dev",
"version": "0.1.0", "version": "0.2.2",
"description": "My personal website", "description": "My personal website",
"main": "index.html", "main": "index.html",
"scripts": { "scripts": {
-23
View File
@@ -1,23 +0,0 @@
html, body {
height: 100%;
margin: 0;
}
body {
background: black;
display: flex;
align-items: center;
justify-content: center;
}
.button {
background: blue;
color: white;
padding: 15px 20px;
font-size: 32px;
font-family: Arial, Helvetica, sans-serif;
text-transform: uppercase;
cursor: pointer;
position: relative;
}
+1 -10
View File
@@ -60,11 +60,10 @@ class SnakeCore {
foodAte: boolean; foodAte: boolean;
constructor() { constructor() {
// TODO: Add CSS stuff for page
this.canvas = document.getElementById('snake') as HTMLCanvasElement; this.canvas = document.getElementById('snake') as HTMLCanvasElement;
this.context = this.canvas.getContext('2d') as CanvasRenderingContext2D; this.context = this.canvas.getContext('2d') as CanvasRenderingContext2D;
this.grid = 25; // size of grid squares this.grid = 25; // size of grid squares
this.timeout = 20; // speed in ms this.timeout = 32; // speed in ms
this.width = 25; this.width = 25;
this.height = 15; this.height = 15;
this.board = []; this.board = [];
@@ -213,7 +212,6 @@ class Bot {
} }
} }
// TODO: Fix trim function
trim() { trim() {
let reachedSnake = false; let reachedSnake = false;
this.path.push(this.pathUntrimmed.pop() as Point); // Push food location 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() { nextMove() {
// Get new path to food // Get new path to food
if (this.path.length === 0) if (this.path.length === 0)