No other word is required. Code that is not executed is ignored. It's a simple as that.
BTW I carefully checked the Debug.Print list of cards in the deck and there are no duplicates, so if you still think you have a problem please let me know.
Printable View
Bad news...
I went through my email archives just now, and downloaded just now what technorobbo created last spring, and it turns out he did the same error with regards to having an Ace as a base card, and on the second turn, I called it lower than the Ace, and although the result was a 6, it set off the LowerWrongCards token instead of the LowerRightCards token.
I think this may be where resetting the base card to where the first card was revealed or where the player froze on, and skipping in the sequence 5 cards ahead for the second play, 10 cards ahead for the third play, and 15 cards ahead for the fourth play of the round is probably a good idea.
It turns out that the Shuffle sub, although technorobbo's version only has the Shuffle sub in the GameEssentials module and not the form, is not the problem. It may have to do with the sequence of the cards in the display window on the bottom of the screen.
I'll send you what technorobbo did last spring by PM tomorrow and see what can be done with regards to resetting the CurrentCard to the first slot of the freeze card slot, and skipping ahead 5, 10, and 15 cards in the sequence.
Duplicate post due to delay in posting. Removed by JonSea31.
Okay I need some help from you. To debug the "Ace first" error you decribed I did this in shuffle.
Since card 12 is the Ace of Spades, that line should result in the Ace of Spades being the first card in the deck and it does. Proof of that is if I do MsgBox NameCard(rand(0)) I get "Ace of Spades). However the first card that shows up is the Ace of Clubs and I can't figure out why that is.Code:Private Sub Shuffle()
Dim X As Integer, i As Integer, j As Integer
'load the deck
For i = 0 To 51
rand(i) = i
Next
Randomize
'shuffle
For i = 0 To 51
X = Int(Rnd() * 51) + 1
j = rand(i)
rand(i) = rand(X)
rand(X) = j
' Debug.Print rand(i) & " ";
Next
'test
rand(0) = 12
For i = 0 To 51
Debug.Print NameCard(rand(i))
Next
End Sub
BTW even if the wrong ace shows up, if I choose "Lower" the sub that gets executed is, correctly, LowerRightCards.
I see what is wrong with the Ace of Spades. Your sa.bmp which should be a picture of the ace of spades is actually a picture of the ace of clubs. You should check the rest of the pictures to make sure they are right.
So I say again, I don't see any problem with the dealing of the cards.
Innocent mistake on my part. The spade symbol in the center of the Ace of Spades is traditionally larger in size than in other spade cards. That's probably why I forgot about it. I will fix that tomorrow.
And btw, when you got the card (the 6) successfully lower than the Ace, was that on your second play of the red or blue turn?
Maybe you should record the cards revealed on the red or blue row during the first turn on a document and then record the results of the second turn. Try that several times and you may see results.
I just did a test run on technorobbo's version - this time with the debug to show the names of the cards in the display window.
They only reveal the cards in order as they appear in the display window. When a player regains control of the cards, it continues from the last card revealed on the red or blue row and not from the base card.
I wonder if there is a way to manipulate the card sequence so that there can be a resetting of the base card value (or freeze card value) in the sequence, and skipping of the cards that were already revealed when that player already had a turn at the cards? Like the Private Function SeqControl area can be changed to accommodate such resetting and skipping?
Here is some of the code I have that may be manipulated to accommodate such resetting and skipping:
Image1 in this case would be the RCard, and Image2 would be BCard.Code:Private Function SeqControl(i As Integer) As Control
If i < 5 Then
Set SeqControl = Image1(i)
Else
Set SeqControl = Image2(i - 5)
End If
End Function
To allow for resetting to the base card/freeze card value, this is where the "minus" would come into play. And to allow for skipping of cards already used in the deck, this is where an equation with the "+" may come in handy.
I also noticed in technorobbo's form that there is only one deck of cards being shared between the red and blue players. There should be two separate decks - one for the red player, and one for the blue player. What should I do to allow for two decks - one for each player?
You now have a "deck" of cards called rand(). Two have two decks I would
- globally change rand (using the Find Whole Word Only option) to something like BlueCards
- create a second array called RedCards()
- rename Shuffle to ShuffleBlueCards
- create a ShuffleRedCards sub
- you would also need to duplicate and use whatever pointer(s) you have that tell you where you are in the decks, etc.
After that if you still have a "base card" problem, could you please send me new files and a link to a video showing what you mean because I don't understand the problem.
I wonder if there's a way to zoom the video recording to show a close-up of the display window when needed. I have CamStudio that I use to record such videos.
I will send you a fresh updated set of files along with a video upload in the coming days.
It does sound possible that you could make the Video Control to be zoomable???
Maybe if I show where the problem exists in a video demonstration, you folks may be able to see what is wrong with the coding.
And like I said, it is possible it may have to do with the sequence of cards and how there may have to be resetting of the base card or freeze card value, and for second, third, or fourth playings of the cards there may have to be skippings of 5, 10, and 15 cards respectively. It doesn't have to reveal the cards in that exact same order in the sequence as displayed in the display window.
So, ThEiMp, if you can see the problem in the video, are you willing to return to the project and give this a try again?
Well since you are going to have two (I assume) unrelated decks then having CurrentRedSlot and CurrentBlueSlot would be a good idea.
During the past few days, I've been doing a major revamp of the code, and I did add the two decks of cards - one for each coloured player.
I even added the CurrentBlueSlot and the CurrentRedSlot areas as well.
I'm also experimenting with developing the Educated Guess questions (they are general knowledge questions that can allow for answers larger than 99). I am hoping to allow for the following to occur during these questions:
1. To have the digits appear to be typed on the podium (just like on the television screen) digit for digit, from left to right.
2. Also, I will be developing a green banner that will animate and drop towards the contestant podium (not exactly as it would appear on the show, but close enough as it gets).
I also discovered that, when decks of cards are being used for a test run, the first test run is okay - it displays two decks of cards in the display window (the first 52 cards are the red player, the latter 52 cards are the blue player). But when I do a second test run, an additional deck is added to the 2 decks, hence displaying 3 decks of cards instead of 2. This should not be.
Once the revamp is done, I will create a video and upload it to YouTube, and I will provide captions to show what the problem is, and maybe you can determine if it's a sequence issue or not.
Okay.
Okay, I did a test run just after opening the project file, and I can see what is going on.
Doing the first test run after immediately opening the project file means that the cards run more smoothly and the right sub is set off.
Before I played the cards, I copied/pasted the entire card sequence from the display window. The first 52 card values are for the blue deck, and the second set of 52 are for the red deck. Here is the result from the blue player's first play at the cards.
BLUE FIRST PLAY:
Then the result for the red player's free shot at the cards:Code:8 of Hearts = CHANGE TO NEXT CARD
4 of Hearts = CALL LOWER
Queen of Diamonds = LAST CARD RECORDED = SHOULD RESET BACK ONE CARD
8 of Clubs
Jack of Diamonds
4 of Clubs
5 of Spades
7 of Spades
9 of Diamonds
King of Clubs
Ace of Diamonds
2 of Clubs
10 of Clubs
Ace of Spades
2 of Spades
4 of Diamonds
7 of Clubs
6 of Clubs
3 of Diamonds
9 of Spades
6 of Spades
10 of Hearts
3 of Hearts
Jack of Clubs
2 of Diamonds
5 of Hearts
10 of Spades
3 of Spades
King of Hearts
9 of Clubs
Jack of Hearts
7 of Hearts
Jack of Spades
8 of Spades
4 of Spades
6 of Diamonds
8 of Diamonds
3 of Clubs
5 of Diamonds
Ace of Hearts
Queen of Clubs
Ace of Clubs
10 of Diamonds
6 of Hearts
5 of Clubs
King of Diamonds
9 of Hearts
7 of Diamonds
King of Spades
2 of Hearts
Queen of Hearts
Queen of Spades
RED FIRST PLAY:
Continued in next post...Code:9 of Clubs = CALL HIGHER
5 of Clubs = HIGHERWRONGCARDS SUB SET OFF, BASE CARD SHOULD RESET BY STEPPING BACK ONE CARD
2 of Clubs
10 of Hearts
6 of Clubs
3 of Hearts
10 of Clubs
King of Diamonds
4 of Spades
King of Clubs
5 of Diamonds
7 of Clubs
2 of Diamonds
King of Hearts
3 of Spades
2 of Hearts
8 of Spades
2 of Spades
Queen of Diamonds
Queen of Spades
Ace of Diamonds
Ace of Hearts
6 of Diamonds
4 of Hearts
Jack of Spades
8 of Clubs
Jack of Hearts
4 of Clubs
Jack of Clubs
8 of Hearts
Ace of Clubs
3 of Clubs
7 of Spades
6 of Spades
10 of Diamonds
5 of Hearts
7 of Hearts
Jack of Diamonds
9 of Diamonds
10 of Spades
7 of Diamonds
6 of Hearts
9 of Hearts
3 of Diamonds
5 of Spades
Queen of Clubs
9 of Spades
4 of Diamonds
Ace of Spades
8 of Diamonds
Queen of Hearts
King of Spades
Now, the red player wins the second question, and the red player has a shot at the cards. Here is the result from the red player's second play of the cards:
RED SECOND PLAY:
And now, the blue player has a free shot at the cards:Code:9 of Clubs = CHANGE TO 2 OF CLUBS
5 of Clubs = LAST CARD RECORDED, SHOULD BE IGNORED
2 of Clubs = CHANGED FROM THE 9 of CLUBS, CALL LOWER
10 of Hearts = LOWERWRONGCARDS SUB SET OFF = SHOULD BE RESET BACK TO THE 2 OF CLUBS (Line #1 Card Value)
6 of Clubs
3 of Hearts
10 of Clubs
King of Diamonds
4 of Spades
King of Clubs
5 of Diamonds
7 of Clubs
2 of Diamonds
King of Hearts
3 of Spades
2 of Hearts
8 of Spades
2 of Spades
Queen of Diamonds
Queen of Spades
Ace of Diamonds
Ace of Hearts
6 of Diamonds
4 of Hearts
Jack of Spades
8 of Clubs
Jack of Hearts
4 of Clubs
Jack of Clubs
8 of Hearts
Ace of Clubs
3 of Clubs
7 of Spades
6 of Spades
10 of Diamonds
5 of Hearts
7 of Hearts
Jack of Diamonds
9 of Diamonds
10 of Spades
7 of Diamonds
6 of Hearts
9 of Hearts
3 of Diamonds
5 of Spades
Queen of Clubs
9 of Spades
4 of Diamonds
Ace of Spades
8 of Diamonds
Queen of Hearts
King of Spades
BLUE SECOND PLAY:
Maybe the problem all along is that when I keep the project file open and do more than one test run, unnecessary but additional cards or decks accumulate on top of each other and therefore cause the test runs to go haywire. I even discovered 200 card values in the display window at times, in fact!Code:8 of Hearts = CHANGE
4 of Hearts = CURRENT CARD VALUE SHOULD BE RESET HERE = CALL HIGHER, SHOULD GO TO LINE #4 IN SEQUENCE
Queen of Diamonds = LAST CARD RECORDED = SHOULD BE SKIPPED
8 of Clubs = DING SOUND EFFECT PLAYS, CALL HIGHER
Jack of Diamonds = DING SOUND EFFECT PLAYS, CALL LOWER
4 of Clubs
5 of Spades
7 of Spades
9 of Diamonds
King of Clubs
Ace of Diamonds
2 of Clubs
10 of Clubs
Ace of Spades
2 of Spades
4 of Diamonds
7 of Clubs
6 of Clubs
3 of Diamonds
9 of Spades
6 of Spades
10 of Hearts
3 of Hearts
Jack of Clubs
2 of Diamonds
5 of Hearts
10 of Spades
3 of Spades
King of Hearts
9 of Clubs
Jack of Hearts
7 of Hearts
Jack of Spades
8 of Spades
4 of Spades
6 of Diamonds
8 of Diamonds
3 of Clubs
5 of Diamonds
Ace of Hearts
Queen of Clubs
Ace of Clubs
10 of Diamonds
6 of Hearts
5 of Clubs
King of Diamonds
9 of Hearts
7 of Diamonds
King of Spades
2 of Hearts
Queen of Hearts
Queen of Spades
I can see why you haven't had any problems on your side, Marty. And now, I may be starting to see the light. Maybe the sequence should be kept at a maximum of 2 decks of cards per game (total of 104 cards in the display window) for an infinite number of test runs.
I'll send you the updated files tomorrow, as I have another problem to discuss in the morning with regards to the red player winning the first question and revealing the red player's first card of the round, and getting an "Invalid Picture" error as the card is supposed to be revealed.
When you talk about the "display window" do you mean the Immediate Window (the window that pops up if you do ctrl-g)? If so I assume you know that that window does not clear itself and that whatever was generated there by Debug.Print statements or anything else will be appended to. (Anything over 200 lines gets pushed off off the top). You can clear the Immediate window by giving it focus, pressing Ctrl-A, and the delete.
If you are really getting more than two decks generated then put a breakpoint at the first executable line in the sub(s) that create (not shuffle) the deck and look at the Call Stack to see why it gets there more than you want.
Yes, that would be the one.
I don't intend to clear the immediate window. Thanks for reminding.Quote:
Originally Posted by MartinLiss
What sub do I put the breakpoint in? The ShuffleRed(or Blue)Cards sub? The Form_Load sub?Quote:
Originally Posted by MartinLiss
And what I was wondering, I would like for there to be a total of only 104 lines in the display window and nothing beyond during every test run. That's what I am trying to clarify.
In the meantime, an updated folder will be delivered later today so that the "Invalid Picture" error would be resolved.
How many Debug.Print statements do you have in the program and where are they?
Now that you mention it, I know they are located in the ShuffleRed(/Blue)Cards subs. After doing a find on the Debug.Print, there are only two such lines and they appear in both ShuffleRedCards and ShuffleBlueCards subs.
I just put a breakpoint on the line just below the "Dim ___ As Integer, etc." line, and the call stack showed this:
CSEE.CS1.ShuffleBlueCards
CSEE.CS1.Form_Load
I did do a test run last weekend with technorobbo's copy, and there were still 2 decks of cards involved but in one Shuffle sub. So odds are, maybe it's possible that only one Shuffle sub may be needed, but has to be in the same form.
Although I did try that in the form or the GameEssentials6 module, and all I ended up with in the display window was all the cards being 2 of Spades.
I can send you both technorobbo's version along with mine later on if you wish, and you can compare both versions to notice the difference.
Without seeing your current code I'm guessing, but I'm pretty sure that you don't have more than two decks. You may be shuffling more than you think you are and if that's the case then that's why it looks like you have >2 decks.
And as to one or two shuffle subs, you need two shuffle subs if the red and blue decks can run out of cards at different times and I assume that that is what can happen.
I'm only shuffling more than I think because I am using a total of 104 cards (in 2 decks) during the first test run. But all subsequent test runs after that go beyond 104 cards.
I copied and pasted the sequence from both the first test run and the second test run onto a Microsoft Word document, and numerated them.
Here is the sequence from the first test run:And here is the sequence from the second test run:
- 2 of Diamonds
- 9 of Hearts
- 8 of Spades
- 7 of Clubs
- 4 of Spades
- Ace of Hearts
- 5 of Diamonds
- 2 of Clubs
- Queen of Hearts
- 6 of Clubs
- Ace of Spades
- 10 of Hearts
- 5 of Spades
- Queen of Clubs
- 10 of Clubs
- 6 of Diamonds
- 7 of Hearts
- 8 of Clubs
- 3 of Diamonds
- 3 of Spades
- 2 of Spades
- 9 of Diamonds
- Jack of Clubs
- 10 of Spades
- 6 of Hearts
- King of Diamonds
- Jack of Spades
- Queen of Diamonds
- King of Spades
- Ace of Clubs
- 5 of Hearts
- 8 of Hearts
- 4 of Diamonds
- King of Hearts
- 7 of Diamonds
- 4 of Hearts
- Ace of Diamonds
- Jack of Hearts
- 9 of Clubs
- Jack of Diamonds
- 6 of Spades
- 10 of Diamonds
- 5 of Clubs
- 3 of Clubs
- 7 of Spades
- 9 of Spades
- King of Clubs
- 3 of Hearts
- 8 of Diamonds
- 4 of Clubs
- Queen of Spades
- 2 of Hearts
- King of Clubs
- 6 of Clubs
- Jack of Diamonds
- 7 of Spades
- 3 of Clubs
- 10 of Clubs
- 4 of Hearts
- 3 of Hearts
- Jack of Hearts
- 9 of Spades
- Queen of Clubs
- Queen of Hearts
- Ace of Hearts
- 5 of Hearts
- Ace of Spades
- 5 of Diamonds
- 5 of Clubs
- 4 of Diamonds
- 8 of Spades
- Jack of Clubs
- 3 of Diamonds
- 4 of Clubs
- 3 of Spades
- 7 of Clubs
- 10 of Spades
- 8 of Diamonds
- Queen of Diamonds
- 8 of Clubs
- 8 of Hearts
- 6 of Hearts
- Ace of Diamonds
- 6 of Diamonds
- 9 of Clubs
- Queen of Spades
- King of Diamonds
- 10 of Hearts
- 5 of Spades
- 2 of Hearts
- 2 of Clubs
- 7 of Diamonds
- 6 of Spades
- 4 of Spades
- 9 of Diamonds
- 9 of Hearts
- 2 of Spades
- 10 of Diamonds
- Jack of Spades
- King of Hearts
- King of Spades
- Ace of Clubs
- 2 of Diamonds
- 7 of Hearts
- 2 of Clubs
- 6 of Clubs
- Jack of Diamonds
- Queen of Clubs
- 9 of Hearts
- 7 of Spades
- 6 of Hearts
- 7 of Hearts
- King of Clubs
- 2 of Spades
- 2 of Diamonds
- 4 of Hearts
- Queen of Diamonds
- 5 of Spades
- Ace of Hearts
- 6 of Spades
- 5 of Hearts
- 10 of Spades
- Jack of Hearts
- 8 of Hearts
- 2 of Hearts
- 5 of Clubs
- Jack of Clubs
- King of Hearts
- 7 of Clubs
- 6 of Diamonds
- 9 of Diamonds
- King of Diamonds
- 9 of Spades
- 3 of Clubs
- Ace of Spades
- 8 of Diamonds
- King of Spades
- 3 of Hearts
- Jack of Spades
- 7 of Diamonds
- 8 of Clubs
- 10 of Diamonds
- 9 of Clubs
- 10 of Clubs
- Ace of Diamonds
- Queen of Spades
- 3 of Diamonds
- Ace of Hearts
- 9 of Hearts
- 7 of Spades
- 6 of Diamonds
- Ace of Spades
- Queen of Clubs
- 3 of Hearts
- Queen of Spades
- 10 of Spades
- 7 of Diamonds
- 8 of Hearts
- 5 of Hearts
- 2 of Clubs
- 8 of Diamonds
- 8 of Spades
- King of Clubs
- Jack of Clubs
- 8 of Clubs
- 6 of Clubs
- 4 of Diamonds
- 6 of Hearts
- 10 of Clubs
- 4 of Clubs
- Ace of Clubs
- 9 of Clubs
- Ace of Diamonds
- 10 of Diamonds
- Jack of Spades
- King of Diamonds
- 6 of Spades
- 9 of Spades
- Jack of Diamonds
- 5 of Spades
- King of Hearts
- 2 of Diamonds
- Queen of Diamonds
- Queen of Hearts
- 3 of Clubs
- King of Spades
- 7 of Clubs
- 4 of Hearts
- 5 of Diamonds
- Jack of Hearts
- 3 of Spades
- 5 of Clubs
- 9 of Diamonds
- 7 of Hearts
- 2 of Hearts
- 4 of Spades
- 10 of Hearts
- 3 of Diamonds
- 2 of Spades
- 2 of Diamonds
- 9 of Hearts
- 8 of Spades
- 7 of Clubs
- 4 of Spades
- Ace of Hearts
- 5 of Diamonds
- 2 of Clubs
- Queen of Hearts
- 6 of Clubs
- Ace of Spades
- 10 of Hearts
- 5 of Spades
- Queen of Clubs
- 10 of Clubs
- 6 of Diamonds
- 7 of Hearts
- 8 of Clubs
- 3 of Diamonds
- 3 of Spades
- 2 of Spades
- 9 of Diamonds
- Jack of Clubs
- 10 of Spades
- 6 of Hearts
- King of Diamonds
- Jack of Spades
- Queen of Diamonds
- King of Spades
- Ace of Clubs
- 5 of Hearts
- 8 of Hearts
- 4 of Diamonds
- King of Hearts
- 7 of Diamonds
- 4 of Hearts
- Ace of Diamonds
- Jack of Hearts
- 9 of Clubs
- Jack of Diamonds
- 6 of Spades
- 10 of Diamonds
- 5 of Clubs
- 3 of Clubs
- 7 of Spades
- 9 of Spades
- King of Clubs
- 3 of Hearts
- 8 of Diamonds
- 4 of Clubs
- Queen of Spades
- 2 of Hearts
- King of Clubs
- 6 of Clubs
- Jack of Diamonds
- 7 of Spades
- 3 of Clubs
- 10 of Clubs
- 4 of Hearts
- 3 of Hearts
- Jack of Hearts
- 9 of Spades
- Queen of Clubs
- Queen of Hearts
- Ace of Hearts
- 5 of Hearts
- Ace of Spades
- 5 of Diamonds
- 5 of Clubs
- 4 of Diamonds
- 8 of Spades
- Jack of Clubs
- 3 of Diamonds
- 4 of Clubs
- 3 of Spades
- 7 of Clubs
- 10 of Spades
- 8 of Diamonds
- Queen of Diamonds
- 8 of Clubs
- 8 of Hearts
- 6 of Hearts
- Ace of Diamonds
- 6 of Diamonds
- 9 of Clubs
- Queen of Spades
- King of Diamonds
- 10 of Hearts
- 5 of Spades
- 2 of Hearts
- 2 of Clubs
- 7 of Diamonds
- 6 of Spades
- 4 of Spades
- 9 of Diamonds
- 9 of Hearts
- 2 of Spades
- 10 of Diamonds
- Jack of Spades
- King of Hearts
- King of Spades
- Ace of Clubs
- 2 of Diamonds
- 7 of Hearts
The first test run shows 104 cards (the equivalent of 2 decks of cards). The first 52 cards in that sequence is designated for the Blue Player and the latter 52 are for the Red Player.
The second test run shows 199 cards (beyond the maximum that should be used), and as a result it causes the code to go haywire and I get the wrong sub set off when I call a card higher than a 3, and although it is a 9, the HigherWrongCards sub is set off when it should be the HigherRightCards sub.
I can see why it is important for me to just do one test run, then close the project, then reopen it again, and do another test run. I will do a series of test runs over the coming days (opening the project once, test-running it, and closing the project afterwards) and see what results come out of it.
I apologize for the really long post, but I was just providing an example.
Please send me the app as it is now.
Actually, I just realized there are several things that have to be added/changed.
- The font used in the first question will involve a different font, and will allow for larger numeric answers (in this case, up to 4 digits). I will be adding the numeric answers for this question type to appear as if it was being typed on the podium. I will need some help for this.
- I will also be adding a new font resource to the code so that the exact font will be shown in that particular label.
- I will also be adding an animated banner that will drop towards the top of the contestant podium revealing the answer during this question type. It won't be exactly like it appears on the show (where on the show, the banner zooms inward), as it would take a lot more work. I don't have to make this game all exactly like the show, but to make it close enough.
- Also, I haven't gotten around to creating the Ace of Spades card that was miscreated (I unintentionally used a duplicate Ace of Clubs instead). I will work on that very soon.
- And the problem with regards to the "Invalid Picture" error message, when receiving the new files, have the red player guess the number "1" and the blue player guess lower. The red player will win control at the cards, and just as the card is expected to be revealed, the "Invalid Picture" error message pops up. This error message doesn't prevail when the blue player wins the question and wins first control of the cards.
The newly updated files will be sent by the weekend. :)
Well, there are a couple of things I mentioned in my previous post that I had to do before I send the updated copy that I had just completed:All the work I have to do this time around would be adding the font resource to the code as well as adding the appropriate font to the main folder (as mentioned in #2). The rest of what I mentioned (#1 and #5) I will need some help on.
- I got #3 completed just now - the animated banner is added to the form and its code for the educated guess questions just now. It was a new thing for me to learn, and I learned it myself! You'll be impressed by the animation I created when you receive the latest update.
- Also, #4 is scratched off the list, as I created the Ace of Spades (with the traditional "giant" Spade symbol in the center) card that is needed.
It looks like this folder will be sent to you much sooner. Possibly by tomorrow, most likely.
I just added the font resource and the new font is now in the folder. Look for an updated folder by PM tomorrow morning!
Sent the updated form to you, Marty. :)
Also, there are significant enhancements to the game that you might want to check out!
Invalid picture solved!
Code:Public Sub RevealFirstRedCard()
'Marty
LoadCards "Cards"
'rest of the code
Lets now talk about the subsequent test runs going beyond 104 cards problem.
The first thing I need to know is what exactly is a "second test run"? That may sound like a silly question but I don't know for sure what you mean by a "test run". What I assume you mean is that a test run starts with you starting the program answering some questions, etc and then closing the program. So a "second test run" would be doing that again. Is that what you mean? Because if it is I'm confused because there is absolutely no way that your app could deal too many decks or cards the second time if it doesn't do it the first time.
Thanks!
Now the only problem that remains is the card sequence issue. For that, I will compile the updated code into an EXE, and do some test runs with that EXE file. If no problems prevail, then the problem was already solved.
As of the most recent testing, the red player had a 3 to start. Called it lower, and (surprisingly) got a 2. Called it lower than a 2 (intentionally), and got a king.
When that same red player won the next question, he had to start from the 3. He called it higher. The last card recorded was a King, and although the result was a Queen, the right sub was activated (the HigherRightRedCards sub).
As of right now, it looks promising. It's possible that with more than one test run in the Project file while that project file is still open, the number of cards that are displayed in the display window does happen to exceed the maximum 104 that should prevail.
A couple of more test runs, and if they pass, I will safely declare the biggest problem with the game solved. Then it is smooth sailing from there on in.
Could you please explain what you mean when you say "It's possible that with more than one test run in the Project file while that project file is still open, the number of cards that are displayed in the display window does happen to exceed the maximum 104 that should prevail". Because again I'm not sure what "more than one test run in the Project file" means.
A "test run" is opening the project file, and clicking the "start" button to test the game. The "start" button is the one with the triangle near the top of the screen (it should be near the Pause and the Stop buttons).
You can also do a test run by going to the "Run" menu, and selecting "Start" or "Start with full compile."
You can "start" the run by clicking the "start" button, and you can stop it at any time by clicking the button with the square on it, as well you can pause the run. After you click "stop", you can "start" the run again by clicking "Start."Quote:
Originally Posted by MartinLiss
So I guess what I meant by "test run" was probably confusing, and I am sorry for not being clear enough.
Okay so when you talk about a test run you mean starting the app and in that case as I said previously there is absolutely no way that your app could deal too many decks or cards the second time if it doesn't do it the first time. I believe what you are seeing in the Immediate window is just some values left over from the previous test and they have no effect whatsoever on the current test. To avoid confusion you could (between test runs) set focus to that window, click ctrl-A and then click Delete.
Some things I've noticed.
1)
In your DealBlueCard and DealRedCard subs you don't use i, X or OldSlot you also have code that checks to see if BlueCards(currentCard) > 51 and I don't think that that's ever possible. Also you have code in two places that checks to see if the deck needs to be shuffled so I think DealBlueCard could (and probably should) be changed to
and similar for DealRedCard. You'll also of course have change how those subs are called because there is now just one parameter.Code:Private Function DealBlueCard(Ctrl As Control) As Integer
Ctrl.Picture = cards(BlueCards(currentCard))
Picture1.AutoRedraw = True
Picture1.PaintPicture Ctrl.Picture, Ctrl.Left, Ctrl.Top
Picture1.AutoRedraw = False
Ctrl.Tag = BlueCards(currentCard)
currentCard = currentCard + 1
If currentCard > 52 Then ShuffleBlueCards 'Note I changed this to 52 (that's correct right?)
Me.Refresh
DealBlueCard = Ctrl.Tag Mod 13
End Function
2) In Form_Load I found
which should be changed toCode:Picture1 = LoadPicture(App.Path & "\cards\bkgd-bothdim.bmp")
3) In your BlueHigherRight and similar subs you have the following code repeated 13 times.Code:Set Picture1.Picture = LoadPicture(App.Path & "\cards\bkgd-bothdim.bmp")
and you could just have a Dim lngIndex As Long and then replace those 13 occurrences with this one loopCode:BlueHigher.Visible = True
Set Picture1.Picture = BLBkgdFlash
Wait 200
BlueHigher.Visible = False
Set Picture1.Picture = BkgdBothDim
Wait 200
4) I have a piece of software that let's me analyze the code in a project and when I ran it against yours it told me that you have four command buttons that don't have code in their Click events and they are:Code:For lngIndex = 1 to 13
Set Picture1.Picture = BLBkgdFlash
Wait 200
BlueHigher.Visible = False
Set Picture1.Picture = BkgdBothDim
Wait 200
Next
btnBPlayCds
cmdBPassCds
cmdRPassCds
cmdRPlayCds
It also pointed out that you have several "dead" procedures (in other words not used) and they are:
cmdRChangeCd_Click
cmdBChangeCd_Click
btnPlayBCds_Click
btnPlayRCds_Click
LastCardRedWin
LastCardBlueWin
SetRDEGNumber
SetBLEGNumber
RedFreezeBar
BlueFreezBar
Comparing those two lists points out that in the case of btnBPlayCds in the first list and btnPlayBCds_Click in the second that you have forgotton to complete a name change.
If the rest of the procudures in the 2nd list aren't needed any longer then you should delete them.
Another thing. If I answer the first question with a number > 9999 it tells me that the "Answer must be between 0 and 9999" however it lets the game proceed. To prevent that you should add an Exit Sub as shown below.
You also don't use "i" in that sub so you should delete the Dim for it. You should look at your other similar subs and add Exit Sub statements if needed.Code:Private Sub cmdEnterEGR_Click()
Dim i As Integer
If Val(txtGuess.Text) < 0 Then
MsgBox "Answer must be between 0 and 9999."
cmdEnterRegR.Enabled = True
ElseIf Val(txtGuess.Text) > 9999 Then
MsgBox "Answer must be between 0 and 9999."
cmdEnterRegR.Enabled = True
Exit Sub
Else
'~~~> Your text or question
strTemp = txtGuess.Text '-- If you don't set it no text can be animated!
n = 1
Timer7.Enabled = True
Timer7.Interval = 200
cmdEnterRegR.Enabled = False
cmdEnterRegR.Visible = False
End If
Me.Refresh
WhosTurn = BluePlayer
AskHigherLowerEGBlue
End Sub
Another problem with that sub is that a player can answer with, say, "four" instead of "4". When that happens Val(txtGuess.Text) is zero so the guess is treated as if the user entered zero. If you'd like to be able to prevent that (and also prevent a minus sign from being entered) then add this sub
The user could still paste an invalid value into txtGuess and if you want to prevent that then let me know.Code:Private Sub txtGuess_KeyPress(KeyAscii As Integer)
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
End If
End Sub
Actually, 3 of the "dead" procedures (cmdBPassCds, cmdRPassCds, and cmdRPlayCds) are only there because they will be used eventually in other questions.
Also, a brief explanation on some of the following "dead" code as displayed in green text:
Other than that, thanks for the most recent tips!Quote:
Originally Posted by MartinLiss
Actually cmdRChangeCd_Click and cmdBChangeCd_Click aren't used because you don't have controls with those names. You have instead cmdChangeRCd and cmdChangeBCd.
Here's a picture of what my software pointed out as dead constants and declarations. They can be deleted.
Attachment 75855
and these are dead variables.
Attachment 75856