Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub ImageRepresentation(CurrentGameInstance As GameInstance)
- For BoardIndex = 0 To 63
- GamePicBoxes(BoardIndex).Image = Nothing
- Next
- Dim WhitePieces As ULong = CurrentGameInstance.GetSetPlayerBitboard
- Dim BlackPieces As ULong = CurrentGameInstance.GetSetComputerBitboard
- If ColourPicked = Colour.Black Then
- WhitePieces = CurrentGameInstance.GetSetComputerBitboard
- BlackPieces = CurrentGameInstance.GetSetPlayerBitboard
- End If
- Dim Pieces As ULong = CurrentGameInstance.GetPieceBitboard()
- While Pieces <> 0
- Dim NextPiece As SByte = BitOperations.TrailingZeroCount(Pieces)
- If (BlackPieces And (1UL << NextPiece)) > 0 Then
- For PieceType = 0 To 5
- If (CurrentGameInstance.GetSetGameBitboard(PieceType) And (1UL << NextPiece)) > 0 Then
- Select Case PieceType
- Case 0
- GamePicBoxes(NextPiece).Image = My.Resources.bKing
- Case 1
- GamePicBoxes(NextPiece).Image = My.Resources.bQueen
- Case 2
- GamePicBoxes(NextPiece).Image = My.Resources.bRook
- Case 3
- GamePicBoxes(NextPiece).Image = My.Resources.bBishop
- Case 4
- GamePicBoxes(NextPiece).Image = My.Resources.bKnight
- Case 5
- GamePicBoxes(NextPiece).Image = My.Resources.bPawn
- End Select
- Exit For
- End If
- Next
- ElseIf (WhitePieces And (1UL << NextPiece)) > 0 Then
- For PieceType = 0 To 5
- If (CurrentGameInstance.GetSetGameBitboard(PieceType) And (1UL << NextPiece)) > 0 Then
- Select Case PieceType
- Case 0
- GamePicBoxes(NextPiece).Image = My.Resources.wKing
- Case 1
- GamePicBoxes(NextPiece).Image = My.Resources.wQueen
- Case 2
- GamePicBoxes(NextPiece).Image = My.Resources.wRook
- Case 3
- GamePicBoxes(NextPiece).Image = My.Resources.wBishop
- Case 4
- GamePicBoxes(NextPiece).Image = My.Resources.wKnight
- Case 5
- GamePicBoxes(NextPiece).Image = My.Resources.wPawn
- End Select
- Exit For
- End If
- Next
- End If
- Pieces -= (1UL << NextPiece)
- End While
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement