Inspiration
The idea came from a simple question: what if the internet had its own court system? Every day, absurd things happen online — influencers accidentally stealing plants on livestream, AIs giving terrible dating advice, raccoons committing pizza-related crimes. These situations deserve a proper legal proceeding. Meme Court was born.
What We Built
Meme Court is a single-player AI courtroom game with a 10-phase trial flow. You play as a defense lawyer handling the internet's most ridiculous cases. You pick evidence, choose how to cross-examine witnesses, answer the judge's questions, and write a closing argument — then an AI Judge scores your performance and delivers a dramatic verdict.
The AI participates in exactly 3 key moments per game:
- Witness 1 Rebuttal — after you question Witness 1, the AI generates an in-character emotional response based on your approach
- Witness 2 Rebuttal — same for Witness 2, different personality, different reaction
- Final Verdict — the AI scores your defense across Logic, Humor, Evidence, and Drama, then rules in ALL CAPS
The verdict score is calculated as:
$$\text{Total Score} = (\text{Logic} + \text{Humor} + \text{Evidence} + \text{Drama}) \times 2.5$$
Where each dimension is scored 0–10, giving a final score out of 100.
How We Built It
Tech stack:
- Next.js 16 (App Router) for the full-stack framework
- Framer Motion for animations
- Tailwind CSS v4 for styling
- A custom AI abstraction layer that works with any OpenAI-compatible API
Architecture:
The entire trial is managed by a 10-phase state machine in React Context:
idle → loading_case → opening → case_reveal → evidence
→ witness_1 → witness_1_rebuttal → witness_2 → witness_2_rebuttal
→ judge_question → defense → loading_verdict → verdict
AI calls are fired from the page-level event handlers, not inside components. This was a deliberate decision to prevent duplicate requests.
The AI prompt for witness rebuttals passes the witness personality, original testimony, selected evidence, questioning style, and current judge mood — so every rebuttal is contextually specific.
The verdict prompt receives the full session context and scores the defense across four dimensions, then delivers a case-specific ruling.
Challenges
Duplicate AI calls — React StrictMode double-invokes effects in development. The original implementation had the AI fetch inside a useEffect, which caused 2× requests per witness interaction. We refactored so AI calls happen in event handlers at the page level, and components are pure display.
JSON parsing bug — The AI occasionally returned "moodChange": +5, which is valid JavaScript but not valid JSON. JSON.parse throws on the leading +. We added a normalization step:
const normalized = cleaned.replace(/:\s*\+(\d)/g, ': $1')
Meaningful context — Getting the verdict AI to actually reference what happened in the trial (instead of giving generic feedback) required careful prompt design. The prompt includes which evidence was selected, how each witness was questioned, the judge answer style, and the full closing argument.
What We Learned
- Structuring AI calls at the orchestration layer rather than inside components makes the system far more predictable and debuggable
- Bilingual AI prompts work well — the same prompt structure with a language instruction produces consistent quality in both English and Simplified Chinese
- Designing for exactly 3 AI calls per session forces cleaner game design and keeps costs predictable
Built With
- claude
- cloudflare
- css
- css-frameworks:-next.js-16
- framer-motion
- framer-motion-platforms:-vercel-(deployment)
- next.js-16
- openai-compatible-chat-completions-api
- react-19
- tailwind-css-v4
- typescript
- vercel


Log in or sign up for Devpost to join the conversation.