首页 » cs代写 » Python代写 | CSSE1001/CSSE7030 Assignment 2

Python代写 | CSSE1001/CSSE7030 Assignment 2

本次澳洲CS代写主要是使用Python实现一个模拟的生存游戏
End of Dayz

Assignment 2 Semester 1, 2021 CSSE1001/CSSE7030

Due date: 20:00 (AEST), 23 April, 2021

In this assignment, you will implement a text-based zombie survival game, End of DayZ. In End of DayZ, the player has to successfully evade zombies to reach the hospital and win the game.

This assignment is divided into three tasks of increasing difficulty. Each task builds on the previous task. It is recommended that you implement one task at a time. After you finish implementing a task ensure that you thoroughly test your implementation before moving onto the next task.

The game is played within a square grid. The contents of the grid (i.e. zombies, the player, the hospital, etc.) are loaded from a map file. Map files are text files which store a grid, map files are explained in Section 4.

2 Getting Started

To start, download a2.zip from Blackboard and extract the contents. The a2.zip archive contains all the necessary files to start this assignment.

Within the a2.zip archive you will find the following:

  • a2.py: You are required to implement your assignment solution entirely within this file. This is the only

    file that you will submit for this assignment, do not make changes to any other files.

  • a2_support.py: This file contains code that you must use to assist you in implementing your assignment. You are expected to read the code in this file and decide when it is appropriate to use it within your assignment.
  • maps: A folder containing maps as text files that the user can load and play. 3 Terminology

    In the context of this assignment:

  • The grid is an n by n collection of squares.
  • A position is the location of a square in the grid. A position is represented by (row, column) starting from the top-left position of the grid, (0, 0).
  • An entity is a general term for anything that can be found in the grid. An entity occupies exactly one square of the grid.
  • The player is an entity whose movement is controlled by the user playing the game. Each game has exactly one player.
  • A step is an event that is triggered by the user moving the player. A step event can trigger other entities in the grid to react.
  • The hospital is an entity that does not move but is at the position that the player is trying to reach. Each game has exactly one hospital.
  • A zombie is an entity that the player has to avoid. A game can have multiple zombie entities. Zombie entities may move during every step event.

1

4 Map Encoding

A map is encoded as a text file. The map file specifies the position of every entity in the grid. Each line of the file represents a row of the grid. Each square in the row is represented by a single character. Space characters represent a tile that does not contain an entity and non-space characters represent the type of entity in that position. Table 1 shows which character is used to encode each of the entity subclasses.

Character Entity

P Player H Hospital Z Zombie

Table 1: Characters used to encode each Entity subclass

Figure 1 is an example map encoding. Spaces in this map encoding are made explicit in this task sheet by ␣ , however they should just appear as a space in the actual map files. The player is in the position (2, 0). The hospital is located in the position (1, 2). The zombie is located in the position (3, 3).

                                            ␣␣P␣
                                            ␣␣␣␣
                                            ␣H␣␣
                                            ␣␣␣Z

Figure 1: Map encoding of a 4 by 4 grid that contains a player, hospital and one zombie.

5 Gameplay

A game is started by prompting the user for a map file. The prompt should say ‘Map:␣’ and wait for the user to enter the name of a file that contains a map encoding. The application requires the user to enter the relative path of the map file (e.g. maps/basic.txt). You are not expected to handle the situation where the file contains an invalid map encoding, or where the user enters an invalid path to a map file.

Once the map encoding is loaded, the grid should be printed. The grid should be surrounded by ‘#’ characters on the top, bottom and sides. The ‘#’ character represents the border of a grid. An example of a 4 by 4 grid is shown below.

###### #P# ## #H# # Z# ######

Figure 2: Grid representing the map from Figure 1 displayed as it should be printed to the user.
The game loop includes the following steps, which are executed repeatedly until a step causes the game to

end.

1. Prompt the user for an action. The prompt should say “Enter your next action:␣”.

2. Processing the action entered by the user:1

  • If the entered action is a direction, and moving in the given direction would not move the player out

    of bounds, move the player in that direction.

  • If the entered direction would move the player out of bounds, the player remains in the same location.
  • If the entered action is invalid, ignore the input.
  • Regardless of what the player enters for the action, initiate the step event.

    3. After the step event:
    • If the game is over and the player has won, print “You win!”.

    • If the game is over and the player has lost, print “You lose!”.
    • If the game is not over, print the grid and repeat the game loop from the first step.


程序辅导定制C/C++/JAVA/安卓/PYTHON/留学生/PHP/APP开发/MATLAB


本网站支持 Alipay WeChatPay PayPal等支付方式

E-mail: vipdue@outlook.com  微信号:vipnxx


如果您使用手机请先保存二维码,微信识别。如果用电脑,直接掏出手机果断扫描。

blank