Example #1
0
 public bool Check(Location locationToCheck)
 {
     if (locationToCheck != myLocation)
         return false;
     else
         return true;
 }
Example #2
0
        public void Move()
        {
            bool hidden = false;

            while(!hidden)
            {
                if (myLocation is IHasExteriorDoor && random.Next(2) > 0)
                {
                    IHasExteriorDoor hasDoor = myLocation as IHasExteriorDoor;
                    myLocation = hasDoor.DoorLocation;
                }
                int randNumber = random.Next(myLocation.Exits.Length);
                myLocation = myLocation.Exits[randNumber];

                if (myLocation is IHidingPlace)
                    hidden = true;
            }
        }
Example #3
0
 public void Move()
 {
     bool hidden = false;
     while (!hidden)
     {
         if (myLocation is IHasExteriorDoor)
         {
             IHasExteriorDoor locationWithDoor =
                             myLocation as IHasExteriorDoor;
             if (random.Next(2) == 1)
                 myLocation = locationWithDoor.DoorLocation;
         }
         int rand = random.Next(myLocation.Exits.Length);
         myLocation = myLocation.Exits[rand];
         if (myLocation is IHidingPlace)
             hidden = true;
     }
 }
Example #4
0
 private void MoveToANewLocation(Location location)
 {
     ++Moves;
     currentLocation = location;
     RedrawForm();
 }
Example #5
0
 public bool Check(Location location)
 {
     return location == myLocation;
 }
Example #6
0
 public Opponent(Location location)
 {
     myLocation = location;
     random = new Random();
 }
Example #7
0
 public Opponent(Location startingLocation)
 {
     myLocation = startingLocation;
     random = new Random();
 }
Example #8
0
 private void MoveToANewLocation(Location newLocation)
 {
     Moves++;
     currentLocation = newLocation;
     RedrawForm();
 }