コード例 #1
0
 public void Moved(RandomEvent r)
 {
     TotalStep++;
     if (r.Direction == 0)
     {
         dir = "Right";
         Pos++;
     }
     else
     {
         Pos--;
         dir = "Left";
     }
     if (Pos == Max || Pos == Min)
     {
         Console.WriteLine("Total step to move {0} spaces to the {1} is: {2}", Math.Abs(Pos), dir, TotalStep);
         r.Walker.delObserver(this);
     }
 }