File size: 848 Bytes
df2ef4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { ServerGame } from "@/hooks/serverGame"
import { GameId } from "../../convex/aiTown/ids";

export function EndGame({
  game,
  playerId
}: {
  game: ServerGame
  playerId: GameId<'players'>
}) {
    const llms = [...game.world.playersInit.values()].filter(player => !player.human);
    const playerVotes = [...game.world.llmVotes].filter((vote) => vote.voter === playerId);
    if (playerVotes.length === 0) {
        return <p>You didn't vote</p>
    }
    const correctVotes = playerVotes[0].playerIds.filter((playerId) => llms.map(llm => llm.id).includes(playerId));
    return (
        <>
           <h2>LLM Voting results</h2>
           <p>You managed to guess {correctVotes.length} out of {llms.length}</p>
           <p>The LLM were: {llms.map(llm => game.playerDescriptions.get(llm.id)?.name).join(', ')}</p>
        </>
    )
}