# A-level Computing/AQA/Paper 1/Skeleton program/2017

This is for the new Computer Science Specification. Keep in mind that there is another Comp1 exam for Computing (for retakes?) though this specific page is for the new course.
This is where suggestions can be made about what some of the questions might be and how we can solve them.
Please be respectful and do not vandalise or tamper with the page, as this would affect students' preparation for their exams!

## Add a way for a disease to kill rabbits in warrens

C# Solution:
Not Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:
This code also allows for the disease spreading, and with each turn the disease will spread and there is a higher chance of rabbits dying.
VB.NET Solution (using object-oriented programming)
Answer :
Answer:
This code allows for the disease to spread between warrens and animals. It has no symptoms, but increases the ProbabilityOfDeathOtherCauses variable by 10%. This code was VERY QUICKLY made by Shaun Aziz and almost definitely contains lots of errors. Feel free to fix them and add your name below(preferably along with what you fixed): Nobody has yet to fix anything. :(

## Natural disaster (e.g. storm or fire) affects number of animals in a given radius

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
This method needs to be called from somewhere. I added an option in the simulation menu to execute the storm code. If you call the storm via the menu like I did, then other factors such as the rabbits dying from natural causes and being eaten still happen for the warrens affected.
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Check if input coordinates are valid

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Display number of rabbits born that period (This question is unlikely as it is already coded into Visual Basic and Java)

(This can be done if option 1 selected when advancing time period)
C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Constraints for number of animals placed

(This can be done if option 2 selected)
C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## When inspecting a fox, if there is no fox present in the given coordinates, display error message and loop coordinate input

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
Python Alternative Solution:
Answer :
Answer:
Solution:
VB.NET Solution
VB.NET Solution
Answer :
Answer:

## Add a new animal (Eagles/Coyotes?) that can hunt foxes

C# Solution:
Answer, includes an eagle with an adapted fox class, eagle has 25% chance of consuming closest fox, has the same fox attributes and working food/death system (it is quick and dirty, many improvements should be made):
Answer:
Delphi/Pascal Solution
Answer is incomplete at the moment. Will finish it in 2 days (Some Functionality added see below the first answer):
Answer:
Java Solution
Answer :
Answer:
I came up with this as a quick test. I'm sure this could be done in a more efficient way but this does work. More instructions near the bottom of this!
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Foxes have a random chance to move towards the closest warren each time period

C# Solution:
Includes a new procedure and appended AdvanceTimePeriod procedure, only problem being there is a chance foxes could be moved twice, a boolean value in the fox class which signifies if they have been moved that period or not would solve this. Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## A fox moves in a random direction if they haven't eaten enough food that turn

(Could be extended to move towards nearest warren as in previous question)
C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
#IN THE ADVANCEPERIOD if not self.__Landscape[x][y].Fox is None:
* IN FOX CLASS
def __init__(self, Variability):
VB.NET Solution
Answer :
Answer:
Answer 2:
Answer:

## If a fox moves, the food needed for the next time period should increase relative to how far it has travelled

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Animals need water as well as food in order to survive

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## If a fox eats more food than it needs, its reproduction rate increases

(Could be extended to cause a lower chance of movement/range of movement)
C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Add geographical areas of the grid where only certain animals can survive (i.e. Mountainous regions where rabbits cannot create warrens and where it is harder for foxes to survive, but eagles can flourish, etc.)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
class Location:
* add relevant variables like MountainCount and InitialMountainCount into the main part of program and simulation.
class Simulation:
def Main:
* Class mountains gives mountain size for later addition where inspection will be avadiable.
class Mountain:
* also need to edit the draw landscape function to add an M for when a mountain is present
def __DrawLandscape(self):
* lastly allow mountains to be added for default and custom settings.
def __CreateLandscapeAndAnimals(self, InitialWarrenCount, InitialFoxCount, FixedInitialLocations,InitialMountainCount):
def __CreateNewMountain(self):
* To stop warrens appearing with mountains just add this to the CreateNewWarren
Charles Naden-Lamb Fallibroome Academy
VB.NET Solution
Answer :
Answer:

## If already added another animal (e.g. Eagle), make it so that they prefer hunting around the added geographical areas. (Extension of above).

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## For reproduction to occur, there must be 2 or more of the species in adjacent cells to reproduce

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## (Extension) Make it so that all animals are able to create their own respective homes (eg Dens for foxes or nests for eagles)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Add a food source for rabbits (such as grass)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## (Extension) Meteor that has a low random chance of spawning and destroys everything inside a warren and foxes (Singular Class)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Increase the probability of death for foxes in particular regions of the board

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
VB.NET Solution
Answer :
Answer:

## Reign Of The Giant (Too Complicated, Unlikely)

This part of the code is inspired by the computer survival game 'Don't Starve'. It features many improvements and additions to the code, some which have already been completed above. But the main feature is transforming the simulation into a game, by allowing the user to move around the landscape and interact with the Warren's, Foxes and any other Entities you may have implemented.
The list of challenges are as follows:
* Insert the player into a random location, that is unoccupied. Display the first letter of the player name on the landscape.
* Move around the landscape. You can move N,E,S,W, for each time period. Or you can stay put.
* Add health and hunger attributes to the player. You can display these attributes via a menu option. The hunger attribute should decrease by 1 unit after each time period.
* Allow the player to fight a fox. This can only happen if the player is close to a fox (2 units), and the player must startle the fox. Foxes do not startle players. Winning the fight will result in a random amount of food gained and damage to player health. Therefore if you loose the fight the player will die and return to default simulation (spectate mode).
* Add in the Eagle class next. The Eagle can attack the player by taking a cheeky stab. This means an Eagle has the ability to move around the landscape, but there is a potential for errors in the display now. For example, if you (the player), a warren, and an Eagle are all in the same cell things are going to get west. So ensure an Eagle can't enter a cell that has a player and warren in it. There can only be one Eagle per Simulation (for now), with a 10% chance of attacking the player if it is within 2 cells. When an Eagle attacks it will decrease the players health by 10. Finally, make sure an Eagle has private attributes for it's own Health and Hunger.
Python Solution:
Answer:
Reign Of The Giant Python Solution Thomas O'Keeffe (BEEF CORP)
Queen Elizabeth School,Kirby Lonsdale

## Validate the Input Coordinate subroutine in Simulation class (EXAM Question - June 2017)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:

## Death by other causes increases with age for Rabbits, increase is more rapid in males. (EXAM Question - June 2017)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:

## Add a River on to the Landscape (EXAM Question - June 2017)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer:
11.1 - Program code for Location class.
11.2 - Program code for CreateLandscapeAndAnimals subroutine from the Simulation class.
11.3 - Program code for DrawLandscape subroutine from the Simulation class.
11.4 - Program code for CreateWarren and CreateNewFox subroutines from the Simulation class.

## Stop the animals from crossing the River when moving (EXAM Question - June 2017)

C# Solution:
Answer :
Answer:
Delphi/Pascal Solution
Answer :
Answer:
Java Solution
Answer :
Answer:
Python Solution:
Answer :
Answer: