Leskys_Shop / README.md
siigrid's picture
readme_final
ef8ffb6
|
Raw
History Blame Contribute Delete
7.16 kB

A newer version of the Gradio SDK is available: 6.20.0

Upgrade
metadata
title: Lesky's Shop
emoji: ⚗️
colorFrom: green
colorTo: indigo
sdk: gradio
sdk_version: 6.18.0
app_file: app.py
python_version: '3.10'
short_description: Win a board duel to rewrite rules while your opponent lies.
tags:
  - game
  - llm
  - gradio
  - strategy
  - hackathon
  - track:wood
  - sponsor:nvidia
  - sponsor:modal
  - achievement:offbrand
  - achievement:sharing
fullWidth: true

⚗️ Lesky's Shop

"Centuries of practice and you thought YOU could beat ME? Delightful."

A hand-drawn, AI-powered board game built for the Build Small HackathonThousand Token Wood track.

You duel the ancient goblin Lesky across a shifting board. Win a round and you earn the right to write a law in plain English. Type anything — "corners are worth double", "nobody can place in the center", "clashes split the value" — and the LLM translates it into a structured rule that reshapes the board on the spot.

But Lesky lies. He'll announce one law and enact another. Catch him in deception and his guard drops when it matters most. Expose enough lies and The Monster you face next will be fighting at a disadvantage.


Tutorial, Trailer and Post:

Check out the live demos of this project and the post requiered:


Why AI is essential here

This game cannot exist without a language model:

  • Free-text law writing — the core mechanic. The player types a rule in natural language; the LLM translates it into a validated game effect. There is no dropdown, no preset list. Any legal rule the player can describe, the game can enforce.
  • Lesky lies in character — the goblin announces fake law descriptions generated by the LLM, personalized to the game state and round number.
  • In-character chat — argue with Lesky mid-game. He knows the current board, the scroll, the scores, and will be insufferably smug about it.
  • Adaptive taunts — Lesky reacts differently depending on whether he won or lost the round, pre-generated in the background so there's no wait.
  • Fully voiced cast — every character speaks using Chatterbox TTS (via Modal): Lesky taunts and welcomes you in his own voice, The Monster growls through both its rounds, and if you beat them both… a surprise awaits, also fully voiced. Audio is cached on first generation so repeat lines play instantly.

Without the LLM the game falls back to a fixed law list and an honest goblin — playable, but a completely different (lesser) experience.


How to play

The board

Each round, you and Lesky place chips on a grid simultaneously. Every cell has a hidden value. The player whose chips control more total value wins the round.

The Scroll

Up to 3 laws are active at any time, stacked on a shared scroll. They affect cell values, placement, adjacency bonuses, and clash outcomes — and they interact. Order matters: +1 then ×2×2 then +1.

Win a round → write a law

Type any rule in plain English. The LLM parses it and the engine validates it. If your law conflicts with one already on the scroll (e.g. two clash-resolution rules), the old one is automatically repealed.

Catch Lesky lying

After every round you can investigate one law. If Lesky tampered with it — whether it's his own law, a Forest law, or even one of yours — you catch him. Each lie you expose reduces The Monster's accuracy by 7% in the final rounds.

Cleverness

Secret missions reward bonus cleverness each round (e.g. "own 2 corners", "end with no adjacent chips"). Spend it in the shop between fights: scout the opponent's mission hint, reveal a hidden cell, or repeal a law you don't like.

Final score = total board points across all rounds + (total cleverness earned × 3 bonus points)

The campaign

Fight Opponent Board Rounds
1 Lesky the Goblin 3×3 5
2 The Monster 4×4 2

Beat Lesky to claim his treasure and face The Monster. The lies you caught against Lesky carry over — each one makes The Monster 7% less precise.


Tech stack

UI Gradio 6, custom CSS, hand-drawn PNG/GIF art
LLM nvidia/Nemotron-Mini-4B-Instructonly 4B parameters, hosted via Modal
TTS Chatterbox (0.5B parameters) via Modal — distinct voice per character, disk-cached
Game engine Pure Python — no LLM touches the engine directly; the LLM produces effect dicts that the engine validates and rejects if invalid
Model role Law translation · Goblin taunts · In-character chat · Fake law generation · Voice synthesis

The engine is a clean arbiter: it validates every LLM output against a strict effect vocabulary before applying it. Hallucinations get rejected, not enacted.


LLM setup

Modal (recommended for HF Spaces):
Deploy modal/app.py and set the MODAL_ENDPOINT_URL environment variable in your Space settings.

Ollama (local dev):

ollama serve
ollama pull <model>   # see MODEL_NAME in game/llm.py

Without any LLM, the game runs in fixed-law mode — Lesky is honest and laws are chosen from a preset list. Force this with --sin-llm.


Running locally

pip install -r requirements.txt
gradio app.py        # hot-reload dev server → http://localhost:7860
python -m pytest game/test_engine.py -q   # 39 tests

Art & design

All illustrations are original hand-drawn assets. The UI uses layered CSS positioning to composite background, character sprite, foreground, and chat scroll into a single scene — no canvas, pure HTML/CSS over Gradio's component tree.


🏆 Awards we're going for

Track

  • 🌲 An Adventure in Thousand Token Wood — delightful, original experience where AI is essential to the concept

Merit badges

  • 🎨 Off-Brand — fully custom UI: hand-drawn layered scenes, no default Gradio look
  • 🤝 Sharing is Caring — published traces and documented design decisions

Sponsor awards

  • NVIDIA Nemotron Quest — powered by nvidia/Nemotron-Mini-4B-Instruct
  • 🚀 Modal Award — LLM inference and TTS both run on Modal

Special awards

  • 🎨 Off-Brand Award — original art, custom CSS, nothing off the shelf
  • 🎬 Best Demo — gameplay loop is tight and showable in under 2 minutes
  • 🃏 Judges Wild Card — because lying goblins and legislative board games don't come along every hackathon

Authors

GarcIker, Pableskyy, cristinaaguilera, Sgrdii


Built for the Build Small Hackathon · Thousand Token Wood track