Python代写:CS4512 Treasure Hunt

代写寻宝猎人游戏,随机生产宝藏地图,控制猎人探险。

Requirement

AQA Treasure Hunt is a game where a player moves through an eight by eight grid of squares searching for hidden treasure. In the grid are ten treasure chests and five bandits.

The player starts in the bottom left corner of the grid. The player then moves around the grid trying to find the treasure chests and avoid to the bandits. For each move, the player chooses how many squares they want to move up or down and how many squares they want to move left or right.

If the player lands on a square that contains a treasure chest then they collect 10 gold coins.

If the player lands on a square that contains a bandit then the bandit steals all the coins that the player has collected so far.

The player cannot move beyond the limits of the grid.

Each treasure chest can be visited three times. After the treasure chest has been visited three times, it is replaced by a bandit in the same square.

After each move, the grid showing the new position of the player is displayed, along with the current number of gold coins collected, the number of bandits and treasure chests in the grid.

The player wins the game if they have collected 100 gold coins.

The player loses the game if all the treasure chests have been changed into bandits and the player has not collected 100 gold coins.

Tasks

  1. Develop the part of the program that displays a menu that allows the player to play the game or to quit the program.

  2. Develop the part of the program in such a way that when the play game option is selected from the menu, it creates positions for ten treasure chests and five bandits within an eight by eight grid. These positions should be random squares within the grid.
    Each treasure chest and each bandit must be in its own square. A treasure chest or bandit cannot be placed in the start position for the player.

  3. Develop the part of the program that displays the grid and start position of the player. The positions of the treasure chests and bandits should not be shown to the player.
    NOTE: For testing purposes the positions of the treasure chests and bandits can be shown, but in the finished game it is expected that they will not be seen.
  4. Develop the part of the program that enables the player to enter their move. The player should be able to enter the number of squares they want to move up or down and how many squares they want to move left or right. The player should not be allowed to make a move that would place them outside the grid. Figure 1 shows some examples of legal moves. After a legal move has been made, one should be added to the total number of moves made by the player.
  5. Develop the part of the program that checks into which square the player has moved.
    • If the player moves into a square containing a treasure chest then 10 coins should be added to the player’s coin collection.
    • If the player moves into a square containing a bandit then the player’s coin collection should be set to zero.
    • If the player moves into a square containing a treasure chest that has already been visited twice then 10 coins are added to the player’s coin collection and the treasure chest is replaced by a bandit. The next time the square is visited, it contains a bandit. The number of bandits is increased by one and the number of treasure chests is decreased by one.
  6. Develop the part of the program that displays the grid showing the new position of the player, the number of gold coins collected and the number of bandits and treasure chests currently in the grid.
  7. Develop the part of the program that checks whether the player has won or lost the game.
    • The player has won the game if they collect 100 gold coins.
    • The player has lost the game if there are no treasure chests left in the grid and the number of gold coins collected is less than 100.
      When the player finishes the game, an appropriate message should be displayed telling them whether they have won or lost and the number of moves made in the game. The player should then be taken back to the menu developed in Task 1.
  8. Extend the program so that the player can select the size of the grid and the starting number of treasure chests and bandits before playing the game.
    • The player selects from a list of game layouts described in the form of a grid: for example, 10 x 10 or 12 x 12.
    • The player enters the number of treasure chests and bandits.