Hi Guys!
Lately starting to make a project which involving calculations in it, Unfortunately I got some trouble because the calculation which is displayed out is wrong.
The main idea is that I set a event where you pay 5 "Gcoins" to play the "paper scissors stone" game against the computer. In the beginning you start off with 50 "Gcoins", and the initial score is 100; Each time if you win, add 20 to the initial score and add 10 "GCoins"; if it's a draw then add 10 to the initial score and 5 "GCoins"; if you lose then its add 0 to the initial score and add 0 "Gcoins", so every time after the result, the score is added up and the new amount of "GCoins" is added up(if you win of draw).So the Score and the "GCoins" accumulates each time playing. In the end there would be a score board which displays the score and a label which displays the amount of "GCoins".
The problems are
1.the result showing in label2 and richtextbox1 are wrong, the "GCoins" amount doesn't seem to go down or just increasing in large amount.
2.Is there anyway to set a limit to the amount of scores and "GCoins"?
3.When running the program, the result shows that it is more likely to draw. So is my situation set in the code equal chance?
here is my code.
Public Class Form1
Dim timercount1 As Integer = 80
Dim scorepoint As Integer
Dim scorepointconstant As Integer = 100
Dim GcoinPoints As Integer
Dim gcoinpoints2 As Integer
Dim Gcoinconstant As Integer = 50
Private Sub form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label2.Text = Gcoinconstant.ToString
RichTextBox1.Text = scorepointconstant.ToString
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
r1 = Rnd()
r2 = Rnd()
Gcoinspoints += Gcoinconstant - 5
If r1 < r2 Then
Label1.Text = "You win"
MessageBox.Show("You win")
scorepoint += scorepointconstant + 20
RichTextBox1.Text = scorepoint.ToString
GcoinPoints += 10 + Gcoinconstant
gcoinpoints2 = GcoinPoints
Label2.Text = gcoinpoints2.ToString()
End If
If r1 = r2 Then
Label1.Text = "Draw"
MessageBox.Show("Draw")
scorepoint += scorepointconstant + 10
RichTextBox1.Text = scorepoint.ToString
GcoinPoints += 5 + Gcoinconstant
gcoinpoints2 = GcoinPoints
Label2.Text = gcoinpoints2.ToString()
End If
If r1 > r2 Then
Label1.Text = "You lose"
MessageBox.Show("You lose")
scorepoint += scorepointconstant + 0
RichTextBox1.Text = scorepoint
GcoinPoints += 0 + Gcoinconstant
gcoinpoints2 = GcoinPoints
Label2.Text = gcoinpoints2.ToString()
End If
End Sub
Any Help would be appreciated. Thank you