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
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
Calculator is an invisible form that is used to subtract the selected values from the overall total. Within this textbox is the overall value at the beginning of the game ($3,418,416.01). What i need to happen is , that when a random case value is inputed into my Caseval form Textbox it is subtracted from this total. I attempted at doing this by subtracting the value in the text (s) from the value in the text box of my Calculator form (z)
also let me post my new and improved code with the proper working randomize function
well first off. i dont think i need the calculator form because i can prob do the calculations using only two textboxes.
This is the equation i wnat to occur (edited to add the other one)
r = z - s
n = r - s
z= $3,418,416.01
ex. s= 10,000 (one of the case values)
ex. r= $3,418,416.01 - 10,000 = $3,408,416.01
ex . r ($3,408,416.01) - 5,000 = $3,403,416.01
ex. n ($3,403,416.01) - 200 = $3,403,216.01
cycle continues
z would be the beginning total $3,418,416.01 and s would be the value of case chosen. r would be the new number formed from this equation. i would then need s to be subtracted from r when another value was chosen. this subtraction of values would have to repeat 6 times ( round 1 complete) and an offer would be generated the equation for the offer being : current total ($3,418,416.01-amount of cases chosen to that point) divided by the number of remaining cases (20). if they accept the offer ("Deal") the game ends . if they decline the offer current total would go back to what it was before the division and the game would continue on and this time 5 cases would be chosen and the equation would repeat again: current total ($3,418,416.01-amount of cases chosen to that point) divided by the number of remaining cases (15). if they decline the offer again the game continues and this time they select 4 cases and this cycle continues (reference to my chart on my first post showing the amount of cases picked each round).
i hope you now understand what i wish for this to do.
Last edited by koolnewb; Jan 20th, 2007 at 06:46 PM.
Okay I've downloaded both parts. When I ran it I found a few things that I would change if it were my program.
The blue text against the yellow/brown bitmap is hard to read so I'd make it some other color, and
I would change "Input, into the Text box Number of the Case you wish to be Yours" to something like "Please enter the Case (1 to 26) you wish to be yours", and
validate the in fact the user enters a number between 1 and 26
But you probably want me to help fix problems you already know about so please tell me exactly (with specific numbers, button clicks, etc.) what it takes to produce a wrong result, what that result is, and what it should be.
very good tips. i wanna keep the bitmap because it is the deal or no deal background, but i think im gonna change it.
Well as you saw in my program. When you click a case it sends you to a new form where the value of that case is displayed. and there is a command button entitled "OK" upon pressing this command button would be when the calculations are made. The number in the text box above it (the case value) would be subtracted from the overall total (3418416.01). THen the scoreboard appears and then it returns to the main form. the user clicks another case. they are sent to the caseval you form again. THe value of their case is displayed in the text box. THey press OK and the number in the text box is subtracted from the new total ( 3418416.01 - the value of the first case) scoreboard appears and then returns back to main form. This cycle continues. When 6 cases are open the current total (3418416.01
- the 6 case values) is divided by 20 (the number of remaining cases) creating the first offer which is displayed in the form entitled "Money" . if they accept the offer the game ends. If not the game continues and the user picks 5 cases this time. This cycle follows this order:
round 1. 6 cases till offer is generated
round 2. 5 cases till offer is generated
round 3. 4 cases till offer is generated
round 4. 3 cases till offer is generated
round 5. 2 cases till offer is generated
round 6. 1 cases till offer is generated
round 7. 1 cases till offer is generated
round 8. 1 cases till offer is generated
round 9. 1 cases till offer is generated
round 10. They take the value of their case.
I am currently working on the writeup for this project. My teacher said hed help me with this problem at school but your input would be extremely helpful. I will definatly use those tips you gave me
and again THanks for all you help throughout this weekend
well, with the code i have set up in the program i sent you
the result.. is nothing
nothing happens
the calculations arent made
and it doesnt recognize when a round is over
Most of the code i set up for this is in my module. I think the problem lies there. For some reason the code doesnt execute
the result i wish to happen is what i explained in my last post. For the value of the case (displayed in the Form "Caseval") to be subtracted from the overall total (3418416.01). after 6 casevalues were subtracted from the total it would be divided by the number of remaining cases.. and so on according to my last post.
sorry I am currently busy studying for exams. My teacher is planning to help me out after his exam so if i figure this problem out completely i will submit the answer on this forum
Id also like to thank you Martin very much for you help this past week
well i already had to submit it today (teacher will help me after his exam on friday), but for future reference i am not entirely sure how i would go about doing that and where i would input the code.