示例#1
0
 public Map(Point size)
 {
     if (size.X <= 0 || size.Y <= 0)
     {
         throw new NotPositiveValueException( );
     }
     _width  = (uint)size.X;
     _height = (uint)size.Y;
     Grid    = SimpleUtils.Create2DArray(Width, Height, EMPTY);
 }
示例#2
0
 // TODO: Delete this function when it is not needed for testing
 public void Randomize( )
 {
     for (uint i = 0; i < Width; i++)
     {
         for (uint j = 0; j < Height; j++)
         {
             Grid[i][j] = SimpleUtils.Choose(new Tuple <uint, float>[] {
                 new Tuple <uint, float>(EMPTY, 5),
                 new Tuple <uint, float>(WALL, 1),
                 new Tuple <uint, float>(LEFT_SHELF, 2),
                 new Tuple <uint, float>(RIGHT_SHELF, 2)
             });
         }
     }
 }