Sunflower vs Zombies Game Simulation
Explore object-oriented programming in Ruby by creating a text-based simulation of the Sunflower vs Zombies game. Learn to design classes and methods with randomness and game logic to simulate interactions, health, and movement, while managing dynamic output and game flow.
Problem
This is a simplified simulation of the famous “Plants vs. Zombies” game. A sunflower is on the left of the field, and zombies come towards the sunflower (to eat it) one by one from the right side of the field. The purpose of the game is to have the sunflower survive one wave of attack (
For each step a zombie makes, there will be an exchange of fire (the sunflower shoots seeds at the zombie; the zombie throws stones at the sunflower), and both the sunflower and the zombie receive a certain degree of damage to their health. If the attacking zombie’s health goes down to 0%, the zombie dies and then another one comes until no more zombies remain. If the sunflower’s health reaches 0%, the ...