The problem is that I don't have a random number for the first low.
Function randomizer(ByVal Low As Long) As Integer
Randomize()
Dim rndNumber As Random
rndNumber = New Random
number = rndNumber.Next(Low, 1001)
Return Number
End Function
Private Sub btnRandomize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRandomize.Click
Dim numberOne As Integer
Dim numberTwo As Integer
Dim numberThree As Integer
numberOne = randomizer(4)
txtNumberOne.Text = numberOne
numberTwo = randomizer(numberOne)
txtNumberTwo.Text = numberTwo
numberThree = randomizer(numberTwo)
txtNumberThree.Text = numberThree
End Sub
I then decided to use the current second as the seed number
Private Sub btnRandomize_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRandomize.Click
Dim numberOne As Integer
Dim numberTwo As Integer
Dim numberThree As Integer
numberOne = randomizer((Second(Now())))
txtNumberOne.Text = numberOne
numberTwo = randomizer(numberOne)
txtNumberTwo.Text = numberTwo
numberThree = randomizer(numberTwo - (Second(Now())))
txtNumberThree.Text = numberThree
If numberThree < 100 Then System.Console.Beep(200, 200)
End Sub
Finally, I added some things to make the fire emergency for the game.
Sub disasterCheck()
Dim numberOne As Integer
Dim numberTwo As Integer
Dim numberThree As Integer
numberOne = randomizer((Second(Now())))
numberTwo = randomizer(numberOne)
numberThree = randomizer(numberTwo - (Second(Now())))
If numberThree < 50 Then
0 Then
Call fire()
Else
End If
If (numberOne + 10) > numberThree Then
generatorBroken = True
Else
generatorBroken = False
End If
End Sub
Sub fire()
firePicture.Visible = True
noButtonClock += 3
power += -2
onfire = True
End Sub
Also working on a Michael Halvorson tutorial:
Sub AddName(ByVal Team As String, ByRef ReturnString As String)
Dim Prompt, Nm, WrapCharacter As String
Prompt = "Enter a " & Team & " employee."
Nm = InputBox(Prompt, "Input Box")
WrapCharacter = Chr(13) + Chr(10)
ReturnString = Nm & WrapCharacter
End Sub
Adapting a tutorial from Patrice Peland I was able to add a save feature, which was very very cool.
Here is the code from that
Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As _
System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
Try
My.Computer.FileSystem.WriteAllText(Me.SaveFileDialog1.FileName, _
Me.txtSales.Text & vbCrLf, False)
My.Computer.FileSystem.WriteAllText(Me.SaveFileDialog1.FileName, _
Me.txtMkt.Text & vbCrLf, True)
Catch fileException As ApplicationException
Throw fileException
End Try
End Sub
Note that I had a lot of trouble with this, not least of which was adding "false" or "true" to the end of the arguments.
No comments:
Post a Comment