Greetings and salutations!
If you would not mind posting some of your work here, it'd be easier to help you. In the mean time, see what you can gather from the following. A computer guessing game I created from college, 1 form, 1 module, random numbers picked by your system, user/you must guess a high number and low number, pretty preliminary and simple to crack. Hope this helps you get started:
Form code, please forgive the lack of comments included today, sleepy as of now:
-
-
Dim lowerbound As Integer
-
Dim upperbound As Integer
-
-
Private Sub connand1_click()
-
Form1.Label1 = Int(10 * Rnd) + 1
-
End Sub
-
-
-
-
-
Private Sub Command1_Click()
-
-
Module1.play_game
-
-
End Sub
-
Private Sub form_load()
-
Randomize
-
lowerbound = Int(InputBox("enter the lower number"))
-
upperbound = Int(InputBox("enterput the higher number"))
-
-
computer_num = Int((((upperbound - lowerbound + 1) * Rnd) + lowerbound))
-
-
End Sub
-
-
-
Module code:
[code]
Public computer_num As Integer
Dim x As Integer
Public Sub play_game()
Dim use_num As Integer
x = 1
Do While x < 6
use_num = Int(InputBox("Enter your guess please!"))
If use_num = computer_num Then
Form1.Label1.Caption = "you win"
x = 7
ElseIf use_num < computer_num Then
Form1.Label1.Caption = "you are to low try again"
ElseIf use_num > computer_num Then
Form1.Label1.Caption = "your to high try again"
Else: MsgBox ("error fix me")
End If
x = x + 1
Loop
End Sub
[code]
Will post comment, if needed, late here, will check back with you in case you need further clarification.
Good luck!
Dököll