Studio Game

A Ruby-based text game where players compete in rounds, rolling dice to gain or lose health, and collecting treasures to accumulate points.

Setup

bundle install

Running the Game

ruby studio_game.rb [path/to/players.csv]

The game will prompt you for the number of rounds to play. Type quit or exit to end the game and see final stats.

Player Types

  • Regular Players: Standard health and treasure collection
  • Clumsy Players: Treasures worth half points, optional boost multiplier
  • Berserk Players: After 5 boosts, drains become boosts instead

Testing

# Run all tests
ruby test/studio_game/all_tests.rb

# Run individual test files
ruby test/studio_game/player_test.rb

# Auto-run tests on file changes
bundle exec guard

Linting

bundle exec rubocop

Game Mechanics

  • Dice Rolls: Each round, players roll a die (1-6)
    • 1-2: Drained (-10 health)
    • 3-4: Skipped (no change)
    • 5-6: Boosted (+15 health)
  • Treasures: Players find random treasures each round worth 10-100 points
  • Score: Health + treasure points
  • Output: High scores saved to high_scores.txt when game ends

Project Structure

lib/studio_game/
  ├── player.rb           # Base player class
  ├── berserk_player.rb   # Berserk player subclass
  ├── clumsy_player.rb    # Clumsy player subclass
  ├── game.rb             # Game engine
  └── treasure_trove.rb   # Treasure definitions

License

Educational project from The Pragmatic Studio.