I need someone write the code for craps game Visual Basic It
Solution
Visual basic code for craps game: I am taking the dice game and devoleping the code by using game of craps in visual basic
Dim previousRoll As Integer
Private Sub Command1_Click()
Dim txt As Integer
Dim number As Integer
Dim number1 As Integer
Dim numbertotal As Integer
Dim RandomNum As Integer
Dim RandomNum2 As Integer
Randomize Timer
RandomNum = Int(Rnd * 6) + 1
RandomNum2 = Int(Rnd * 6) + 1
Text1 = RandomNum
Text2 = RandomNum2
dice1.Visible = True
dice1.Picture = LoadPicture(\"C:\\university work\\visual basic\\craps\\dice\" & Text1 & \".bmp\")
dice2.Visible = True
dice2.Picture = LoadPicture(\"C:\\university work\\visual basic\\craps\\dice\" & Text2 & \".bmp\")
number = Text1
number1 = Text2
numbertotal = number + number1
If previousRoll = 0 Then
Select Case numbertotal
Case 7, 11
total.Caption = \"Your Point is\" & Space(1) & numbertotal
info.Caption = \"You WIN!\"
Case 2, 3, 12
total.Caption = \"Your Point is\" & Space(1) & numbertotal
info.Caption = \"You LOSE\"
Case 4, 5, 6, 8, 9, 10
total.Caption = \"Your Point is\" & Space(1) & numbertotal
info.Caption = \"Roll Again!\"
previousRoll = numbertotal
End Select
Else
Select Case numbertotal
Case 7
total.Caption = \"Your Point is\" & Space(1) & numbertotal
info.Caption = \"You LOSE\"
previousRoll = 0
Case 4, 5, 6, 8, 9, 10
total.Caption = \"Your Point is\" & Space(1) & numbertotal
info.Caption = \"You WIN\"
previousRoll = 0
Case Else
total.Caption = \"Your Point is\" & Space(1) & numbertotal
info.Caption = \"Roll Again!\"
previousRoll = numbertotal
End Select
End If
End Sub
Private Sub Form_Load()
previousRoll = 0
End Sub

