Pyhton代写|Fundamentals of Programming Assignment



1 Preamble

In practicals you have implemented and learned about simulations, object-orientation and (soon) how to automate the running of multiple simulations. In this assignment, you will be making use of this knowledge to extend a given simulation to provide more functionality,complexity and allow automation. You will then report on the results generated by the simulation.

2 The Problem

We will be simulating the movement of classes of beings in an environment – each with independent behaviour and interaction rules that are impacted by a change in “mode” for the simulation. Your simulation should allow for a varying set of strategies for movement, based on the mode. Examples would be the game of ‘What’s the time, Mr Woolf?”, PacMan games and (a serious scenario) evacuation responses.

You will be given some sample code, showing a range of approaches to similar problems. For the assignment, you will develop code to model the beings using objects, and to add features to the simulation (e.g. more functionality, statistics, graphics). Your task is to extend the code and then showcase your simulation, varying the input parameters, to show how they impact the overall simulation.

The required extensions are:

  1. Movement: Movement should change based on the mode of the simulation and use a combination of reasoning and randomness for each move. You should provide the option of Moore or Von Neumann neighbourhoods.

Prompts: How do they move towards or away from targets/threats? Are they sometimes faster or slower? Are they always active, or does time have an impact?

  1. Boundaries and Terrain: You should be able to read in the layout of the area from a file, including boundaries to stop the beings going beyond the grid, and limiting movement within the grid (walls). This may include some representation of the height of the terrain.

Prompts: How can beings move between cells taking barriers into account? How do you stop them moving to invalid spaces? How might the beings negotiate height?

  1. Interaction: Your code should recognise when beings are in neighbouring cells and respond accordingly. It could be an interaction when one block away, or require beings to be in the same cell – depending on the scenarios.

Prompts: How do you recognise a target/threat is near? Add rules as to what happens when different combinations of beings meet.

  1. Non-moving targets: You should model special cells/zones and their affect on the beings. Beyond terrain, you will need a way to indicate that a cell has a “landmark” for them to interact with e.g. an emergency exit.

Prompts: How do you recognise the location of the non-moving targets/threats? Can your beings “see”, or do you do a scan of the area and base movement on that?

  1. Visualisation/Results: Enhance the display for the simulation to vary the representation of beings and the area they move in. You should display a log of events and/or statistics for the simulation and also be able to save the simulation state as a plot image or a csv file.

Prompts: How will you differentiate the beings? Are they the same throughout the simulation? You may choose an “image” representation, to improve on using coloured dots.

Note: Your program should allow command line arguments to control the parameters of the experiment/simulation.

Your code should include comments to explain what each section does and how. It is useful to keep track of your changes in the comments at the top of the program. Feel free to re-use the code and approaches from the lectures and practicals. However, remember to cite and  self-cite your sources. If you submit work that you have already submitted for a previous assessment (in this unit or any other) you have to specifically state this.

Beyond the working program, you will submit a documents: the Simulation Project Report.

There will be bonus marks for additional functionality and the use of more advanced programming techniques (e.g. interactivity, high quality visualisation, 3D space, parameter sweep etc.) but only if they’re sensible and done well. Make sure to discuss the additional work in your Report, this will be easy if you make notes and keep old (incremental) versions of your code.