These questions are all based on the core part of your simulation. In your case, this is the code that deals with the energy of your organisms: the energy they’re born with, how much it costs to live, how much energy they get when they eat, how much energy they need to reproduce, when they reproduce, and when they die. 1) Describe what the code in your section is supposed to do. What are the agents? What do the agents do? What do the agents sense? How do the agents respond? This should describe their behavior - not how the code makes this happen. The agents in my simulation are the Snake which is the predator, rabbit the prey and Grass. In this simulation, the snake which is the predator and it is at the top of the food chain it has the most energy. The snake gets its energy from eating rabbits which in this case are the prey. The snake chases the rabbit and eats it and gains energy. The rabbits only gains energy when it eats grass and when their energy level gets to 21 it collides with other rabbits and reproduce another rabbit. As for the grass, it’s the food source for the rabbits and it reproduce by itself. The rabbit sense danger if it is within 10 steps from the snake. That is when the snake will move towards the rabbit and eats it. Snake is motivated by its energy, if it is “full” (snake energy greater than 5) it will not chase the rabbit. But ifs less than 5 it will need to gain energy it will chase the rabbit and eats it. As for the prey the rabbit when it senses the snake presents it runs away from the snake. The rabbit eat grass to gain energy. When the rabbit wants to reproduce, it collides with another rabbit, and produce a new rabbit. But it needs to have enough energy first. The grass which is the preys food source reproduces randomly. 2) Describe how your code implements the behavior you described in (1). Be sure to include screenshots of the code with enough contexts so that I can understand how it works. Describe all traits and what they represent. This trait is about the Snake. The Snake chases the rabbit when its energy is less than five and when the snake moves around in each step it will lose 0.1 energy and when it reaches zero it will die. So when the snake eats a rabbit it will gain 1 energy each time. The Rabbit runs away from the snake, if the rabbit sees the snake within 10 steps it turns the opposite side and runs away from the snake. If the rabbit sees another rabbit it goes toward the rabbit and if the rabbit’s energy goes to zero it will die. That is caused because the rabbit doesn’t eat or it doesn’t find grass to eat then they will lose their energy, and that will cause death. When rabbit energy become twenty one and when two rabbit collide with each other they give birth and a new rabbit is born. Every time rabbit eat one grass their energy increase to one. Grass plants itself all around the field so the chances are 1/100. 2) How do you know that your code “works”? Give two examples of how you tested it, what should have happened if the code was working, and what actually happened. These tests must involve changes to the simulation. In your case, these could involve changing the starting numbers of organisms or changing the amounts of energy they get from eating, that they need to reproduce, etc. and observing the effects of these on the numbers of each type of organism. You could also remove some key element of the simulation, then predict and observe the results. Be sure to include graphs if appropriate. As you can see from the graph above the grass is represented by the green line, snake by the orange line and rabbits by blue line. The grass is growing rapidly because it is only eaten by the rabbits and it reproduces on its own. The snake is very steady and does not change because it is the predator and it is not being eaten by anyone. The rabbit on the other hand is the prey it is growing but also declining because it is being eaten. The rabbit’s population grow when the rabbits collide and reproduce but it declines because it is being eaten by the predator the snake. In the second graph, I have changed the simulation around a little. I took out the predator and I kept everything else the same. As you can see that lead to the growth of my prey dramatically because the rabbits kept on eating the grass and having enough energy level to collide with each other and reproduce. There was no change to the grass. This also shows that when the predator was involved in the field pray couldn’t grow fast because they were being eaten. 4) Give one example of a hypothesis you can test with your simulation and how you’d test it. My Hypothesis is, that if I added a small house that can shelter the rabbit from the snakes when they sense it coming close to them and hide themselves. Then that will help the rabbit population a lot. It will increase their population because then they wouldn’t be eaten. Also, they would still collide to reproduce so that will definitely increase the population.
© Copyright 2026 Paperzz