AWS Builder Center

"Pix-Riddle" — AI Image Guessing Game

Pix-Riddle is an AI-powered image-guessing game where Amazon Bedrock generates creative riddles describing everyday objects, animals, and scenes. Players guess the answer and receive AI-powered feedback ranging from correct to close or incorrect. Built with Bedrock, Lambda, API Gateway, DynamoDB, and Amplify, the game combines AI creativity, real-time interaction, and a global leaderboard for endless replayability.

Software Engineering Student | Cloud & AI Enthusiast | Learning AWS

Weekend Creative Challenge: Pix-Riddle — AI Image Guessing Game

Tag: #creative-expression



Vision & What the App Does

Pix-Riddle is an interactive web game where an AI generates vivid, poetic, and sometimes cryptic descriptions of everyday objects, animals, or scenes — and the player has to guess what's being described. Think of it as a modern, AI-powered "I spy" or charades game played through text.
The core creative output is the game experience itself. Each round presents a fresh, never-before-seen riddle. The AI (Amazon Bedrock with Nova models) crafts imaginative descriptions that challenge perception and reward creative thinking. When a player submits a guess, the same AI evaluates their answer — not just a binary yes/no, but with nuanced feedback that can acknowledge close guesses, clever interpretations, or hilariously wrong ones. This back-and-forth between human creativity and machine imagination is what makes Pix-Riddle special.
The game also features a global leaderboard powered by DynamoDB, adding a light competitive layer. Since every riddle is generated on the fly, the game has effectively infinite replayability — no two sessions are the same.



How I Built It

I approached this challenge with a "less is more" mindset. The goal was a functional, polished, deployable app in a single weekend — not an over-engineered platform. I broke the work into four phases.
Phase 1: Backend Brain. The heart of the app is the Lambda function that talks to Amazon Bedrock. I wrote it in Node.js using the AWS SDK v3. The function handles two operations: generating a riddle and evaluating a guess. For riddle generation, I prompt Nova with instructions to describe a random object in a poetic but solvable way — never naming it directly. For guess evaluation, I send both the riddle description and the player's guess to Nova and ask it to judge correctness on a three-tier scale: correct, close, or incorrect. The initial challenge was prompt engineering — the models sometimes gave away the answer in the riddle itself, or were too strict on judging partial matches. I solved this by iterating on the system prompt, adding explicit instructions like "do not use the object's name or any variant of it" and "a close guess that captures the essence should be marked as correct."
Phase 2: Frontend Polish. I built a single-page app with vanilla HTML, CSS, and JavaScript. No frameworks — keeping the bundle small and Amplify-friendly. The game flow is simple: a splash screen with a "Start" button, then the riddle appears with a typing input, a submit button, and a feedback area. After each round, a "Next Riddle" button appears. The leaderboard sits at the bottom. I spent time on CSS animations (fade-in riddles, score pop-ups) and a mobile-responsive layout to make it feel like a polished product.
Phase 3: Data Layer. DynamoDB stores two things: the current active riddle (so state survives between API calls) and the global leaderboard. The schema is minimal — a partition key and sort key with riddle text, answer key, and score attributes. This was the easiest part; DynamoDB's on-demand mode means zero configuration beyond the table definition in the SAM template.
Phase 4: Deployment. I used AWS SAM (Serverless Application Model) to define the entire backend as infrastructure-as-code. The  template.yaml  specifies the Lambda function, API Gateway endpoint, DynamoDB table, and IAM roles. The frontend is deployed via Amplify connected to the GitHub repo, which auto-deploys on every push. The biggest deployment hurdle was enabling Bedrock model access — it requires manually navigating to the Bedrock console and requesting access to the Nova model, which isn't automatable via CloudFormation yet.



AWS Services Used / Architecture Overview

Service
Purpose
Amazon Bedrock
Generate riddles and evaluate player guesses (Nova)
AWS Lambda
Serverless backend — Bedrock orchestration, score logic
API Gateway
REST API exposing  /riddle  (GET) and  /guess  (POST)
DynamoDB
Stores active riddle state and global leaderboard
S3 / Amplify
Hosts the static frontend (HTML/CSS/JS)
Architecture Flow:
[Player Browser] → [Amplify / S3 Static Hosting]
|
[API Gateway]
/ \
/ \
GET /riddle POST /guess
| |
[Lambda] [Lambda]
| |
[Amazon Bedrock] [Amazon Bedrock]
| |
[DynamoDB] ── stores ── [DynamoDB]
riddle state updates score
  1. Player loads the frontend from Amplify/S3.
  1. Clicking "New Riddle" calls  GET /riddle  → Lambda invokes Bedrock (Nova) → generates a riddle → stores it in DynamoDB → returns riddle text to the frontend.
  1. Player submits a guess via  POST /guess  → Lambda retrieves the riddle from DynamoDB → sends both to Bedrock for evaluation → updates leaderboard in DynamoDB → returns result (correct/close/incorrect + feedback).
All services operate within AWS Free Tier limits for a hobby-scale app.



What I Learned

This challenge taught me several valuable lessons.
Prompt engineering is an art. Getting Bedrock's Nova model to consistently produce solvable-but-challenging riddles without leaking the answer took more iteration than expected. I learned that being extremely explicit in the system prompt — including negative constraints ("do NOT do X") — yields far better results than hoping the model infers intent. I also discovered that telling the model to think step-by-step before giving its final answer dramatically improved evaluation accuracy.
AWS SAM is a productivity multiplier. I had previously deployed Lambda functions manually through the console. Using SAM with a declarative  template.yaml  and the  sam build && sam deploy  workflow saved hours of clicking and reduced the risk of environment drift. The ability to define IAM policies inline for least-privilege access was a bonus I hadn't fully appreciated before.
DynamoDB single-table design for tiny apps works great. For a weekend project, I didn't need complex access patterns. A simple table with on-demand capacity held both the active riddle and the leaderboard without any provisioning fuss.
Vanilla JS is still valid. It's easy to reach for React or Vue out of habit, but for a single-page game with clear state transitions, vanilla JavaScript with  fetch()  was perfectly sufficient — and it kept the page load under 20KB.
Deploy early, iterate often. I had the Lambda function working end-to-end by Saturday morning, which meant I spent the rest of the weekend polishing the frontend, tweaking prompts, and adding the leaderboard — rather than debugging infrastructure at 10 PM on Sunday.



Link to App or Repo

The repository contains the full source code, SAM deployment template, and a  README.md  with setup instructions. You can deploy it yourself in under 10 minutes following the steps in the README.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article