public PopulationBase(PopulationSettings settings, Board board) { this.settings = settings; this.board = board; genomeOperations = new GenomeOperations(); }
public static Board FromIBoardSource(IBoardSource source) { //update game settings GameSettings.Rows = source.Rows; GameSettings.Columns = source.Columns; Board board = new Board(); foreach (Piece piece in source.GetPiecesForBoard()) { board[piece.Row, piece.Column] = piece; } board.SaveBoard(); return board; }
public PopulationMultiRun(Board board) : base(board) { }
public PopulationMultiRun(PopulationSettings settings, Board board) : base(settings, board) { }
public PopulationBase(Board board) : this(PopulationSettings.Default, board) { }
private static Board CreateRandomBoard(int? rowMissing, int? colMissing) { Board output = new Board(); MersenneTwister rng = RandomSource.Instance; for (int i = 0; i < GameSettings.Rows; i++) { if (i == rowMissing) { continue; } for (int j = 0; j < GameSettings.Columns; j++) { if (j == colMissing) { continue; } bool isDouble = (rng.NextDoublePositive() < 0.05) ? true : false; bool isBomb = (!isDouble && rng.NextDoublePositive() < 0.05) ? true : false; output[i, j] = new Piece(i, j, rng.Next(1, 6), isBomb, isDouble); } } output.SaveBoard(); return output; }