Truths & Lies: Teaching AI to Kids
An AI-powered Two Truths and a Lie game built in collaboration with the founder\'s 8-year-old son to teach the fundamentals of prompt engineering.
Project Tech Stack
What We Built
Truths and Lies: AI Edition is an interactive web-based trivia game where users guess the lie among three statements about historical figures, sports legends, pop culture stars, and cartoon characters.
Under the hood, the game connects to the Google Gemini API. Rather than using pre-baked databases of questions, the game queries Gemini dynamically to generate two truths and a lie based on the player\'s age group and selected category (Sports, Movies, Science, History, or Music).
Why We Built It & The Differentiator
The primary driver behind this app was family education. I wanted to teach my 8-year-old son the fundamentals of programming and prompt engineering. He drove the main concept—choosing the categories, deciding on the "Hall of Fame" leaderboard, and defining how the badges should look.
Through this project, he learned:
- AI Structuring: How to write prompts that instruct the LLM to output structured JSON data containing exactly one lie and two truths without revealing the answer in the body.
- Context Scoping: Adjusting system instructions based on age buckets (e.g. asking Gemini for kid-friendly concepts like Taylor Swift or Superheroes for Children, and deep history for Adults).
- Gamification Design: Designing database tables to track user scores, award achievement badges (such as "Sports Whiz" or "Night Owl"), and maintain monthly leaderboards.
Core Technical Features
Dynamic Gemini Prompting
Sends parameterized payloads specifying age-ranges and categories to Gemini, enforcing JSON output structures to allow the front-end to render options without exposing the correct answer.
Division Leaderboards
Splits the Hall of Fame scoreboard automatically into separate buckets: Children (under 12), Teens (12-17), and Adults (18+), ensuring fair competition.
Offline Mock Fallback
Implements an in-memory SQL query router simulating users, games, sessions, and achievements tables so developers can test the application without online server setups.
Badge Award Systems
Triggers SQL database upserts after games to verify if unlock criteria are satisfied (e.g. playing at midnight, getting a 5-question streak), storing results in a user achievements table.