Inspiration

We wanted to create an experience that challenges people to think like a programmer dealing with edge cases. Often, we give instructions to systems and realize our requests were vague or had unintended consequences. The classic folklore of the mischievous genie granting wishes with ironic twists perfectly encapsulates this problem. We wanted to build a game that makes the player experience the importance of precise communication and logical airtightness.

What it does

The Fine Print is an interactive logic game where the player gets three attempts to outsmart an artificial intelligence acting as a literal genie. The player types out a wish, trying to secure a positive outcome without any negative side effects. The game then sends the wish to the backend where a large language model evaluates it for any possible loopholes, ambiguities, or missing constraints. If the wish is flawed, the genie maliciously complies and the player loses the round. If the wording is absolutely airtight, the wish is granted successfully.

How we built it

The project is split into a robust backend and an interactive frontend. The backend is built using Python with FastAPI, providing a lightweight REST interface. It utilizes the OpenAI library connected to Groq API systems, pulling responses from the Llama model. We constructed complex system prompts that dynamically adjust based on the user selected difficulty level.

The frontend is completely custom built using Pygame. We designed an event driven game loop that manages finite states such as intro, casting, and results. We utilized threading to ensure non blocking asynchronous REST calls so the animation and frame rate remain smooth during the network requests to the backend. The custom interface features dynamic typing sequences and active user interfaces customized with mathematically derived easing and pulsing.

Challenges we ran into

Another major hurdle was orchestrating the frontend animation system simultaneously with network requests. Initially, making wishes would stall the Pygame event loop entirely. We had to implement background threading specifically to handle HTTP requests. Furthermore, masking square images into perfectly transparent circular bounds dynamically inside Pygame required manipulating surface pixel blending utilizing mathematical rendering flags.

Accomplishments that we're proud of

We are immensely proud of constructing an entirely custom game engine using Pygame from scratch rather than relying on a heavier prebuilt engine. The user interface looks professional, complete with particle effects, input validation bounds, and smooth visual transitions. We also feel accomplished with our prompt engineering framework. Tuning the large language model to strictly enforce logic without inventing purely magical or unfair flaws took significant iteration.

What we learned

We deepened our knowledge of concurrent programming inside Python, particularly finding effective ways to handle threading seamlessly within a static window loop. We also learned how necessary it is to build flexible parsing systems when communicating with generative models. In addition, we gained an appreciation for structuring game state machines to prevent input bugs or sequence breaking.

What's next for The Fine Print

Moving forward, we want to implement a leaderboard system driven through a relational database so users can see the success rate of various wishes. We are also looking into adding a category system where the game specifically challenges players to craft wishes for particular domains, such as fixing a simulated economy or designing a perfect energy source, evaluating the broader concepts behind the vocabulary.

Built With

Share this project:

Updates