top of page
Search

šŸ“ Tamagotchi in Streamlit

  • Writer: Alvaro Mejia
    Alvaro Mejia
  • May 30, 2025
  • 2 min read

🐾 Tamagotchi Web App – Practicing OOP and Interactive UI in Python

This project is a web-based Tamagotchi gameĀ I built using Python and Streamlit. The goal was to create a fun and interactive way to apply concepts of Object-Oriented Programming (OOP), build an event-driven UI, and manage stateful logicĀ within a lightweight web framework.


šŸŽÆ Project Goals

  • Practice OOP designĀ by creating a class-based virtual pet

  • Implement a modular and scalable architectureĀ using separate files for logic, config, and visuals

  • Use StreamlitĀ to create an interactive, browser-based interface

  • Learn to manage user state (st.session_state)Ā to simulate memory and game persistence

  • Deploy a project that is both technicalĀ and accessible


🧠 What I Built

  • A TamagotchiĀ class with attributes like hunger, boredom, tiredness, and dirtiness

  • Methods like .eat(), .play(), .sleeping(), and .bath()Ā that affect pet status

  • A death()Ā method that ends the game if any parameter reaches 10

  • A rock-paper-scissors mini-gameĀ to reduce boredom, fully playable with buttons

  • Dynamic stats visualized with Plotly charts

  • A message screenĀ that shows real-time feedback and actions

  • Support for game-over handlingĀ and restarting the game

  • A separate Instructions pageĀ built with Streamlit's multi-page support


šŸ› ļø Tools & Tech

  • Python 3.10

  • StreamlitĀ for web UI

  • Plotly ExpressĀ for interactive visualizations

  • PandasĀ for handling time-series-like game history

  • HTML + MarkdownĀ for layout styling


šŸ“ø Screenshots







šŸ” What I Learned

This project helped me reinforce:

  • OOP design patternsĀ (attributes, encapsulation, methods)

  • How to design a modular Python projectĀ with clean structure

  • Managing UI state in StreamlitĀ without a backend

  • Interactive game logicĀ with immediate feedback to the user

  • Basic frontend experienceĀ (icons, layout, user flow)


🌐 Why It Matters

Although Tamagotchi isn't a Data Science project directly, it demonstrates my ability to:

  • Build maintainable, interactive Python applications

  • Think in terms of user experienceĀ and workflow

  • Apply programming principles in a creative and engaging way

  • Work with Streamlit, a tool I also use for Data Science dashboards and apps


šŸš€ Live Demo & Code

Ā 
Ā 
Ā 

Comments


Alvaro Mejia

Data Scientist | Python, SQL | Machine Learning & Big Data Enthusiast

  • alt.text.label.LinkedIn
  • GitHub
  • Youtube

©2024 by Alvaro Mejia

bottom of page