rust board, room frontend

This commit is contained in:
sparshg
2024-09-15 01:07:16 +05:30
parent 73ab2b63a8
commit 04b9a9502b
11 changed files with 170 additions and 29 deletions

View File

@@ -5,6 +5,17 @@ export class State {
phase: Phase = $state('placement');
playerBoard = $state(new Board(false));
opponentBoard = $state(new Board(true));
room = $state('');
createRoom() {
this.room = Math.random().toString(36).substring(2, 6).toUpperCase();
}
joinRoom(room: string) {
if (room.length != 4) return;
if (room == this.room) return;
this.room = room;
}
}
export class Board {