bring server files into project.

This commit is contained in:
2025-01-21 11:50:01 -08:00
parent 58d100b5d3
commit 8700c431cf
32 changed files with 2200 additions and 9 deletions

25
src/lib/server/Game.ts Normal file
View File

@ -0,0 +1,25 @@
import type { Id } from "./Id";
import type { GameData } from "../GameData";
import type { State } from "../State";
export class Game implements GameData {
players: Id[];
isStarted: boolean;
state: State;
constructor() {
this.players = [];
this.isStarted = false;
this.state = {};
}
addPlayer(id: Id) {
this.players.push(id);
}
start() {
if (this.isStarted) throw new Error("game is already started");
this.isStarted = true;
}
}