From 09bafe62f757ba04e9b5f714862f92789d78ca8d Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 6 Mar 2026 07:27:01 -0500 Subject: [PATCH] Add some additional server handling of stuck and remaining Broadcast the clearing of the "stuck" set when dealing, and include the remaining count when a player joins. --- letterrip.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/letterrip.js b/letterrip.js index 23e682d..24b7fd1 100644 --- a/letterrip.js +++ b/letterrip.js @@ -77,6 +77,7 @@ class LetterRip extends Game { } this.state.stuck = new Set(); + this.broadcast_event_object("stuck", { stuck: [] }); this.broadcast_event_object("dealt", { remaining: this.state.bag.length }); @@ -95,7 +96,10 @@ class LetterRip extends Game { /* Don't re-deal if player already has tiles. */ if (this.state.player_tiles[session_id]) { - response.json({ tiles: this.state.player_tiles[session_id] }); + response.json({ + tiles: this.state.player_tiles[session_id], + remaining: this.state.bag.length + }); return; } @@ -114,7 +118,7 @@ class LetterRip extends Game { remaining: this.state.bag.length }); - response.json({ tiles: tiles }); + response.json({ tiles: tiles, remaining: this.state.bag.length }); } handle_stuck(request, response) { -- 2.45.2