This is my game. It can be run under Excel (or programmed in another language)
When programming I exclude vowels from my variables (gss=guess)
The object is to guess a number that equals time when the computers guess differs from that number.
When programming I exclude vowels from my variables (gss=guess)
The object is to guess a number that equals time when the computers guess differs from that number.
Code:
Sub game()
Cells(1,1).Font.Bold=True
Cells(1,1)="Player:"
Cells(1,2)=0
Cells(2,1).Font.Bold=True
Cells(2,1)="CPU:"
Cells(2,2)=0
Cells(3,1).Font.Bold=True
Cells(3,1)="Time:"
Cells(3,2)=1
Cells(4,1)=""
22
gss=InputBox(">")
cpugss=Cells(3,2)+gss
Cells(1,2)=gss
Cells(2,2)=cpugss
Cells(3,2)=(Cells(1,2)+Cells(2,2))
cells(4,1)=""
If (Cells(1,2)=Cells(3,2)) Then
If (Cells(2,2)=Cells(3,2)) Then Cells(4,1)="Draw"
End If
If (Cells(1,2)=Cells(3,2)) Then
If (Cells(2,2)<>Cells(3,2)) Then
Cells(4,1)="Player wins!"
END
End if
End if
If (Cells(1,2)<>Cells(3,2)) Then
If (Cells(2,2)=Cells(3,2)) Then
Cells(4,1)="CPU wins!"
End
End If
End If
GoTo 22
End Sub