1
0
mirror of https://github.com/thib8956/tic-tac-toe-ws.git synced 2026-01-29 14:23:22 +00:00

feat: synchronize colors between clients

This commit is contained in:
2026-01-27 13:08:40 +01:00
parent d8733c48b3
commit eb6011fa9d
4 changed files with 28 additions and 18 deletions

View File

@@ -210,11 +210,11 @@ function init() {
canvasMsg = "connected as spectator";
// Initialize grid state
for (const [index, sym] of (msg.data as Spectate).grid.entries()) {
if (sym === undefined) continue;
if (!sym) continue;
grid[index] = {
kind: sym,
hue: Math.floor(Math.random() * 255),
kind: sym.symbol,
time: null,
hue: sym.hue,
} as Shape;
}
break;
@@ -224,7 +224,7 @@ function init() {
const { x, y } = res.last;
const shape: Shape = {
kind: res.last.symbol,
hue: Math.floor(Math.random() * 255),
hue: res.last.hue,
time: null,
};
grid[y*3+x] = shape;