Inspiration
We've all watched friends and family make bad money calls because they aren't familiar with a complicated finance term or they don't understand the nuanced logic behind certain financial decisions. We wanted a tool that presents the facts, simplifies the logic, and lets people make educated decisions about their own finances by practicing first.
What it does
Fortune Valley is a pixel-art town where you live out a few years of money decisions, month by month. You can pick a premade life (student, new grad, parent, mid-career) or write a short letter about your own situation and Gemini builds a scenario around it. Each building presents the opportunity for you to make your own decision. They include the bank (save or pay down debt), the office (jobs, taxes), the insurance house (cheap plans or expensive plans), your home (rent, a car, cash buffer), and the market (budget, stocks vs ETFs vs bonds). Life keeps happening in between through a combination of random events such as birthday cash, parking tickets, or a trip to the ER. Each major event is based on real-life probabilities of these events happening, resulting in an incredibly realistic simulation of real life.
When the run ends, the engine replays every decision you made across 1,000 possible futures with different random seeds for market returns and events, and shows whether your run falls under lucky, typical, or unlucky. The 'What-If' feature changes a single decision and reruns it across the exact same 1,000 futures, isolating the impact of your choice from random market fluctuations. This allows you to understand the tradeoffs between volatility and return, allowing you to make a decision based on your desires and teaching you about the nuances of financial decisions.
While playing the game, Sage, our Gemini-powered coach, knows your numbers and uses his vast knowledge of finance to explains the tradeoffs in plain words. After your run, you can ask a chatbot why your choices resulting in the outputted graph and clear up any confusions you have. All AI chats are designed to only give you knowledge and understanding while strictly never being allowed to decide for you or give you suggestions.
How we built it
The frontend uses React, TypeScript, and Vite with a custom graphics pipeline that converts ASCII text grids into pixel-art sprites using keys for colored blocks.
A deterministic TypeScript engine manages monthly budgets, progressive tax tiers, debt servicing, insurance claims, and portfolio dynamics using monthly geometric Brownian motion with correlated return paths.
Monte Carlo runs and path re-evaluations execute inside Web Workers to keep UI rendering smooth. A Vercel serverless gateway handles Gemini API calls using schema-validated JSON with a secondary provider fallback. API keys remain server-side, and core gameplay functions offline. The codebase includes over 550 unit tests and Playwright integration tests.
Since Artificial Intelligence can often hallucinate complex calculations, all calculations are handled completely with code. The website functions fully without AI connection, and the API integration is used primarily for knowledge building and clarifications.
Challenges we ran into
Comparative evaluations require absolute path consistency across iterations. This required strict random seed management per path so environmental events remained identical between scenarios.
Maintaining API reliability under free-tier rate limits required strict JSON outputs and automated fallback handling. Additionally, rendering a fixed retro resolution across varying screen sizes required custom scaling logic.
Since real-world accidents are rare, most of our first few simulations ended with no noteable events. To handle this, we created dummy events like birthday gifts and random bills. These dummy events would result in a net cash flow of under $10. This allowed for more eventful runs without actually affecting the realistic aspect of the game.
Accomplishments that we're proud of
The Monte Carlo reveal clearly demonstrates risk trade-offs, showing how a cheaper health plan can raise expected returns while widening potential losses. It allows for an intuitive way to understand the tradeoff between risk and reward in a way that prior financial simulators are unable to provide. The AI coach explains trade-offs without taking away player control.
What we learned
Teaching finance requires teaching probability and uncertainty because single outcomes do not convey actual risk. Building this project involved implementing Monte Carlo simulations, geometric Brownian motion parameters, insurance risk models, and patterns for embedding LLMs into deterministic game systems.
What's next for Fortune Valley
We plan to expand Fortune Valley into an non-profit educational platform for middle and high schools using our domain at fortunevalley.org. Future plans include teacher-led scenario creation, class leaderboards, and simplified modes with only 2-3 simple concepts for teaching young middle schoolers and elementary schoolers.
Log in or sign up for Devpost to join the conversation.