private BlockadeState( BoardCalculator.Factory boardCalculatorFactory, Grid <Cell> board, Location[] playerLocations, List <int> finalResults, int currentPlayer, int turn) { this._boardCalculatorFactory = boardCalculatorFactory; this._board = board; this._playerLocations = playerLocations; this._finalResults = finalResults; this._currentPlayer = currentPlayer; this._turn = turn; }
private static BlockadeState CreateFromConfiguration( BlockadeConfiguration configuration, BoardCalculator.Factory boardCalculatorFactory) { var board = Grid.Create(configuration.Rows, configuration.Cols, (row, col) => Cell.EmptyCell); var playerLocations = configuration.StartingLocations .Select(t => Location.Create(t.Item1, t.Item2)) .ToArray(); var finalResults = new List <int>(capacity: configuration.Players.Count); var currentPlayer = 0; var turn = 1; // place players at their initial positions foreach (var i in Enumerable.Range(0, playerLocations.Length)) { var location = playerLocations[i]; board[location] = Cell.MakeOccupiedCell(player: i, turn: 0); } return(new BlockadeState(boardCalculatorFactory, board, playerLocations, finalResults, currentPlayer, turn)); }
public BlockadeStateFactory(BoardCalculator.Factory boardCalculatorFactory) { this._boardCalculatorFactory = boardCalculatorFactory; }