Question: vb programming i am creating a dice game (craps), once the dice is rolled the sum will result in one of 3 cases (win, lose,

vb programming

i am creating a dice game (craps), once the dice is rolled the sum will result in one of 3 cases (win, lose, or point). a sum = 7 or 11 they win, a sum = 2, 3, or 12 they lose, and any other sum = the point. my problem is with the third case (point). when the sum = 4, 5, 6, 8, 9, or 10 it results in a point = to that sum. the player then has to roll again and keeps rolling until the sum = the point or they roll a 7. if the sum = the point they win, sum = 7 and they lose. the problem occurs when my code reaches the Do/Loop statement. the form is saving the point but continues to follow the same rules prior to rolling a point (a sum = 7 or 11 they win, a sum = 2, 3, or 12 they lose, and any other sum = the point) instead of the new rules when having a point (sum = the point they win, sum = 7 and they lose). Here is my code:

'determine and display if player wins, loses, or rolls a point If DiceTotalInteger = 7 Or DiceTotalInteger = 11 Then BankInteger = (BetInteger * 2) + BankInteger LabelBank.Text = BankInteger.ToString("c") BetInteger = 0 LabelBet.Text = BetInteger MessageBox.Show("You Win!") ElseIf DiceTotalInteger = 2 Or DiceTotalInteger = 3 Or DiceTotalInteger = 12 Then BetInteger = 0 LabelBet.Text = BetInteger MessageBox.Show("You Lose!") Else PointInteger = DiceTotalInteger LabelPoint.Text = PointInteger MessageBox.Show("You Rolled A Point, Continue Rolling To Win Or Lose") Do Until DiceTotalInteger = PointInteger Or DiceTotalInteger = 7 If DiceTotalInteger = 7 Then BetInteger = 0 LabelBet.Text = BetInteger.ToString("c") LabelBank.Text = BankInteger MessageBox.Show("You Lose!") ElseIf DiceTotalInteger = PointInteger Then BankInteger = (BetInteger * 2) + BankInteger LabelBank.Text = BankInteger BetInteger = 0 MessageBox.Show("You Win!") End If Loop End If

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!