"use client"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { gameData } from "@/lib/game-data"; import { BarChart3, Clock, Trophy, TrendingUp, Users, Zap } from "lucide-react"; export function StatsDashboard() { const { rounds, finalMatrix, startTime, endTime } = gameData; const totalDuration = new Date(endTime).getTime() - new Date(startTime).getTime(); const durationMinutes = Math.floor(totalDuration / (1000 * 60)); const uniqueWords = new Set(rounds.flatMap(round => round.words)); const totalUniqueWords = uniqueWords.size; const wordChanges = rounds.slice(1).reduce((acc, round, index) => { const prevWords = new Set(rounds[index].words); const currWords = new Set(round.words); const changes = Array.from(currWords).filter(word => !prevWords.has(word)).length + Array.from(prevWords).filter(word => !currWords.has(word)).length; return acc + changes; }, 0); const averageDistance = finalMatrix.distances .flat() .filter(d => d > 0) .reduce((a, b) => a + b, 0) / finalMatrix.distances.flat().filter(d => d > 0).length; const maxDistance = Math.max(...finalMatrix.distances.flat()); const minDistance = Math.min(...finalMatrix.distances.flat().filter(d => d > 0)); return ( Performance Statistics
Top 0.02%
{finalMatrix.finalScore}
Final Creativity Score
Percentile
{finalMatrix.percentile}%
Better than others
Duration
{durationMinutes}m
Total game time
Optimization
{rounds.length}
Optimization rounds
Changes
{wordChanges}
Total word swaps
Vocabulary
{totalUniqueWords}
Unique words used

Semantic Distance Analysis

Average Distance
{averageDistance.toFixed(1)}
Across all word pairs
Maximum Distance
{maxDistance}
Most distant pair
Minimum Distance
{minDistance}
Closest pair (non-zero)

Key Insights

  • • Achieved exceptional creativity score through systematic optimization
  • • Hillclimbing algorithm effectively explored the semantic space
  • • {Math.round(wordChanges / rounds.length * 100) / 100} average word changes per round shows focused refinement
  • • High semantic distances indicate successful divergent thinking
); }