This is a project. All specicfactions are on the pdf which also include documentation and report. Please read the pdf carefully
You can use the code as a starting point, or simply to help understand the problem. Either option's code will need to be reworked (refactored) when implementing Objects and the other functionality outlined in the Assignment specification. Feel free to write new code from scratch
This is the start code:
#
# Author :
# ID :
#
# pasciroExample.py - Basic simulation of PaSciRo lifeforms for assignment, S2 2020.
#
# Revisions:
#
# 22/9/2019 – Base version for assignment
#
import random
import matplotlib.pyplot as plt
import numpy as np
import time
def stepChange(lifeform):
if lifeform[2] == 1:
lifeform[0] = lifeform[0] + random.randint(-3, 3)
lifeform[1] = lifeform[1] + random.randint(-3, 3)
XMAX = 200
YMAX = 100
POP = 20
STEPS = 10
def main():
lifeforms = np.zeros((POP, 3), dtype=int)
for i in range(POP):
randX = random.randint(0,XMAX)
randY = random.randint(0,YMAX)
randTYPE = random.randint(0,2)
lifeforms[i,0] = randX
lifeforms[i,1] = randY
lifeforms[i,2] = randTYPE
print(lifeforms[i])
for i in range(STEPS):
print("\n ### TIMESTEP ",i, "###")
xvalues = []
yvalues = []
colours = []
for l in lifeforms:
stepChange(l)
#print(l)
xvalues.append(l[0])
yvalues.append(l[1])
colours.append(l[2])
plt.scatter(xvalues, yvalues, c=colours) # Note plt origin is bottom left
plt.xlim(0,XMAX)
plt.ylim(0,YMAX)
plt.show()
time.sleep(2)
if __name__ == "__main__":
main()
Assignment Option 1: PaSciRo Simulation 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 life on the planet PaSciRo, which is inhabited by three lifeforms of interest, each with their own behaviour and interaction rules. You will be given some sample code, simulating the population using arrays. For the assignment, you will convert the code to model the planet creatures using objects, and to add features to the simulation (e.g. more functionality, statistics, graphics, parameter sweeps). Your task is to extend the code and then conduct an experiment, varying the input parameters, to see how they impact the overall simulation. The required extensions are: 1. Object Behaviour: Extend to have the lifeforms represented as objects. Each type of object will have its own behaviour(s). This should be implemented via the object’s methods and attributes. 2. Visualisation: Enhance the output to vary the representation of animals by their type, and possibly direction of movement. You may choose an “image” representation, to improve on using coloured dots. You should also be able to save the simulation state as an image or a csv file. 3. Movement: Movement should vary by lifeform and needs to be constrained to the space. The Base code movement is highly unrealistic. Prompts: Consider how they might move, e.g. Do the different lifeforms move in different ways? Do they keep going in the same direction unless they have a “change direction” event at some level of probability. 4. Collisions: The animals are moving in a two dimensional space. Your code should recognise when collisions occur and respond accordingly. Prompts: How do you recognise a collision? Add rules as to what happens when different combinations of lifeforms collide. Your simulation should also include mechanisms for reproduction and death within the populations – probably related to certain collisions. 5. Boundaries: Enhance the rectangular grid with boundaries to restrict movement. 2 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 two documents: the Simulation Project Documentation and a Simulation Project Report on your experiment. 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 Documentation and Report, this will be easy if you make notes and keep old (incremental) versions of yourcode. 3 Submission Submit electronically via Blackboard. Make sure to submit early. You can submit multiple times – we will only mark the last attempt. Take care not to submit your last version late though. Read the submission instructions very carefully. You should submit a single file, which should be zipped (.zip). Check that you can decompress it on lab machines. These are also the computers that your work will be tested on, so make sure that your work runs there. The file must be named FOP_Assignment_ where the is replaced by your student id. There should be no spaces in the file name; use underscores as shown. The file must contain the following: Your code. This means all files needed to run your program. That includes input files used as part of the assignment if that is required to run your program. README file including short descriptions of all files and dependencies, and information on how to run the program. User Guide and Report for your code, as described in Section 3.1. A signed and dated cover sheet. These are available on Blackboard. You can sign a hard copy and scan it in or you can fill in a soft copy and digitally sign it. Make sure that your zip file contains what is required. Anything not included in your submission will not be marked, even if you attempt to provide it later. It is your responsibility to make sure that your submission is complete and correct. 3.1 Documentation and Report You need to submit your Documentation and Report in docx, pdf or Jupyter Notebook format. The Simulation Project Documentation is where you describe how you approached the implementation of the simulation, and explain to users how to run the program. The Simulation Project Report takes the application(s) you have developed, and uses them to explore the simulation outputs. This exploration would include changing parameters, simulation time and perhaps comparing outcomes if you switch various features on/off. Remember : Think before you code! 3 Your Documentation will be minimum 2-4 pages and should include the following: An overview of your program's purpose and features. A guide on how to use your simulation and parameter sweep code, if applicable. A discussion of your code, explaining how it works, any additional features and how you implemented them. The Report will follow the structure of a standard academic report or paper. It should be at least 4-6 pages long. Required sections are: Abstract: Explain the purpose of the report and state the parameters you have investigated, and the outcomes/recommendations. Background: Discuss the purpose of the simulation and your choice of parameters. Methodology: Describe how you have chosen to set up and compare the simulations, and why. Include commands, input files, outputs – anything needed to reproduce your results. Results: Present the results of your simulations. Conclusion and Future Work: Give conclusions and what further investigations could follow. 3.2 Marking Marks will be awarded to your submission as follows: [30 marks] Code Features. Based on your implementation and documentation [30 marks] Demonstration. Students will demonstrate their code and respond to questions from the markers. [10 marks] Documentation. As described in section 3.1. [30 marks] Report. As described in section 3.1, with the majority of marks for the methodology and results sections. Marks will be deducted for not following specifications outlined in this document, which includes incorrect submission format and content. If the cover sheet isn’t provided with your submission, your submission will not be marked and you will be awarded zero (0) marks. If you forget to submit the cover sheet you will be allowed to submit it separately to the unit coordinator (by e-mail or in person) but will lose 5 marks.
Do you have a similar assignment and would want someone to complete it for you? Click on the ORDER NOW option to get instant services at essayloop.com.