Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- '.-----------------------------------------------------------.
- '|README |
- '|****** |
- '|You must change the paths in sub "form_load" to match the |
- '|location of your dice images as the drive letter will |
- '|probably be different! |
- '.-----------------------------------------------------------.
- Public Class Form1
- Dim path_image(5) As String 'array stroring oaths of dice images
- Dim rndnum(11) As Integer 'array stroring 12 rnd numbers
- Dim total(2) As Integer 'array storing totals for the 3 dice combos
- Private Sub bt_start_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_start.Click
- 'clears totals
- total(0) = 0
- total(1) = 0
- total(2) = 0
- 'clears totals
- 'dice combo #1
- For i = 0 To 3
- rndnum(i) = Int((6 * Rnd()) + 1)
- If rndnum(i) = 3 Then
- total(0) = total(0) + 2
- ElseIf rndnum(i) = 5 Then
- total(0) = total(0) + 4
- End If
- Next
- 'dice combo #1
- 'dice combo #2
- For i = 4 To 7
- rndnum(i) = Int((6 * Rnd()) + 1)
- If rndnum(i) = 3 Then
- total(1) = total(1) + 2
- ElseIf rndnum(i) = 5 Then
- total(1) = total(1) + 4
- End If
- Next
- 'dice combo #2
- 'dice combo #3
- For i = 8 To 11
- rndnum(i) = Int((6 * Rnd()) + 1)
- If rndnum(i) = 3 Then
- total(2) = total(2) + 2
- ElseIf rndnum(i) = 5 Then
- total(2) = total(2) + 4
- End If
- Next
- 'dice combo #3
- 'Assignes dice image to imageboxes@form
- pb_11.Image = Image.FromFile(path_image(rndnum(0) - 1))
- pb_12.Image = Image.FromFile(path_image(rndnum(1) - 1))
- pb_13.Image = Image.FromFile(path_image(rndnum(2) - 1))
- pb_14.Image = Image.FromFile(path_image(rndnum(3) - 1))
- pb_21.Image = Image.FromFile(path_image(rndnum(4) - 1))
- pb_22.Image = Image.FromFile(path_image(rndnum(5) - 1))
- pb_23.Image = Image.FromFile(path_image(rndnum(6) - 1))
- pb_24.Image = Image.FromFile(path_image(rndnum(7) - 1))
- pb_31.Image = Image.FromFile(path_image(rndnum(8) - 1))
- pb_32.Image = Image.FromFile(path_image(rndnum(9) - 1))
- pb_33.Image = Image.FromFile(path_image(rndnum(10) - 1))
- pb_34.Image = Image.FromFile(path_image(rndnum(11) - 1))
- 'Assignes dice image to imageboxes@form
- 'fills textbox_totals@form
- tb_total1.Text = total(0)
- tb_total2.Text = total(1)
- 'fills total boxes@form
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- 'Assignes paths of dice images to array
- path_image(0) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\1.png"
- path_image(1) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\2.png"
- path_image(2) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\3.png"
- path_image(3) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\4.png"
- path_image(4) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\5.png"
- path_image(5) = "G:\school\Computing\Programming\Rings_around_the_rose\Dice\6.png"
- 'Assignes paths of dice images to array
- End Sub
- Private Sub bt_check_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_check.Click
- 'checks answer
- If tb_total3.Text = total(2) Then
- MsgBox("CORRECT!")
- Else
- MsgBox("WRONG!")
- End If
- 'checks answer
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement