Professional Documents
Culture Documents
20 May 2023
I. Overview:
a. Timestep: The command line arguments for the number of people, vampires, and timesteps were
utilised, as well as certain absences were accepted.
b. Objects: Create classes for humans, vampires and human’s items (including garlic, water and food).
c. Movements: Allows humans and vampires to run at random, where humans and vampires move 4
steps and 8 steps respectively. No move of human items.
d. Interactions: There are 4 interactions including human to human, human to vampire, vampire to
vampire, person to items.
e. Visualisation of results: Scatter chart of statistics of humans and vampires appeared.
f. Parameter Sweeps: Can run but the values have trouble in the output of csv file.
II. Guide:
>> Start the VMWare.
>> Go into the Assignemt 2 directory.
>> Open the terminal and enter the command “python 3 Mainfile.py” and it automatically run llike
picture below. For each timestep, it will appear the new plot.
III. Discussion:
a. Timesteps:
>> Utilising command line arguments, first import sys
>> Users should be given 5 alternatives. The programme will generate the proper result based on
the quantity of numbers and letters entered.
b. Objects:
>> Make a class named Main since I'll be using super() for Human() and Vampire(). In the __init__
section, these four major components are constructed - pos, health, mapSize, and age. There are
the four basic characteristics for humans, and not applying for vampire.
>> For Items, it applies Big class named Item and three tiny classes for Garlic, Food, and Water.
>> To set up the location and other properties of each piece, I utilise a function. I don't make a
condition for the starting location of everything to be different because we may meet a vampire at
random on the first day in the forest.
>> For each element (Human, Vampire, Garlic, Food, Water), I make a list. When anything dies or
disappears, I can easily add or delete elements from a list. This is when I update the initial list of
everything.
>> In the Class1.py file, I write a function for humans and vampires to move, with the total move for
each class (Humans and Vampires) being random in the range mentioned in the question. Then I apply it to
every class move function. If something goes off the map, it will be randomly repositioned on the map.
d. Interaction:
Human vs Vampire:
>> I will loop over the Human_list two times, once for i and once for j. I then use the if function in the
image to check the location. This will subtract two human places, and if it fulfils the criteria, it implies
they are in the eight squares next to each other. I use a random number generator to determine the
probability of each scenario. If it is less than 0.6, they will assist one another. If it is greater than 0.6,
one will gain 20 health while the other will lose 20.
Human vs Vampire:
>> I will check the Human_list for i and the Vampire_list for j. I then use the if function to check the
condition. If the prerequisites are met, the options will be chosen at random.
Vampire vs vampire:
>> I am going to go through the Vampire_list twice, once for i and once for j. I then use the if
function in the image to check the location. This will remove two human places, and if the
requirements are met, it indicates they are in the eight squares next to each other. When two
vampires interact with one other, each loses 20 health.