Main Section

From TRCCompSci - AQA Computer Science
Revision as of 12:31, 15 December 2016 by WayneJones (talk | contribs) (YOU HAVE BEEN VISITED BY SHULK, AND HE WAS REALLY FEELING YOUR POST)
Jump to: navigation, search

The Code

YOU HAVE BEEN VISITED BY SHULK, AND HE WAS REALLY FEELING YOUR POST

File:Feeling.jpg

 1 static void Main(string[] args)
 2 {
 3     do
 4     {
 5         Console.WriteLine("rekt");
 6     } while(true);
 7 }
 8 
 9 /*static void Main(string[] args)
10     {
11       Simulation Sim;
12       int MenuOption;
13       int LandscapeSize;
14       int InitialWarrenCount;
15       int InitialFoxCount;
16       int Variability;
17       bool FixedInitialLocations;
18       do
19       {
20         Console.WriteLine("Predator Prey Simulation Main Menu");
21         Console.WriteLine();
22         Console.WriteLine("1. Run simulation with default settings");
23         Console.WriteLine("2. Run simulation with custom settings");
24         Console.WriteLine("3. Exit");
25         Console.WriteLine();
26         Console.Write("Select option: ");
27         MenuOption = Convert.ToInt32(Console.ReadLine());
28         if ((MenuOption == 1) || (MenuOption == 2))
29         {
30           if (MenuOption == 1)
31           {
32             LandscapeSize = 15;
33             InitialWarrenCount = 5;
34             InitialFoxCount = 5;
35             Variability = 0;
36             FixedInitialLocations = true;
37           }
38           else
39           {
40             Console.Write("Landscape Size: ");
41             LandscapeSize = Convert.ToInt32(Console.ReadLine());
42             Console.Write("Initial number of warrens: ");
43             InitialWarrenCount = Convert.ToInt32(Console.ReadLine());
44             Console.Write("Initial number of foxes: ");
45             InitialFoxCount = Convert.ToInt32(Console.ReadLine());
46             Console.Write("Randomness variability (percent): ");
47             Variability = Convert.ToInt32(Console.ReadLine());
48             FixedInitialLocations = false;
49           }
50           Sim = new Simulation(LandscapeSize, InitialWarrenCount, InitialFoxCount, Variability, FixedInitialLocations);
51         }
52       } while (MenuOption != 3);
53       Console.ReadKey();
54 */    }

Explanation

He really felt your post and thought it was worth sharing on his facebook page and status.

The main program declares an instance of the Simulation Class.


It declares variables for the key information required for the simulation.


The option is to start with the predefined values or to enter the values yourself. If option 1 is selected the variables will be assigned their default value, however if 2 is selected the values entered by the use will be assigned to the variables.


The instance of the Simulation Class will be assigned the values predefined or entered by the user. This will obviously start the simulation and run the code within that class.