Difference between revisions of "Selection - 2017"

From TRCCompSci - AQA Computer Science
Jump to: navigation, search
(Created page with "dibs")
 
Line 1: Line 1:
dibs
+
L34 - L68, Location:
 +
 
 +
Simple selection for the menu system
 +
<syntaxhighlight lang="csharp">
 +
if (menuOption == 1)
 +
        {
 +
          TimePeriod++;
 +
          ShowDetail = true;
 +
          AdvanceTimePeriod();
 +
        }
 +
        if (menuOption == 2)
 +
        {
 +
          TimePeriod++;
 +
          ShowDetail = false;
 +
          AdvanceTimePeriod();
 +
        }
 +
        if (menuOption == 3)
 +
        {
 +
          x = InputCoordinate('x');
 +
          y = InputCoordinate('y');
 +
          if (Landscape[x, y].Fox != null)
 +
          {
 +
            Landscape[x, y].Fox.Inspect();
 +
          }
 +
        }
 +
        if (menuOption == 4)
 +
        {
 +
          x = InputCoordinate('x');
 +
          y = InputCoordinate('y');
 +
          if (Landscape[x, y].Warren != null)
 +
          {
 +
            Landscape[x, y].Warren.Inspect();
 +
            Console.Write("View individual rabbits (y/n)?");
 +
            viewRabbits = Console.ReadLine();
 +
            if (viewRabbits == "y") {
 +
              Landscape[x, y].Warren.ListRabbits();
 +
            }
 +
          }
 +
        }
 +
</syntaxhighlight>

Revision as of 12:07, 7 February 2017

L34 - L68, Location:

Simple selection for the menu system

 
if (menuOption == 1)
        {
          TimePeriod++;
          ShowDetail = true;
          AdvanceTimePeriod();
        }
        if (menuOption == 2)
        {
          TimePeriod++;
          ShowDetail = false;
          AdvanceTimePeriod();
        }
        if (menuOption == 3)
        {
          x = InputCoordinate('x');
          y = InputCoordinate('y');
          if (Landscape[x, y].Fox != null)
          {
            Landscape[x, y].Fox.Inspect();
          }
        }
        if (menuOption == 4)
        {
          x = InputCoordinate('x');
          y = InputCoordinate('y');
          if (Landscape[x, y].Warren != null)
          {
            Landscape[x, y].Warren.Inspect();
            Console.Write("View individual rabbits (y/n)?");
            viewRabbits = Console.ReadLine();
            if (viewRabbits == "y") {
              Landscape[x, y].Warren.ListRabbits();
            }
          }
        }