C++ Simple Game.
The Predator‐Prey game is a simple board game where a set of predators and preys move freely across the board. The goal of the game is that predators eat all the preys available.
The following is a description of the game rules:
1) Predators and preys move on a 2‐dimensional closed grid of size 12x12 cells. Predators and preys are not allowed to move outside the grid.
2)There are two kinds of predators: snakes, and scorpions. On the other hand, there are three kinds of preys: bugs, ants, and worms.
3) Scorpions eat bugs and ants but not worms, while snakes eat worms and bugs but not ants.
4) The game consists of successive turns. During one turn, each of the creatures moves one step into one of the adjacent cells (up, down, left, or right). If there is no empty adjacent cell, the creature stays in its place during this turn.
5)Predators’ movements are controlled by the user, while preys move randomly.
6) Each turn starts by prompting the user to move each of the predators, then the preys take their turn and each of them moves one random step.
7) A predator breeds if it survives for 24 moves, while a prey breeds if it survives for 12 turns. The new offspring is of the same type, and is added into one of the adjacent cells (top, bottom, left, or right). Naturally, if there is no empty adjacent cell no breeding takes place.
8) A predator eats a prey if it is in one of the predator’s adjacent cells (top, bottom, left, or right) and is of the proper type.
9) A predator starves and dies if it moves 12 turns without eating a prey.
the program should display the game board along with the current creatures. Use the characters ‘S’ for snakes, ‘X’ for scorpions, ‘B’ for bugs, ‘A’ for ants, and ‘W’ for worms.
Initialize your game board with 1 snake, 1 scorpion, 12 ants, 12 worms, and 12 bugs. Place them in random locations.
Re: C++ Simple Game.
|All times are GMT +5.5. The time now is 01:03.|