The megalodon game is a simple text-based game where the player controls a megalodon, a prehistoric shark, as it swims through the ocean in search of food and avoiding obstacles.
Controls:
- Use the arrow keys to control the movement of the megalodon (up, down, left, right).
- The megalodon will automatically move forward, but the player can change its direction using the arrow keys.
Objective:
- The objective of the game is to survive as long as possible while collecting as much food (fish) as you can.
- Avoid obstacles such as rocks and other predators to stay alive.
- The game ends when the megalodon collides with an obstacle or predator.
Here is a simple Python program for the megalodon game:
```python
import random
def megalodon_game():
megalodon_position = [0, 0]
food_count = 0
while True:
obstacle = random.choice(["rock", "predator", "fish", "empty"])
print("Move the megalodon with arrow keys:")
print("Up: ^ | Down: v | Left: < | Right: > ")
move = input("Enter your move: ")
if move == "^":
megalodon_position[1] += 1
elif move == "v":
megalodon_position[1] -= 1
elif move == "<":
megalodon_position[0] -= 1
elif move == ">":
megalodon_position[0] += 1
if obstacle == "rock":
print("Oh no, the megalodon hit a rock! Game Over.")
break
elif obstacle == "predator":
print("Watch out, a predator is approaching!")
elif obstacle == "fish":
food_count += 1
print("Yum, the megalodon ate a fish!")
elif obstacle == "empty":
print("Nothing here.")
print(f"Food collected: {food_count}")
megalodon_game()
```
This program simulates the megalodon game by randomly generating obstacles and allowing the player to move the megalodon to avoid them. The player can collect food (fish) to increase their score, but they must also be cautious of obstacles that can end the game.