EssayGhost Assignment代写,Essay代写,网课代修,Quiz代考

EssayGhost-Essay代写,作业代写,网课代修代上,cs代写代考

一站式网课代修,论文代写

高质量的Assignment代写、Paper代写、Report代写服务

EG1hao
网课代修代上,cs代写代考
Python代写
您的位置: 主页 > 编程案例 > Python代写 >
代写Python:program代写 ecosystem代写 simulate an African ecosystem代写 - Python代写
发布时间:2021-07-25 21:45:41浏览次数:
COMP 204 – Assignment #4Python program代写 Submit one Python program on MyCourses, which should contain all your functions. The file should be called ecosystemDue date: Wednesday, November 21, 23:59Submit one Python program on MyCourses, which should contain all your functions. The file should be calledpyYou may submit your program more than once, in which case the latest submission will be graded.Write your name and student ID at the top of theprogramFor each question, complete the relevant functions and methods. Do not change the names of the class, functions, methods, or arguments. You can create additional functions/methods ifFor each question, your function will be automatically tested on a variety of test cases, which will account for 75% of theFor each question, 25%of the mark will be assigned by the TA based on (i) Re-­‐use of functions as appropriate; (ii) appropriate naming of variables; (iii) commenting of your program; (iv) simplicity of your program (simpler = better). Important notes:This assignment focuses on function re-­‐use andobject-­‐oriented programmi You will be writing several functions and using some classes. Some of those functions should call other functions in order to re-­‐use the code already written. Make sure to re-­‐use your functions as much as needed!Python program代写The question statements include hints as to how many lines of code are needed to answer each question. These are merely suggestions, and you will not be penalized for using more/fewer lines. If you find yourself coding much more lines than what it suggested, it may be a hint that you are overcomplicating theSuper important: For your submission, include the original non-­‐random my_random_choice( )BackgroundIn this assignment, you will write a Python program that simulates the evolution of a simple ecosystem. In doing so, you will also reinforce your understanding of object-­‐oriented programming.Let us start by describing the simulation we are aiming to program. Our goal is simulate an African ecosystem. The ecosystem consists of an L x L grid, where each cell represents a 1 km by 1 km square. Each cell is either occupied by a single animal, or is empty. We will consider only two species: zebras and lions. The Figure below illustrates a possible state of the ecosystem (with L = 10).Python program代写The ecosystem evolves over time. We will assume that we model its evolution in time steps of one month. This means that the ecosystem will be in one state at month 0, then in another state at month  1, then another in in month 2, etc. The parameters of the simulation (described below) are not very realistic; they’ve been chosen to make the problem interesting and not too hard.Each month, the following events take place, in that order:Python program代写1)Aging: Make all animals grow older by onemonth2)Hunger: For all animals, increase by one month the time since the lastmeal3)Death of old animals: Remove ALL animals which have exceeded their life span from the simulation:If a zebra makes it to 7 months, it dies of old age and is removed from thesimulationIf a lion makes it to 18 months, it dies of old age and is removed from thesimulation4)Death of malnourished animals: Remove ALL animals which havestarved:If a lion has not eaten for 6 months, it dies of hunger and is removed from thesimulationPython program代写Zebras never die of hunger because there’s always grass for them toeat5)Moves: Each animal that is still alive tries to move randomly to one of the (up to) 8 cells that surround it horizontally, vertically, or diagonally. If the animal is near the edge/corner or the grid, it is only allowed to move to a valid cell (within the grid). When an animal tries to move to a cell that is already occupied by another animal,three things canhappen:If the animal that is moving is a lion and it moves to a cell that contains a zebra, it eats the zebra and replaces it in that cell. The zebras is then removed from theIf the animal that is moving is a zebra and it moves to a cell that contains a lion, it is eaten by the lion and is removed from theIf a lion tries to move to a cell occupied by another lion, or if a zebra tries to move to a cell occupied by another zebra, the move is forbidden so the animal remains where it was. The animal does not try to find another cell to move Python program代写6)Reproduction: If an animal reaches the time of reproduction (see below), a new animal of the same species is born and is placed in one of the empty neighboring cells from the parent. If there is no empty neighboring cell, the baby dies (i.e. it never makes it to thesimulation).Lions have babies at age exactly 7 and 14Zebras have babies at age exactly 3 and 6Note: We are assuming here that each individual animal is capable of having a baby by itself (like bacteria); there is no need for a second animal of the same species to be in the vicinity.Important notes:The 6 steps above will need to be executed in successive stages where each stage has an effect on all animals (e.g. have a piece of code to age all animals by one month, then a piece of code to remove all animals which have starved, etc…). DO NOTmake one animal age, check if they died of hunger/old age, move, etc… and move on to the next animal; this will give you the incorrect answers.Python program代写For each of the 6 steps above, you should proceed fromleft-­‐to-­‐right and top-­‐to-­‐bottom in the grid. So the first cell to be considered is the cell (0,0), then the cell (0,1), then (0,2)… If you do it in a different order, you will different results from those we expect.Python program代写Assignment Python program代写Download ecosystem_simulator.py from MyCourses.The file contains a class called “Animal” and several functions that you will need to complete, and the my_test( ) function, which will be used to run your simulation. The grid of animals is represented as a two-­‐dimensional list, each empty cells contain the empty object None, and other cells contain an object of the class Animal. The program also contains the initialize_grid(size) function (which has already been written out for you) that you will use to initialize your grid and start your simulation.Download expected_output.txt from MyCourses.Python program代写This file contains examples of correct output for each question. This output is produced by the functionmy_test( ), provided in the code.Important notes:To make it possible for our TAs to import your code within their gradingsystem:All your code should either be in a function, a class, or a method, or it should be within the if block at theend

所有的编程代写范围:essayghost为美国、加拿大、英国、澳洲的留学生提供C语言代写、代写C语言、C语言代做、代做C语言、数据库代写、代写数据库、数据库代做、代做数据库、Web作业代写、代写Web作业、Web作业代做、代做Web作业、Java代写、代写Java、Java代做、代做Java、Python代写、代写Python、Python代做、代做Python、C/C++代写、代写C/C++、C/C++代做、代做C/C++、数据结构代写、代写数据结构、数据结构代做、代做数据结构等留学生编程作业代写服务。