Hello. this is my 3rd post about the same project in one day :( anyways, I have a program which i have made for a term project that is due Tuesday January 23rd :S
The program is based on the game show "Deal or No Deal". As some of you may be aware the game show consists of 26 cases with different values in each case ranging from 0.01 to 1 million dollars. I am currently working on perfecting my randomization function on another forum ( randomizing array WITHOUT REPEAT) as well as another forum involving the user selecting
their case (if statement dilemma involving command buttons). Now there is only two main thing for me to cover. And they are the rounds of the game (Module counter) and generating an offer (calculating between forms)
For the purpose of my program i need to use a module to keep count of the rounds of my game. As many of you may have seen on the gameshow, "Deal or No Deal" the game is split up into rounds.
they operate as follows in this chart
Round Setup
round 1 = 6 cases are opened and then offer is generated
round 2 = 5 cases are opened and then offer is generated
round 3 = 4 cases are opened and then offer is generated
round 4 = 3 Cases are opened and then offer is generated
round 5 = 2 cases are opened and then offer is generated
round 6 = 1 case is opened and then offer is generated
round 7= 1 case is opened and then offer is generated
round 8 = 1 case is opened and then offer is generated
round 9 = 1 case is opened and then offer is generated
round 10 = User allowed to swap their case with remaining case
What i need to do, is every time a case is chosen (case command button is clicked) a count is added to the module counter. When the counter reaches 6
the user is shown their offer, and if they accept the game is over, if not they continue. now they choose 5 cases at the end of which they are prompted again with another offer, and this process continues according to the Round Setup i posted above.
On another note i need to generate an offer. The calculations to formulate the offer is simple, coding it is the hard part. All you do is start off with the combined total of all the case values together ( $3,418,416.01) and as you open the cases you subtract the value of each case from the overall total. When it comes time to generate an offer (after opening 6 cases for instance) The new total ( $3,418,416.01 - values of all cases chosen to that point) is then divided by the number of remaining cases left in play. If the user denies the offer, the number is set back to before it was divided, and the subtraction of cases continues until the next round is over (5 cases chosen). The new total after round 2 is then divided by the remaining number of cases. This cycle continues until the user either excepts the offer, ending the game, or takes their case. Now that you understand the formula of generating an offer let me now briefly explain how i need it to work.
When a case command is clicked it opens up a "Caseval" form that displays a randomized value for that case in a text box. (the value of the case was pre- determined when the form loads and the command button merely makes "Caseval" visible and it's form "Formcases" invisible) What i need to do is subtract this randomized value from the overall value. The overall value ($3,418,416.01) is stored in a text box in the form "Calculator". Then display the answer in a text box on the form "Money" .Within the Money form i would divide the value of the textbox by the remaining number of cases. obviously for the program to subtract values it has to recognize the characters as numerical values so i would string them as values in my module "DealGenerator"
My project is too big to zip to the forum (contains bitmaps) but here is some of the code if generated so far.
This is code from my opening form that contains all my cases
VB Code:
Private Sub Case1_Click() ' this code is the same for all 26 cases Formcases.Visible= False Caseval.Visible = True ' where i add one to counter (not sure how) Case1.Visible = true Private Sub Form_Activate() ' random function (working on abolishing repeats) Dim Mnyval(25) As String Dim CaseCollection As New Collection Dim intRand As Integer Mnyval(0) = "0.01" Mnyval(1) = "1" Mnyval(2) = "5" Mnyval(3) = "10" Mnyval(4) = "25" Mnyval(5) = "50" Mnyval(6) = "75" Mnyval(7) = "100" Mnyval(8) = "200" Mnyval(9) = "300" Mnyval(10) = "400" Mnyval(11) = "500" Mnyval(12) = "750" Mnyval(13) = "1000" Mnyval(14) = "5000" Mnyval(15) = "10000" Mnyval(16) = "25000" Mnyval(17) = "50000" Mnyval(18) = "75000" Mnyval(19) = "100000" Mnyval(20) = "200000" Mnyval(21) = "300000" Mnyval(22) = "400000" Mnyval(23) = "500000" Mnyval(24) = "750000" Mnyval(25) = "1000000" On Error Resume Next Randomize Do Until CaseCollection.Count = UBound(Mnyval) + 1 intRand = Int(Rnd * (UBound(Mnyval) + 1)) CaseCollection.Add Item:=CStr(intRand), Key:=CStr(intRand) Loop For intRand = 1 To CaseCollection.Count Caseval.Text1.Text = Mnyval(CaseCollection.Item(intRand)) Next End Sub
This is code from my Caseval form where all the randomized values are displayed.
VB Code:
Dim cnt As Integer Private Sub CmdOK_Click() Scoreboard.Visible = True Caseval.Visible = False Scoretime.Enabled = True cnt = 0 If Text1.Text = "0.01" Then Scoreboard.Label1.BackStyle = Transparent ElseIf Text1.Text = "1" Then Scoreboard.Label2.BackStyle = Transparent ElseIf Text1.Text = "5" Then Scoreboard.Label3.BackStyle = Transparent ElseIf Text1.Text = "10" Then Scoreboard.Label4.BackStyle = Transparent ElseIf Text1.Text = "25" Then Scoreboard.Label5.BackStyle = Transparent ElseIf Text1.Text = "50" Then Scoreboard.Label6.BackStyle = Transparent ElseIf Text1.Text = "75" Then Scoreboard.Label7.BackStyle = Transparent ElseIf Text1.Text = "100" Then Scoreboard.Label8.BackStyle = Transparent ElseIf Text1.Text = "200" Then Scoreboard.Label9.BackStyle = Transparent ElseIf Text1.Text = "300" Then Scoreboard.Label10.BackStyle = Transparent ElseIf Text1.Text = "400" Then Scoreboard.Label11.BackStyle = Transparent ElseIf Text1.Text = "500" Then Scoreboard.Label12.BackStyle = Transparent ElseIf Text1.Text = "750" Then Scoreboard.Label13.BackStyle = Transparent ElseIf Text1.Text = "1000" Then Scoreboard.Label14.BackStyle = Transparent ElseIf Text1.Text = "5000" Then Scoreboard.Label15.BackStyle = Transparent ElseIf Text1.Text = "10000" Then Scoreboard.Label16.BackStyle = Transparent ElseIf Text1.Text = "25000" Then Scoreboard.Label17.BackStyle = Transparent ElseIf Text1.Text = "50000" Then Scoreboard.Label18.BackStyle = Transparent ElseIf Text1.Text = "75000" Then Scoreboard.Label19.BackStyle = Transparent ElseIf Text1.Text = "100000" Then Scoreboard.Label20.BackStyle = Transparent ElseIf Text1.Text = "200000" Then Scoreboard.Label21.BackStyle = Transparent ElseIf Text1.Text = "300000" Then Scoreboard.Label22.BackStyle = Transparent ElseIf Text1.Text = "400000" Then Scoreboard.Label23.BackStyle = Transparent ElseIf Text1.Text = "500000" Then Scoreboard.Label24.BackStyle = Transparent ElseIf Text1.Text = "750000" Then Scoreboard.Label25.BackStyle = Transparent ElseIf Text1.Text = "1000000" Then Scoreboard.Label26.BackStyle = Transparent End If End Sub Private Sub Form_Load() Scoretime.Enabled = False End Sub Private Sub Scoretime_Timer() cnt = cnt + 1 If cnt = 1 Then Scoreboard.Visible = False FormCases.Visible = True End If End Sub End Sub
This is the module code i have created so far, however it doesn't seem to work
VB Code:
Dim z As Double, s As Double, r As Double Public Sub Offercalc() z = Val(Calculator.Calc.Text) Calculator.Calc.Text = Str(z) r = Val(Money.Offer.Text) Money.Offer.Text = Str(r) s = Var(Caseval.Text1.Text) Caseval.Text1.Text = Str(s) r = z - s Money.Offer.Text = r End Sub
First off, Thanks even for reading all of this. Secondly i know its alot to take in but i need as much input as i can get for this term project as it is worth a HUGE portion of my mark and it is due on TUESDAY JAN 23
please dont take me as being a procrastinator who calls for help when they are rushing to finish. I have spent a huge amount of time just figuring out the complex vb script to write this program, seeing as i am learning Vb script for the first time this year in school. HELP is MUCH appreciated. Thank you all
