internal GameState(GameInformation gameInfo) { boardState = new Piece[8, 8]; activePiecePositions = new Dictionary <Piece, BoardPosition>(); capturedPieces = new List <Piece>(); history = new List <TurnRecord>(); lastSimulatedState = null; _gameInfo = gameInfo; }
/// <summary> /// Use to see the game state following a potential move. /// </summary> /// <param name="potentialTurn"></param> /// <param name="doRecycle">True to specify that the caller expects the returned /// IGameState to be reused upon the next call to this function. False to specify /// that the caller needs the returned IGameState to be unaltered by future calls /// to this function.</param> /// <returns>An IGameState representing the state that the game would /// be in if the given turn were applied to the current game state.</returns> internal IGameState SimulateMove(TurnRecord potentialTurn, bool doRecycle = true) { SimulatedGameState simulatedState = lastSimulatedState; if (simulatedState == null || !doRecycle) { simulatedState = new SimulatedGameState(this, potentialTurn); } else if (doRecycle) { simulatedState.Initialize(potentialTurn); } return(simulatedState); }