예제 #1
0
 private Board(int pl)
 {
     //Declaration
     locations       = new LocationLinkedList <Location>();
     freeMonitor     = new Dictionary <string, int>();
     listOfPrisoners = new Dictionary <string, int>();
     //Circular LinkedList Filled with 40 Location Nodes
     for (int i = 0; i < 40; i++)
     {
         if (i == 0)
         {
             locations.addNode(new Node <Location>(new Location("GO")));
         }
         else if (i == 9)
         {
             locations.addNode(new Node <Location>(new Location("Jail/Visit")));
         }
         else if (i == 29)
         {
             locations.addNode(new Node <Location>(new Location("2Jail")));
         }
         else
         {
             locations.addNode(new Node <Location>(new Location("Tile" + i)));
         }
     }
     locations.print();
     //Insert Number of Players
     pnum    = pl;
     players = new List <Player>(3);
     for (int i = 0; i < pnum; i++)
     {
         String name   = "Player" + i;
         Player player = new Player(name, 0);
         players.Add(player);
     }
 }
예제 #2
0
 public LocationLinkedListEnumerator(LocationLinkedList <T> l)
 {
     list            = l;
     current_obj_idx = -1; // At the beginning, the iterator is set before the first element (see IEnumerator documentation)
 }