Advertisement
Just_Tom

Untitled

Mar 24th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VisualBasic 2.71 KB | Source Code | 0 0
  1. Private Sub ImageRepresentation(CurrentGameInstance As GameInstance)
  2.     For BoardIndex = 0 To 63
  3.         GamePicBoxes(BoardIndex).Image = Nothing
  4.     Next
  5.     Dim WhitePieces As ULong = CurrentGameInstance.GetSetPlayerBitboard
  6.     Dim BlackPieces As ULong = CurrentGameInstance.GetSetComputerBitboard
  7.     If ColourPicked = Colour.Black Then
  8.         WhitePieces = CurrentGameInstance.GetSetComputerBitboard
  9.         BlackPieces = CurrentGameInstance.GetSetPlayerBitboard
  10.     End If
  11.     Dim Pieces As ULong = CurrentGameInstance.GetPieceBitboard()
  12.     While Pieces <> 0
  13.         Dim NextPiece As SByte = BitOperations.TrailingZeroCount(Pieces)
  14.         If (BlackPieces And (1UL << NextPiece)) > 0 Then
  15.             For PieceType = 0 To 5
  16.                 If (CurrentGameInstance.GetSetGameBitboard(PieceType) And (1UL << NextPiece)) > 0 Then
  17.                     Select Case PieceType
  18.                         Case 0
  19.                             GamePicBoxes(NextPiece).Image = My.Resources.bKing
  20.                         Case 1
  21.                             GamePicBoxes(NextPiece).Image = My.Resources.bQueen
  22.                         Case 2
  23.                             GamePicBoxes(NextPiece).Image = My.Resources.bRook
  24.                         Case 3
  25.                             GamePicBoxes(NextPiece).Image = My.Resources.bBishop
  26.                         Case 4
  27.                             GamePicBoxes(NextPiece).Image = My.Resources.bKnight
  28.                         Case 5
  29.                             GamePicBoxes(NextPiece).Image = My.Resources.bPawn
  30.                     End Select
  31.                     Exit For
  32.                 End If
  33.             Next
  34.         ElseIf (WhitePieces And (1UL << NextPiece)) > 0 Then
  35.             For PieceType = 0 To 5
  36.                 If (CurrentGameInstance.GetSetGameBitboard(PieceType) And (1UL << NextPiece)) > 0 Then
  37.                     Select Case PieceType
  38.                         Case 0
  39.                             GamePicBoxes(NextPiece).Image = My.Resources.wKing
  40.                         Case 1
  41.                             GamePicBoxes(NextPiece).Image = My.Resources.wQueen
  42.                         Case 2
  43.                             GamePicBoxes(NextPiece).Image = My.Resources.wRook
  44.                         Case 3
  45.                             GamePicBoxes(NextPiece).Image = My.Resources.wBishop
  46.                         Case 4
  47.                             GamePicBoxes(NextPiece).Image = My.Resources.wKnight
  48.                         Case 5
  49.                             GamePicBoxes(NextPiece).Image = My.Resources.wPawn
  50.                     End Select
  51.                     Exit For
  52.                 End If
  53.             Next
  54.         End If
  55.         Pieces -= (1UL << NextPiece)
  56.     End While
  57. End Sub
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement