1
0
mirror of https://github.com/thib8956/tic-tac-toe-ws.git synced 2025-08-24 00:11:56 +00:00

Add spectator mode

This commit is contained in:
2025-01-29 23:43:33 +01:00
parent 6da3762502
commit 29a587c115
3 changed files with 87 additions and 31 deletions

View File

@@ -1,8 +1,8 @@
export type MessageKind = "click" | "hello" | "update" | "endgame" | "reset";
export type MessageKind = "click" | "hello" | "update" | "endgame" | "reset" | "spectate";
export interface Message {
kind: MessageKind,
data: Click | Update | Hello | EndGame | Reset,
data: Click | Update | Hello | EndGame | Reset | Spectate,
}
export interface Click {
@@ -10,8 +10,10 @@ export interface Click {
y: number
}
export type Symbol = "x" | "o";
export interface Update {
last: { x: number, y: number, symbol: "x" | "o" }
last: { x: number, y: number, symbol: Symbol }
}
export interface Hello {
@@ -25,3 +27,8 @@ export interface EndGame {
type Reset = undefined;
export interface Spectate {
grid: (Symbol | undefined)[]
}