From 2a635bc8b5d58e7fde907fe83d26aacc80ea5e4e Mon Sep 17 00:00:00 2001 From: Bel LaPointe <153096461+breel-render@users.noreply.github.com> Date: Sun, 15 Dec 2024 02:26:52 -0700 Subject: [PATCH] compiles --- cmd/server/ws.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/server/ws.go b/cmd/server/ws.go index 3c1fa91..6e47c10 100644 --- a/cmd/server/ws.go +++ b/cmd/server/ws.go @@ -7,6 +7,8 @@ import ( "io" "log" "net/http" + "slices" + "strconv" "strings" "time" @@ -64,7 +66,7 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error { msg := map[string]any{ "help": strings.Join([]string{ - "CARD ASSASSINS (HOLIDAY PHONE EDITION)", + "CARD ASSASSINS (Mobile Ed.)", "", "1. Get any target to say any of his or her kill words.", "2. Click on the kill word a target said.", @@ -77,6 +79,15 @@ func (s *S) serveWS(w http.ResponseWriter, r *http.Request) error { msg["page"] = "B" if gameState.Completed.IsZero() { msg["event"] = "A" + items := []map[string]any{} + for k, v := range gameState.Players { + _, _ = k, v + } + slices.SortFunc(items, func(a, b map[string]any) int { + an, _ := strconv.Atoi(fmt.Sprint(a["title"])) + bn, _ := strconv.Atoi(fmt.Sprint(b["title"])) + return an - bn + }) return io.EOF } else { msg["event"] = "B"