Skip to content

kjustin2/Spending-Learning-Game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

7 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฐ Money Choices - Spending Habits Simulator

An interactive educational game that visualizes how daily spending decisions compound over time, teaching financial literacy through real-world scenarios and immediate visual feedback.

Game Preview Platform License

๐ŸŽฎ Play the Game

Simply open index.html in your browser, or visit the GitHub Pages deployment.

No installation required! This is a fully static web application.

๐ŸŽฏ What You'll Learn

  • How small daily expenses compound over decades
  • The power of compound interest and investing
  • Opportunity cost of spending vs. saving
  • Real-world financial decision-making
  • The impact of lifestyle choices on long-term wealth

๐ŸŽฒ How It Works

  1. Setup: Enter your name, age, and income range
  2. Learn: Quick 3-slide tutorial on financial concepts
  3. Decide: Face real-world spending scenarios
  4. Visualize: See 1, 5, 10, 20, and 30-year projections
  5. Reflect: Review your decisions and learn from them

๐Ÿ“Š Scenarios Included

Daily Spending

  • Dinner Decisions: Premium vs budget meals
  • Coffee Question: Cafรฉ vs home brew
  • Lunch Break: Restaurant vs packed lunch

Transportation

  • Car Purchase: Luxury vs standard vs used
  • Daily Commute: Drive vs transit vs bike

Housing

  • Rent vs Buy: Homeownership analysis
  • Space vs Savings: Apartment size trade-offs

Lifestyle

  • Subscriptions: Full stack vs curated
  • Phone Upgrades: Latest vs extended use

๐Ÿ“ˆ Investing

  • Investment Strategy: Index funds vs stocks vs savings vs checking
  • Risk Tolerance: Stocks vs bonds vs balanced portfolios
  • Real Estate: Rental property vs REITs vs stock index
  • Emergency Fund: Safety vs growth trade-offs

๐Ÿ’ณ Credit & Debt

  • Credit Card Strategy: Pay in full vs carry balance vs debit only
  • Debt vs Investing: Pay off debt or invest?
  • Building Credit: Strategies for credit score improvement

๐ŸŽฏ Career

  • Job Hopping vs Loyalty: When to change jobs for higher pay
  • Career Investment: Certifications vs degrees vs self-study
  • 401(k) Match: Maximizing employer contributions

๐Ÿงฎ Financial Calculations

The game uses real financial formulas:

  • Compound Interest: FV = PV ร— (1 + r)^n
  • Future Value of Annuity: For regular savings
  • Opportunity Cost: What your savings could become if invested (7% annual return)
  • Inflation Adjustment: Real purchasing power over time (3% inflation)
  • Depreciation: Asset value loss (cars: 15%/year)
  • Appreciation: Asset value growth (homes: 3.5%/year)

๐Ÿ› ๏ธ Technology Stack

  • HTML5 - Semantic structure
  • CSS3 - Modern styling with CSS variables
  • Vanilla JavaScript - No frameworks, pure JS
  • Chart.js - Interactive visualizations
  • LocalStorage - Save game progress

๐Ÿ“ Project Structure

spending-learning-game/
โ”œโ”€โ”€ index.html              # Main entry point
โ”œโ”€โ”€ css/
โ”‚   โ”œโ”€โ”€ main.css           # Core styles & variables
โ”‚   โ”œโ”€โ”€ components.css     # UI components
โ”‚   โ””โ”€โ”€ animations.css     # Transitions & effects
โ”œโ”€โ”€ js/
โ”‚   โ”œโ”€โ”€ app.js             # Application entry
โ”‚   โ”œโ”€โ”€ game/
โ”‚   โ”‚   โ”œโ”€โ”€ GameEngine.js  # Core game logic
โ”‚   โ”‚   โ”œโ”€โ”€ Scenario.js    # Scenario management
โ”‚   โ”‚   โ””โ”€โ”€ Calculator.js  # Financial calculations
โ”‚   โ”œโ”€โ”€ ui/
โ”‚   โ”‚   โ”œโ”€โ”€ UIManager.js   # DOM manipulation
โ”‚   โ”‚   โ”œโ”€โ”€ Charts.js      # Chart.js wrapper
โ”‚   โ”‚   โ””โ”€โ”€ Animations.js  # Animation helpers
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ”œโ”€โ”€ scenarios.js   # All game scenarios
โ”‚   โ”‚   โ”œโ”€โ”€ constants.js   # Financial constants
โ”‚   โ”‚   โ””โ”€โ”€ achievements.js # Achievement definitions
โ”‚   โ””โ”€โ”€ utils/
โ”‚       โ”œโ”€โ”€ storage.js     # LocalStorage wrapper
โ”‚       โ””โ”€โ”€ helpers.js     # Utility functions
โ”œโ”€โ”€ DEVELOPMENT_PLAN.md    # Full development plan
โ””โ”€โ”€ README.md              # This file

๐Ÿš€ Local Development

  1. Clone the repository:

    git clone https://github.com/yourusername/spending-learning-game.git
  2. Open index.html in your browser

    • Or use a local server: python -m http.server 8000
  3. Start playing!

๐ŸŒ Deploy to GitHub Pages

This project is ready to deploy as a static site on GitHub Pages:

Option 1: Deploy from Main Branch

  1. Push your code to GitHub
  2. Go to your repository on GitHub
  3. Navigate to Settings โ†’ Pages
  4. Under "Source", select Deploy from a branch
  5. Choose main branch and / (root) folder
  6. Click Save
  7. Your site will be live at https://yourusername.github.io/spending-learning-game/

Option 2: Using GitHub Actions (Automatic Deploys)

  1. Go to Settings โ†’ Pages
  2. Under "Source", select GitHub Actions
  3. GitHub will automatically deploy on every push to main

Notes

  • The site typically takes 1-2 minutes to deploy after changes
  • Check the Actions tab to monitor deployment status
  • No build step required - this is a pure static site!

๐ŸŽฏ Features

MVP (Current)

  • โœ… 19 realistic spending scenarios across 7 categories
  • โœ… Investment decision scenarios (index funds, bonds, HYSA, real estate)
  • โœ… Credit card and debt management scenarios
  • โœ… Career and income scenarios (job changes, 401k match)
  • โœ… Interactive choice system with quality ratings
  • โœ… 30-year financial projections
  • โœ… Visual charts comparing choices
  • โœ… Educational tips for each scenario
  • โœ… Progress saving (LocalStorage)
  • โœ… Wisdom score calculation
  • โœ… Mobile-responsive design

Planned Features

  • Achievement badges system
  • Custom scenario builder
  • Regional cost adjustments
  • Social sharing
  • Life simulation mode
  • Leaderboards

๐Ÿ“ˆ Financial Assumptions

Parameter Value Source
Stock Market Return 7% Historical S&P 500 average
Index Fund Return 7% Low-cost passive investing
Treasury Bonds 4.5% Current US Treasury rates
High-Yield Savings 4.5% Current competitive rates
Regular Savings 0.5% Traditional bank rates
Checking Account 0.1% Near-zero interest
Real Estate Return 8% Includes rental income
Credit Card APR 22% Average credit card rate
Inflation Rate 3% US historical average
Home Appreciation 3.5% US housing market average
Car Depreciation 15% Industry standard

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“ License

This project is open source and available under the MIT License.

๐Ÿ™ Acknowledgments

  • Chart.js for beautiful visualizations
  • The personal finance community for educational content
  • Financial literacy advocates everywhere

Remember: This game is for educational purposes. Real financial decisions should consider your personal circumstances and professional advice.

Made with โค๏ธ for financial literacy

About

Game to learn about spending habits.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published