Join 132,614 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 953 people online right now. Registration is fast and FREE... Join Now!
Private Sub Combo1_DropDown() Command2.Enabled = True End Sub
Private Sub Command2_Click() Form1.Visible = False Form2.Visible = True
End Sub
===========================================
'form2 code
Private Sub Command1_Click()
Command6.Enabled = True 'unlockn the dice
If Val(Label6(0).Caption) = 1 And Val(Label8(0).Caption) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(0, 0, 1, 1, 0)
If Val(Label2(0).Caption) = 8 Then snk = move1(0, 0, 1, 2, 4) 'snake data-------------- If Val(Label2(0).Caption) = 18 Then snk = move1(0, 0, 1, 2, 1) ' If Val(Label2(0).Caption) = 26 Then snk = move1(0, 0, 1, 2, 10) ' If Val(Label2(0).Caption) = 39 Then snk = move1(0, 0, 1, 2, 5) ' If Val(Label2(0).Caption) = 51 Then snk = move1(0, 0, 1, 2, 6) ' If Val(Label2(0).Caption) = 54 Then snk = move1(0, 0, 1, 2, 36) If Val(Label2(0).Caption) = 56 Then snk = move1(0, 0, 1, 2, 1) If Val(Label2(0).Caption) = 60 Then snk = move1(0, 0, 1, 2, 23) If Val(Label2(0).Caption) = 75 Then snk = move1(0, 0, 1, 2, 28) If Val(Label2(0).Caption) = 83 Then snk = move1(0, 0, 1, 2, 45) If Val(Label2(0).Caption) = 85 Then snk = move1(0, 0, 1, 2, 59) If Val(Label2(0).Caption) = 90 Then snk = move1(0, 0, 1, 2, 48) If Val(Label2(0).Caption) = 92 Then snk = move1(0, 0, 1, 2, 25) If Val(Label2(0).Caption) = 97 Then snk = move1(0, 0, 1, 2, 87) If Val(Label2(0).Caption) = 99 Then snk = move1(0, 0, 1, 2, 63) 'snake data---------------------
If Val(Label2(0).Caption) = 3 Then snk = move1(0, 0, 1, 3, 20) 'ladder data------------------- If Val(Label2(0).Caption) = 6 Then snk = move1(0, 0, 1, 3, 14) ' If Val(Label2(0).Caption) = 11 Then snk = move1(0, 0, 1, 3, 28) ' If Val(Label2(0).Caption) = 15 Then snk = move1(0, 0, 1, 3, 34) ' If Val(Label2(0).Caption) = 17 Then snk = move1(0, 0, 1, 3, 74) ' If Val(Label2(0).Caption) = 22 Then snk = move1(0, 0, 1, 3, 37) If Val(Label2(0).Caption) = 38 Then snk = move1(0, 0, 1, 3, 59) If Val(Label2(0).Caption) = 49 Then snk = move1(0, 0, 1, 3, 67) If Val(Label2(0).Caption) = 57 Then snk = move1(0, 0, 1, 3, 76) If Val(Label2(0).Caption) = 61 Then snk = move1(0, 0, 1, 3, 78) If Val(Label2(0).Caption) = 73 Then snk = move1(0, 0, 1, 3, 86) If Val(Label2(0).Caption) = 81 Then snk = move1(0, 0, 1, 3, 98) If Val(Label2(0).Caption) = 88 Then snk = move1(0, 0, 1, 3, 91) 'ladder data---------------------
If Val(Label2(0).Caption) >= 100 Then MsgBox ("player 1 wins ") If Val(Label2(0).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(0).Caption) >= 100 Then Form1.Visible = True If Val(Label2(0).Caption) >= 100 Then Unload Me If Val(Label2(0).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "1" Command1.Enabled = False
Label5(0).Caption = Command6.Caption If Val(Label5(0).Caption) = 6 Or Val(Label5(0).Caption) = 1 Then Label6(0).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(0).Caption) = 6 Or Val(Label5(0).Caption) = 1 Then Label8(0).Caption = Val(Label8(0).Caption) + 1
End Sub
Private Sub Command2_Click() Dim a As Long Command6.Enabled = True
a = Val(Form1.Combo1.Text)
m = Random(1, a) Command2.Caption = "player" & m & "wins"
Command2.Enabled = False If m = 1 Then Command1.Enabled = True If m = 2 Then Command3.Enabled = True If m = 3 Then Command4.Enabled = True If m = 4 Then Command5.Enabled = True
End Sub
Private Sub Command3_Click() Command6.Enabled = True 'unlokng the dice
If Val(Label6(1).Caption) = 1 And Val(Label8(0).Caption) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(1, 2, 3, 1, 0)
If Val(Label2(2).Caption) = 8 Then snk = move1(1, 2, 3, 2, 4) 'snake data-------------- If Val(Label2(2).Caption) = 18 Then snk = move1(1, 2, 3, 2, 1) ' If Val(Label2(2).Caption) = 26 Then snk = move1(1, 2, 3, 2, 10) ' If Val(Label2(2).Caption) = 39 Then snk = move1(1, 2, 3, 2, 5) ' If Val(Label2(2).Caption) = 51 Then snk = move1(1, 2, 3, 2, 6) ' If Val(Label2(2).Caption) = 54 Then snk = move1(1, 2, 3, 2, 36) If Val(Label2(2).Caption) = 56 Then snk = move1(1, 2, 3, 2, 1) If Val(Label2(2).Caption) = 60 Then snk = move1(1, 2, 3, 2, 23) If Val(Label2(2).Caption) = 75 Then snk = move1(1, 2, 3, 2, 28) If Val(Label2(2).Caption) = 83 Then snk = move1(1, 2, 3, 2, 45) If Val(Label2(2).Caption) = 85 Then snk = move1(1, 2, 3, 2, 59) If Val(Label2(2).Caption) = 90 Then snk = move1(1, 2, 3, 2, 48) If Val(Label2(2).Caption) = 92 Then snk = move1(1, 2, 3, 2, 25) If Val(Label2(2).Caption) = 97 Then snk = move1(1, 2, 3, 2, 87) If Val(Label2(2).Caption) = 99 Then snk = move1(1, 2, 3, 2, 63) 'snake data---------------------
If Val(Label2(2).Caption) = 3 Then snk = move1(1, 2, 3, 3, 20) 'ladder data-------------- If Val(Label2(2).Caption) = 6 Then snk = move1(1, 2, 3, 3, 14) ' If Val(Label2(2).Caption) = 11 Then snk = move1(1, 2, 3, 3, 28) ' If Val(Label2(2).Caption) = 15 Then snk = move1(1, 2, 3, 3, 34) ' If Val(Label2(2).Caption) = 17 Then snk = move1(1, 2, 3, 3, 74) ' If Val(Label2(2).Caption) = 22 Then snk = move1(1, 2, 3, 3, 37) If Val(Label2(2).Caption) = 38 Then snk = move1(1, 2, 3, 3, 59) If Val(Label2(2).Caption) = 49 Then snk = move1(1, 2, 3, 3, 67) If Val(Label2(2).Caption) = 57 Then snk = move1(1, 2, 3, 3, 76) If Val(Label2(2).Caption) = 61 Then snk = move1(1, 2, 3, 3, 78) If Val(Label2(2).Caption) = 73 Then snk = move1(1, 2, 3, 3, 86) If Val(Label2(2).Caption) = 81 Then snk = move1(1, 2, 3, 3, 98) If Val(Label2(2).Caption) = 88 Then snk = move1(1, 2, 3, 3, 91) 'ladder data---------------------
If Val(Label2(2).Caption) >= 100 Then MsgBox ("player 2 wins ") If Val(Label2(2).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(2).Caption) >= 100 Then Form1.Visible = True If Val(Label2(2).Caption) >= 100 Then Unload Me If Val(Label2(2).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "2" Command3.Enabled = False
Label5(1).Caption = Command6.Caption If Val(Label5(1).Caption) = 6 Or Val(Label5(1).Caption) = 1 Then Label6(1).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(1).Caption) = 6 Or Val(Label5(1).Caption) = 1 Then Label8(1).Caption = Val(Label8(1).Caption) + 1
End Sub
Private Sub Command4_Click() Command6.Enabled = True 'unlockng the dice
If Val(Label6(2).Caption) = 1 And Val(Label8(2)) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(2, 4, 5, 1, 0) ' function to move the player it also moves the player in case of snake bite and ladder
If Val(Label2(4).Caption) = 8 Then snk = move1(2, 4, 5, 2, 4) 'snake data-------------- If Val(Label2(4).Caption) = 18 Then snk = move1(2, 4, 5, 2, 1) ' If Val(Label2(4).Caption) = 26 Then snk = move1(2, 4, 5, 2, 10) ' If Val(Label2(4).Caption) = 39 Then snk = move1(2, 4, 5, 2, 5) ' If Val(Label2(4).Caption) = 51 Then snk = move1(2, 4, 5, 2, 6) ' If Val(Label2(4).Caption) = 54 Then snk = move1(2, 4, 5, 2, 36) ' If Val(Label2(4).Caption) = 56 Then snk = move1(2, 4, 5, 2, 1) ' If Val(Label2(4).Caption) = 60 Then snk = move1(2, 4, 5, 2, 23) If Val(Label2(4).Caption) = 75 Then snk = move1(2, 4, 5, 2, 28) If Val(Label2(4).Caption) = 83 Then snk = move1(2, 4, 5, 2, 45) If Val(Label2(4).Caption) = 85 Then snk = move1(2, 4, 5, 2, 59) If Val(Label2(4).Caption) = 90 Then snk = move1(2, 4, 5, 2, 48) If Val(Label2(4).Caption) = 92 Then snk = move1(2, 4, 5, 2, 25) If Val(Label2(4).Caption) = 97 Then snk = move1(2, 4, 5, 2, 87) If Val(Label2(4).Caption) = 99 Then snk = move1(2, 4, 5, 2, 63) 'snake data---------------------
If Val(Label2(4).Caption) = 3 Then snk = move1(2, 4, 5, 3, 20) 'ladder data-------------- If Val(Label2(4).Caption) = 6 Then snk = move1(2, 4, 5, 3, 14) ' If Val(Label2(4).Caption) = 11 Then snk = move1(2, 4, 5, 3, 28) ' If Val(Label2(4).Caption) = 15 Then snk = move1(2, 4, 5, 3, 34) ' If Val(Label2(4).Caption) = 17 Then snk = move1(2, 4, 5, 3, 74) ' If Val(Label2(4).Caption) = 22 Then snk = move1(2, 4, 5, 3, 37) If Val(Label2(4).Caption) = 38 Then snk = move1(2, 4, 5, 3, 59) If Val(Label2(4).Caption) = 49 Then snk = move1(2, 4, 5, 3, 67) If Val(Label2(4).Caption) = 57 Then snk = move1(2, 4, 5, 3, 76) If Val(Label2(4).Caption) = 61 Then snk = move1(2, 4, 5, 3, 78) If Val(Label2(4).Caption) = 73 Then snk = move1(2, 4, 5, 3, 86) If Val(Label2(4).Caption) = 81 Then snk = move1(2, 4, 5, 3, 98) If Val(Label2(4).Caption) = 88 Then snk = move1(2, 4, 5, 3, 91) 'ladder data---------------------
If Val(Label2(4).Caption) >= 100 Then MsgBox ("player 3 wins ") If Val(Label2(4).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(4).Caption) >= 100 Then Form1.Visible = True If Val(Label2(4).Caption) >= 100 Then Unload Me If Val(Label2(4).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "3" Command4.Enabled = False
Label5(2).Caption = Command6.Caption If Val(Label5(2).Caption) = 6 Or Val(Label5(2).Caption) = 1 Then Label6(2).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(2).Caption) = 6 Or Val(Label5(2).Caption) = 1 Then Label8(2).Caption = Val(Label8(2).Caption) + 1
End Sub
Private Sub Command5_Click() Command6.Enabled = True 'unlockng the dice
If Val(Label6(3).Caption) = 1 And Val(Label8(3)) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(3, 5, 6, 1, 0) ' function to move the player it also moves the player in case of snake bite and ladder
If Val(Label2(6).Caption) = 8 Then snk = move1(3, 5, 6, 2, 4) 'snake data-------------- If Val(Label2(6).Caption) = 18 Then snk = move1(3, 5, 6, 2, 1) ' If Val(Label2(6).Caption) = 26 Then snk = move1(3, 5, 6, 2, 10) ' If Val(Label2(6).Caption) = 39 Then snk = move1(3, 5, 6, 2, 5) ' If Val(Label2(6).Caption) = 51 Then snk = move1(3, 5, 6, 2, 6) ' If Val(Label2(6).Caption) = 54 Then snk = move1(3, 5, 6, 2, 36) ' If Val(Label2(6).Caption) = 56 Then snk = move1(3, 5, 6, 2, 1) ' If Val(Label2(6).Caption) = 60 Then snk = move1(3, 5, 6, 2, 23) If Val(Label2(6).Caption) = 75 Then snk = move1(3, 5, 6, 2, 28) If Val(Label2(6).Caption) = 83 Then snk = move1(3, 5, 6, 2, 45) If Val(Label2(6).Caption) = 85 Then snk = move1(3, 5, 6, 2, 59) If Val(Label2(6).Caption) = 90 Then snk = move1(3, 5, 6, 2, 48) If Val(Label2(6).Caption) = 92 Then snk = move1(3, 5, 6, 2, 25) If Val(Label2(6).Caption) = 97 Then snk = move1(3, 5, 6, 2, 87) If Val(Label2(6).Caption) = 99 Then snk = move1(3, 5, 6, 2, 63) 'snake data---------------------
If Val(Label2(6).Caption) = 3 Then snk = move1(3, 5, 6, 3, 20) 'ladder data-------------- If Val(Label2(6).Caption) = 6 Then snk = move1(3, 5, 6, 3, 14) ' If Val(Label2(6).Caption) = 11 Then snk = move1(3, 5, 6, 3, 28) ' If Val(Label2(6).Caption) = 15 Then snk = move1(3, 5, 6, 3, 34) ' If Val(Label2(6).Caption) = 17 Then snk = move1(3, 5, 6, 3, 74) ' If Val(Label2(6).Caption) = 22 Then snk = move1(3, 5, 6, 3, 37) If Val(Label2(6).Caption) = 38 Then snk = move1(3, 5, 6, 3, 59) If Val(Label2(6).Caption) = 49 Then snk = move1(3, 5, 6, 3, 67) If Val(Label2(6).Caption) = 57 Then snk = move1(3, 5, 6, 3, 76) If Val(Label2(6).Caption) = 61 Then snk = move1(3, 5, 6, 3, 78) If Val(Label2(6).Caption) = 73 Then snk = move1(3, 5, 6, 3, 86) If Val(Label2(6).Caption) = 81 Then snk = move1(3, 5, 6, 3, 98) If Val(Label2(6).Caption) = 88 Then snk = move1(3, 5, 6, 3, 91) 'ladder data---------------------
If Val(Label2(6).Caption) >= 100 Then MsgBox ("player 4 wins ") If Val(Label2(6).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(6).Caption) >= 100 Then Form1.Visible = True If Val(Label2(6).Caption) >= 100 Then Unload Me If Val(Label2(6).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "4" Command5.Enabled = False
Label5(3).Caption = Command6.Caption If Val(Label5(3).Caption) = 6 Or Val(Label5(3).Caption) = 1 Then Label6(2).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(3).Caption) = 6 Or Val(Label5(3).Caption) = 1 Then Label8(3).Caption = Val(Label8(3).Caption) + 1
End Sub
Private Sub Command6_Click()
q = Random(1, 6)
Command6.Caption = q
Command6.Enabled = False
If Val(Form1.Combo1.Text) = 2 And Val(Label4.Caption) = 1 Then Command3.Enabled = True If Val(Form1.Combo1.Text) = 2 And Val(Label4.Caption) = 2 Then Command1.Enabled = True
If Val(Form1.Combo1.Text) = 3 And Val(Label4.Caption) = 1 Then Command3.Enabled = True If Val(Form1.Combo1.Text) = 3 And Val(Label4.Caption) = 2 Then Command4.Enabled = True If Val(Form1.Combo1.Text) = 3 And Val(Label4.Caption) = 3 Then Command1.Enabled = True
If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 1 Then Command3.Enabled = True If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 2 Then Command4.Enabled = True If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 3 Then Command5.Enabled = True If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 4 Then Command1.Enabled = True
s2: Label9.Caption = "player " & (a1 + 1) & " got bit by a snake at " & Val(Label2(a2).Caption) For q = (Val(Label2(a2).Caption)) To a5 + 1 Step -1 w = Val(Label2(a2).Caption)
If ((w - 1) Mod 10) = 0 Then Label1(a1).Top = Label1(a1).Top + 940
If ((w - 1) Mod 10) = 0 Then Label2(a3).Caption = Val(Label2(a3).Caption) + 1 If ((w - 1) Mod 10) = 0 Then GoTo p1
If (Val(Label2(a3)) Mod 2) Then Label1(a1).Left = Label1(a1).Left - 940 Else Label1(a1).Left = Label1(a1).Left + 940 p1: Label2(a2).Caption = Val(Label2(a2).Caption) - 1 w = Val(Label2(a2).Caption) Next q
'------------------------------------------------------------ 'ladder movement control
s3: If a4 = 3 Then GoTo s4 Else GoTo s5
s4: Label9.Caption = "player " & (a1 + 1) & " climbed the ladder at " & Val(Label2(a2).Caption) For q = (Val(Label2(a2).Caption)) To a5 - 1 'simple ladder movement----------- w = Val(Label2(a2).Caption)
If (w Mod 10) = 0 Then Label1(a1).Top = Label1(a1).Top - 940
If (w Mod 10) = 0 Then Label2(a3).Caption = Val(Label2(a3).Caption) + 1 If (w Mod 10) = 0 Then GoTo p2
If (Val(Label2(a3)) Mod 2) Then Label1(a1).Left = Label1(a1).Left + 940 Else Label1(a1).Left = Label1(a1).Left - 940 p2: Label2(a2).Caption = Val(Label2(a2).Caption) + 1 w = Val(Label2(a2).Caption) Next q
Private Sub Combo1_DropDown() Command2.Enabled = True End Sub
Private Sub Command2_Click() Form1.Visible = False Form2.Visible = True
End Sub
=======================
'form 2 code
Private Sub Command1_Click()
Command6.Enabled = True 'unlockn the dice
If Val(Label6(0).Caption) = 1 And Val(Label8(0).Caption) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(0, 0, 1, 1, 0)
If Val(Label2(0).Caption) = 8 Then snk = move1(0, 0, 1, 2, 4) 'snake data-------------- If Val(Label2(0).Caption) = 18 Then snk = move1(0, 0, 1, 2, 1) ' If Val(Label2(0).Caption) = 26 Then snk = move1(0, 0, 1, 2, 10) ' If Val(Label2(0).Caption) = 39 Then snk = move1(0, 0, 1, 2, 5) ' If Val(Label2(0).Caption) = 51 Then snk = move1(0, 0, 1, 2, 6) ' If Val(Label2(0).Caption) = 54 Then snk = move1(0, 0, 1, 2, 36) If Val(Label2(0).Caption) = 56 Then snk = move1(0, 0, 1, 2, 1) If Val(Label2(0).Caption) = 60 Then snk = move1(0, 0, 1, 2, 23) If Val(Label2(0).Caption) = 75 Then snk = move1(0, 0, 1, 2, 28) If Val(Label2(0).Caption) = 83 Then snk = move1(0, 0, 1, 2, 45) If Val(Label2(0).Caption) = 85 Then snk = move1(0, 0, 1, 2, 59) If Val(Label2(0).Caption) = 90 Then snk = move1(0, 0, 1, 2, 48) If Val(Label2(0).Caption) = 92 Then snk = move1(0, 0, 1, 2, 25) If Val(Label2(0).Caption) = 97 Then snk = move1(0, 0, 1, 2, 87) If Val(Label2(0).Caption) = 99 Then snk = move1(0, 0, 1, 2, 63) 'snake data---------------------
If Val(Label2(0).Caption) = 3 Then snk = move1(0, 0, 1, 3, 20) 'ladder data------------------- If Val(Label2(0).Caption) = 6 Then snk = move1(0, 0, 1, 3, 14) ' If Val(Label2(0).Caption) = 11 Then snk = move1(0, 0, 1, 3, 28) ' If Val(Label2(0).Caption) = 15 Then snk = move1(0, 0, 1, 3, 34) ' If Val(Label2(0).Caption) = 17 Then snk = move1(0, 0, 1, 3, 74) ' If Val(Label2(0).Caption) = 22 Then snk = move1(0, 0, 1, 3, 37) If Val(Label2(0).Caption) = 38 Then snk = move1(0, 0, 1, 3, 59) If Val(Label2(0).Caption) = 49 Then snk = move1(0, 0, 1, 3, 67) If Val(Label2(0).Caption) = 57 Then snk = move1(0, 0, 1, 3, 76) If Val(Label2(0).Caption) = 61 Then snk = move1(0, 0, 1, 3, 78) If Val(Label2(0).Caption) = 73 Then snk = move1(0, 0, 1, 3, 86) If Val(Label2(0).Caption) = 81 Then snk = move1(0, 0, 1, 3, 98) If Val(Label2(0).Caption) = 88 Then snk = move1(0, 0, 1, 3, 91) 'ladder data---------------------
If Val(Label2(0).Caption) >= 100 Then MsgBox ("player 1 wins ") If Val(Label2(0).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(0).Caption) >= 100 Then Form1.Visible = True If Val(Label2(0).Caption) >= 100 Then Unload Me If Val(Label2(0).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "1" Command1.Enabled = False
Label5(0).Caption = Command6.Caption If Val(Label5(0).Caption) = 6 Or Val(Label5(0).Caption) = 1 Then Label6(0).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(0).Caption) = 6 Or Val(Label5(0).Caption) = 1 Then Label8(0).Caption = Val(Label8(0).Caption) + 1
End Sub
Private Sub Command2_Click() Dim a As Long Command6.Enabled = True
a = Val(Form1.Combo1.Text)
m = Random(1, a) Command2.Caption = "player" & m & "wins"
Command2.Enabled = False If m = 1 Then Command1.Enabled = True If m = 2 Then Command3.Enabled = True If m = 3 Then Command4.Enabled = True If m = 4 Then Command5.Enabled = True
End Sub
Private Sub Command3_Click() Command6.Enabled = True 'unlokng the dice
If Val(Label6(1).Caption) = 1 And Val(Label8(0).Caption) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(1, 2, 3, 1, 0)
If Val(Label2(2).Caption) = 8 Then snk = move1(1, 2, 3, 2, 4) 'snake data-------------- If Val(Label2(2).Caption) = 18 Then snk = move1(1, 2, 3, 2, 1) ' If Val(Label2(2).Caption) = 26 Then snk = move1(1, 2, 3, 2, 10) ' If Val(Label2(2).Caption) = 39 Then snk = move1(1, 2, 3, 2, 5) ' If Val(Label2(2).Caption) = 51 Then snk = move1(1, 2, 3, 2, 6) ' If Val(Label2(2).Caption) = 54 Then snk = move1(1, 2, 3, 2, 36) If Val(Label2(2).Caption) = 56 Then snk = move1(1, 2, 3, 2, 1) If Val(Label2(2).Caption) = 60 Then snk = move1(1, 2, 3, 2, 23) If Val(Label2(2).Caption) = 75 Then snk = move1(1, 2, 3, 2, 28) If Val(Label2(2).Caption) = 83 Then snk = move1(1, 2, 3, 2, 45) If Val(Label2(2).Caption) = 85 Then snk = move1(1, 2, 3, 2, 59) If Val(Label2(2).Caption) = 90 Then snk = move1(1, 2, 3, 2, 48) If Val(Label2(2).Caption) = 92 Then snk = move1(1, 2, 3, 2, 25) If Val(Label2(2).Caption) = 97 Then snk = move1(1, 2, 3, 2, 87) If Val(Label2(2).Caption) = 99 Then snk = move1(1, 2, 3, 2, 63) 'snake data---------------------
If Val(Label2(2).Caption) = 3 Then snk = move1(1, 2, 3, 3, 20) 'ladder data-------------- If Val(Label2(2).Caption) = 6 Then snk = move1(1, 2, 3, 3, 14) ' If Val(Label2(2).Caption) = 11 Then snk = move1(1, 2, 3, 3, 28) ' If Val(Label2(2).Caption) = 15 Then snk = move1(1, 2, 3, 3, 34) ' If Val(Label2(2).Caption) = 17 Then snk = move1(1, 2, 3, 3, 74) ' If Val(Label2(2).Caption) = 22 Then snk = move1(1, 2, 3, 3, 37) If Val(Label2(2).Caption) = 38 Then snk = move1(1, 2, 3, 3, 59) If Val(Label2(2).Caption) = 49 Then snk = move1(1, 2, 3, 3, 67) If Val(Label2(2).Caption) = 57 Then snk = move1(1, 2, 3, 3, 76) If Val(Label2(2).Caption) = 61 Then snk = move1(1, 2, 3, 3, 78) If Val(Label2(2).Caption) = 73 Then snk = move1(1, 2, 3, 3, 86) If Val(Label2(2).Caption) = 81 Then snk = move1(1, 2, 3, 3, 98) If Val(Label2(2).Caption) = 88 Then snk = move1(1, 2, 3, 3, 91) 'ladder data---------------------
If Val(Label2(2).Caption) >= 100 Then MsgBox ("player 2 wins ") If Val(Label2(2).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(2).Caption) >= 100 Then Form1.Visible = True If Val(Label2(2).Caption) >= 100 Then Unload Me If Val(Label2(2).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "2" Command3.Enabled = False
Label5(1).Caption = Command6.Caption If Val(Label5(1).Caption) = 6 Or Val(Label5(1).Caption) = 1 Then Label6(1).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(1).Caption) = 6 Or Val(Label5(1).Caption) = 1 Then Label8(1).Caption = Val(Label8(1).Caption) + 1
End Sub
Private Sub Command4_Click() Command6.Enabled = True 'unlockng the dice
If Val(Label6(2).Caption) = 1 And Val(Label8(2)) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(2, 4, 5, 1, 0) ' function to move the player it also moves the player in case of snake bite and ladder
If Val(Label2(4).Caption) = 8 Then snk = move1(2, 4, 5, 2, 4) 'snake data-------------- If Val(Label2(4).Caption) = 18 Then snk = move1(2, 4, 5, 2, 1) ' If Val(Label2(4).Caption) = 26 Then snk = move1(2, 4, 5, 2, 10) ' If Val(Label2(4).Caption) = 39 Then snk = move1(2, 4, 5, 2, 5) ' If Val(Label2(4).Caption) = 51 Then snk = move1(2, 4, 5, 2, 6) ' If Val(Label2(4).Caption) = 54 Then snk = move1(2, 4, 5, 2, 36) ' If Val(Label2(4).Caption) = 56 Then snk = move1(2, 4, 5, 2, 1) ' If Val(Label2(4).Caption) = 60 Then snk = move1(2, 4, 5, 2, 23) If Val(Label2(4).Caption) = 75 Then snk = move1(2, 4, 5, 2, 28) If Val(Label2(4).Caption) = 83 Then snk = move1(2, 4, 5, 2, 45) If Val(Label2(4).Caption) = 85 Then snk = move1(2, 4, 5, 2, 59) If Val(Label2(4).Caption) = 90 Then snk = move1(2, 4, 5, 2, 48) If Val(Label2(4).Caption) = 92 Then snk = move1(2, 4, 5, 2, 25) If Val(Label2(4).Caption) = 97 Then snk = move1(2, 4, 5, 2, 87) If Val(Label2(4).Caption) = 99 Then snk = move1(2, 4, 5, 2, 63) 'snake data---------------------
If Val(Label2(4).Caption) = 3 Then snk = move1(2, 4, 5, 3, 20) 'ladder data-------------- If Val(Label2(4).Caption) = 6 Then snk = move1(2, 4, 5, 3, 14) ' If Val(Label2(4).Caption) = 11 Then snk = move1(2, 4, 5, 3, 28) ' If Val(Label2(4).Caption) = 15 Then snk = move1(2, 4, 5, 3, 34) ' If Val(Label2(4).Caption) = 17 Then snk = move1(2, 4, 5, 3, 74) ' If Val(Label2(4).Caption) = 22 Then snk = move1(2, 4, 5, 3, 37) If Val(Label2(4).Caption) = 38 Then snk = move1(2, 4, 5, 3, 59) If Val(Label2(4).Caption) = 49 Then snk = move1(2, 4, 5, 3, 67) If Val(Label2(4).Caption) = 57 Then snk = move1(2, 4, 5, 3, 76) If Val(Label2(4).Caption) = 61 Then snk = move1(2, 4, 5, 3, 78) If Val(Label2(4).Caption) = 73 Then snk = move1(2, 4, 5, 3, 86) If Val(Label2(4).Caption) = 81 Then snk = move1(2, 4, 5, 3, 98) If Val(Label2(4).Caption) = 88 Then snk = move1(2, 4, 5, 3, 91) 'ladder data---------------------
If Val(Label2(4).Caption) >= 100 Then MsgBox ("player 3 wins ") If Val(Label2(4).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(4).Caption) >= 100 Then Form1.Visible = True If Val(Label2(4).Caption) >= 100 Then Unload Me If Val(Label2(4).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "3" Command4.Enabled = False
Label5(2).Caption = Command6.Caption If Val(Label5(2).Caption) = 6 Or Val(Label5(2).Caption) = 1 Then Label6(2).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(2).Caption) = 6 Or Val(Label5(2).Caption) = 1 Then Label8(2).Caption = Val(Label8(2).Caption) + 1
End Sub
Private Sub Command5_Click() Command6.Enabled = True 'unlockng the dice
If Val(Label6(3).Caption) = 1 And Val(Label8(3)) > 0 Then GoTo Y Else GoTo i 'test condition for the 1st chance the player cant move till he gets a 6
Y: q = Val(Command6.Caption)
mov = move1(3, 5, 6, 1, 0) ' function to move the player it also moves the player in case of snake bite and ladder
If Val(Label2(6).Caption) = 8 Then snk = move1(3, 5, 6, 2, 4) 'snake data-------------- If Val(Label2(6).Caption) = 18 Then snk = move1(3, 5, 6, 2, 1) ' If Val(Label2(6).Caption) = 26 Then snk = move1(3, 5, 6, 2, 10) ' If Val(Label2(6).Caption) = 39 Then snk = move1(3, 5, 6, 2, 5) ' If Val(Label2(6).Caption) = 51 Then snk = move1(3, 5, 6, 2, 6) ' If Val(Label2(6).Caption) = 54 Then snk = move1(3, 5, 6, 2, 36) ' If Val(Label2(6).Caption) = 56 Then snk = move1(3, 5, 6, 2, 1) ' If Val(Label2(6).Caption) = 60 Then snk = move1(3, 5, 6, 2, 23) If Val(Label2(6).Caption) = 75 Then snk = move1(3, 5, 6, 2, 28) If Val(Label2(6).Caption) = 83 Then snk = move1(3, 5, 6, 2, 45) If Val(Label2(6).Caption) = 85 Then snk = move1(3, 5, 6, 2, 59) If Val(Label2(6).Caption) = 90 Then snk = move1(3, 5, 6, 2, 48) If Val(Label2(6).Caption) = 92 Then snk = move1(3, 5, 6, 2, 25) If Val(Label2(6).Caption) = 97 Then snk = move1(3, 5, 6, 2, 87) If Val(Label2(6).Caption) = 99 Then snk = move1(3, 5, 6, 2, 63) 'snake data---------------------
If Val(Label2(6).Caption) = 3 Then snk = move1(3, 5, 6, 3, 20) 'ladder data-------------- If Val(Label2(6).Caption) = 6 Then snk = move1(3, 5, 6, 3, 14) ' If Val(Label2(6).Caption) = 11 Then snk = move1(3, 5, 6, 3, 28) ' If Val(Label2(6).Caption) = 15 Then snk = move1(3, 5, 6, 3, 34) ' If Val(Label2(6).Caption) = 17 Then snk = move1(3, 5, 6, 3, 74) ' If Val(Label2(6).Caption) = 22 Then snk = move1(3, 5, 6, 3, 37) If Val(Label2(6).Caption) = 38 Then snk = move1(3, 5, 6, 3, 59) If Val(Label2(6).Caption) = 49 Then snk = move1(3, 5, 6, 3, 67) If Val(Label2(6).Caption) = 57 Then snk = move1(3, 5, 6, 3, 76) If Val(Label2(6).Caption) = 61 Then snk = move1(3, 5, 6, 3, 78) If Val(Label2(6).Caption) = 73 Then snk = move1(3, 5, 6, 3, 86) If Val(Label2(6).Caption) = 81 Then snk = move1(3, 5, 6, 3, 98) If Val(Label2(6).Caption) = 88 Then snk = move1(3, 5, 6, 3, 91) 'ladder data---------------------
If Val(Label2(6).Caption) >= 100 Then MsgBox ("player 4 wins ") If Val(Label2(6).Caption) >= 100 Then MsgBox ("gameover") If Val(Label2(6).Caption) >= 100 Then Form1.Visible = True If Val(Label2(6).Caption) >= 100 Then Unload Me If Val(Label2(6).Caption) >= 100 Then Form1.Label1.Caption = "play again..."
i: Label4.Caption = "4" Command5.Enabled = False
Label5(3).Caption = Command6.Caption If Val(Label5(3).Caption) = 6 Or Val(Label5(3).Caption) = 1 Then Label6(2).Caption = 1 'condition again checking the 6 for the 1st chance If Val(Label5(3).Caption) = 6 Or Val(Label5(3).Caption) = 1 Then Label8(3).Caption = Val(Label8(3).Caption) + 1
End Sub
Private Sub Command6_Click()
q = Random(1, 6)
Command6.Caption = q
Command6.Enabled = False
If Val(Form1.Combo1.Text) = 2 And Val(Label4.Caption) = 1 Then Command3.Enabled = True If Val(Form1.Combo1.Text) = 2 And Val(Label4.Caption) = 2 Then Command1.Enabled = True
If Val(Form1.Combo1.Text) = 3 And Val(Label4.Caption) = 1 Then Command3.Enabled = True If Val(Form1.Combo1.Text) = 3 And Val(Label4.Caption) = 2 Then Command4.Enabled = True If Val(Form1.Combo1.Text) = 3 And Val(Label4.Caption) = 3 Then Command1.Enabled = True
If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 1 Then Command3.Enabled = True If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 2 Then Command4.Enabled = True If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 3 Then Command5.Enabled = True If Val(Form1.Combo1.Text) = 4 And Val(Label4.Caption) = 4 Then Command1.Enabled = True
s2: Label9.Caption = "player " & (a1 + 1) & " got bit by a snake at " & Val(Label2(a2).Caption) For q = (Val(Label2(a2).Caption)) To a5 + 1 Step -1 w = Val(Label2(a2).Caption)
If ((w - 1) Mod 10) = 0 Then Label1(a1).Top = Label1(a1).Top + 940
If ((w - 1) Mod 10) = 0 Then Label2(a3).Caption = Val(Label2(a3).Caption) + 1 If ((w - 1) Mod 10) = 0 Then GoTo p1
If (Val(Label2(a3)) Mod 2) Then Label1(a1).Left = Label1(a1).Left - 940 Else Label1(a1).Left = Label1(a1).Left + 940 p1: Label2(a2).Caption = Val(Label2(a2).Caption) - 1 w = Val(Label2(a2).Caption) Next q
'------------------------------------------------------------ 'ladder movement control
s3: If a4 = 3 Then GoTo s4 Else GoTo s5
s4: Label9.Caption = "player " & (a1 + 1) & " climbed the ladder at " & Val(Label2(a2).Caption) For q = (Val(Label2(a2).Caption)) To a5 - 1 'simple ladder movement----------- w = Val(Label2(a2).Caption)
If (w Mod 10) = 0 Then Label1(a1).Top = Label1(a1).Top - 940
If (w Mod 10) = 0 Then Label2(a3).Caption = Val(Label2(a3).Caption) + 1 If (w Mod 10) = 0 Then GoTo p2
If (Val(Label2(a3)) Mod 2) Then Label1(a1).Left = Label1(a1).Left + 940 Else Label1(a1).Left = Label1(a1).Left - 940 p2: Label2(a2).Caption = Val(Label2(a2).Caption) + 1 w = Val(Label2(a2).Caption) Next q