public void SupportAndBinaryBetweentwoBitboardStates() { var state1 = new BitboardState(1 << 8, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, 1 << 4, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); var state2 = new BitboardState(1, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, 1 << 4, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); var expectedState = new BitboardState(HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, 1 << 4, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); var actualState = state1 & state2; Assert.Equal(expectedState, actualState); }
public void SupportXorBinaryBetweenTwoBitboardStates() { var state1 = new BitboardState(0x100, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); var state2 = new BitboardState(0x1, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, 1 << 4, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); var expectedState = new BitboardState(0x101, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, 1 << 4, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); var actualState = state1 ^ state2; Assert.Equal(expectedState, actualState); }
public void UpdateBitboardStateForValidMoves() { var complexState = new FullBitboardState( BitboardPredefinedStates.InitialWhitePositions, BitboardPredefinedStates.InitialBlackPositions); var expectedState = new BitboardState(HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, 0x100, 0xFF, HexValues.TwoPieceRow, HexValues.FullRow); var board = new Bitboard(complexState); board.Move(PlayerType.Black, "9g9f"); Assert.Equal(BitboardPredefinedStates.InitialWhitePositions, board.BitboardState.WhitePieces); Assert.Equal(expectedState, board.BitboardState.BlackPieces); }
public BitboardShogiGame(IBoard board, IBoardRender render) { _board = board; _render = render; _boardState = new BitboardState(); }
public void Refresh(BitboardState boardState) { throw new System.NotImplementedException(); }
public void GetBitBasedOnIndexedProperty() { var state = new BitboardState(1 << 8, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); Assert.True(state[0]); }
public void ThrowIndexOutOfRangeExceptionForIndexesGreaterThan80() { var state = new BitboardState(HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow, HexValues.EmptyRow); Assert.Throws <IndexOutOfRangeException>(() => state[81]); }
public FullBitboardState(BitboardState whitePieces, BitboardState blackPieces) { WhitePieces = whitePieces; BlackPieces = blackPieces; }
public void ThrowIndexOutOfRangeExceptionForIndexesBelow0() { var state = new BitboardState(BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow, BinaryValues.EmptyRow); Assert.Throws <IndexOutOfRangeException>(() => state[-1]); }