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"