コード例 #1
0
 public GameField(int width, int height, IFieldGenerator fieldGenerator)
 {
     Width          = width;
     Height         = height;
     Cells          = new Cell[width, height];
     FieldGenerator = fieldGenerator;
     MinesTotal     = fieldGenerator.GenerateField(Cells);
     CellsToOpen    = width * height - MinesTotal;
 }
コード例 #2
0
 /// <summary>
 /// Represents a method to generate a game field
 /// with random position of the numbers [1, 15] and
 /// one empty cell where the movement of the numbers
 /// will be held.
 /// </summary>
 public void GenerateField(IFieldGenerator fieldGenerator)
 {
     this.table = fieldGenerator.GenerateField(this.TableRows, this.TableCols);
 }