virtual-pet

command module
v0.0.0-...-052edd9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2025 License: MIT Imports: 6 Imported by: 0

README

Virtual Pet Terminal App

A simple terminal-based virtual pet game built with Go, featuring real-time pet interactions and ASCII art.

Features

Gameplay

  • Two pet types: cat or bunny
  • Real-time stats: hunger, happiness, and energy bars
  • Interactive commands: feed, play, sleep, and pet
  • Automatic sleep system when energy is low
  • Arrow key navigation for pet selection
  • Colourful UI with heart-themed border

Installation

Prerequisites
  • Go 1.21 or higher
  • A terminal with Unicode support
Quick Start
# Clone the repository
git clone https://github.com/emmyme/virtual-pet.git
cd virtual-pet

# Install dependencies
go mod tidy

# Run the application
go run main.go

How to Play

Getting Started
  1. Enter your pet's name and press Enter
  2. Use arrow keys to select between Cat or Bunny, then press Enter
  3. Use the following commands to care for your pet:

Pet Name Choose Pet

Commands
  • f - Feed your pet (restores hunger)
  • p - Play with your pet (increases happiness)
  • s - Put your pet to sleep (restores energy)
  • t - Pet your pet (increases happiness)
  • q or Ctrl+C - Quit the game
Pet Stats
  • Hunger: Decreases over time, feed to restore
  • Happiness: Decreases over time, play or pet to increase
  • Energy: Decreases over time, sleep to restore
  • Mood: Automatically changes based on stats (happy, unhappy, asleep)
Sleep System
  • Pets automatically fall asleep when energy reaches 0
  • After 5 minutes of sleep, pets wake up with full energy

Project Structure

virtual-pet/
├── main.go          # Main application with Bubble Tea UI
├── pet/
│   ├── pet.go       # Pet struct and core logic
│   ├── cat.go       # Cat ASCII art
│   ├── bunny.go     # Bunny ASCII art
│   └── stats.go     # Progress bar rendering
├── go.mod           # Go module definition
└── README.md        # This file

Technical Details

Built With
  • Go: Core programming language
  • Bubble Tea: Terminal UI framework
  • Lipgloss: Terminal styling library
Dependencies

This project uses the following open-source libraries:

  • Bubble Tea by Charm - A framework for building terminal user interfaces
  • Lipgloss by Charm - Style definitions for nice terminal layouts and colors
Key Features
  • Concurrent programming with goroutines and channels
  • Real-time updates every 5 seconds
  • Cross-platform compatibility

Troubleshooting

Colors not displaying correctly:

  • Ensure your terminal supports 256-color mode
  • Try using a modern terminal emulator

Unicode characters showing as boxes:

  • Update your terminal font to support Unicode

Application not responding:

  • Make sure your terminal window is at least 80x24 characters
  • Check that you're using Go 1.21 or higher

License

This project is licensed under the MIT License.


Have fun!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL