I'm not going to post the entire 500+ lines.
What we are doing is making a battle ship game.
Our problem lies with the random number generator, there exists a pattern that is predictable.
We're wondering how to code a truly random number generator.
Heres the generator code we have:
vb
'Pick a random location for ship
Dim intShip As Integer = Int(Rnd() * 8)
Dim intMiss As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If intShip + 1 = 1 Then
picShip1.BringToFront()
MessageBox.Show("You hit the ship!", "Congratulations!")
If intMiss >= 5 Then
picLose.BringToFront()
Else
picWin.BringToFront()
End If
Else
intMiss = intMiss + 1
picMiss1.BringToFront()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If intShip + 1 = 2 Then
picShip2.BringToFront()
MessageBox.Show("You hit the ship!", "Congratulations!")
If intMiss >= 5 Then
picLose.BringToFront()
Else
picWin.BringToFront()
End If
Else
intMiss = intMiss + 1
picMiss2.BringToFront()
End If
End Sub
*edit: Please use code tags in the future, thanks!
This post has been edited by Martyr2: 9 Apr, 2008 - 03:00 PM