Help with BlackJack

I made this blackjack app for school, but for some reason, every time I generate four cards, the score does not work. I have tried everything I could think of to fix this, but the procedure is still not working. If I had to guess, it is something with either the parameter 'score' or the global variable 'randomNumbers'. I need help as soon as possible. Any and all assistance is appreciated.
blackJack2 (6).aia (5.1 MB)


I added this sequence because I could not see your number of players input text box in my emulator, and the game did not like empty input:
image

I notice further down in this game start sequence you are looking to make a list of 35 random unique card numbers? Where does the number 35 come from?
image

The handling of the loop index is wrong.

I shall fix it in the next post.

image

This is how to get 35 different random number from 1 to 52.

I can't see the input box for number of players.
But one player seems to work okay.
BTW, it's 'You lose', not 'You loose'
blackJack26.aia (5.1 MB)

Okay, there is a problem here too.

Looking further ...

This number 35 is an arbitrary limit I have gave in case any of the numbers in the loop were the same. Also thank you so much for helping your are so awesome!

Thank you again for all of your help I really appreciate what you have done for my program. I have figured out the solution to my problem. I hope to one day be at your level of code, I really respect what you have done for this community ABG, you inspire me to keep creating code. Just a little bit ago I was struggling with development and now I am an expert in my class. I give you and this community credit for my learning🙏. Below is the solution in case you were interested.


Thanks for the encouragement.

I fear you are not out of the woods yet.

The parameters of your stand procedure bother me.

The second parameter (text) is not used in the procedure.

The first parameter (score2) is overwritten, a dangerous practice.
Even worse, when you call the stand procedure for one of the 3 players, you pass it the score of that player. Yet the first thing you do on arrival is to set that parameter to the maximum of the 3 global score variables, score1, score2, score3.
There is a serious danger that you are increasing the score of the player who stood to match the highest of the other players' scores. That's not a Blackjack rule, as far as I know.

Maybe you have not yet learned about local variables yet?

I can't understand your intentions with that parameter.

You are completely right. I have been making wordle games for my friends in class since they are unable to do so and I wanted to make each one different and I started off by making a unlimited amount of hands the user can deal but once it got too complicated I just randomly filled information in the parameters and it got super complicated and instead of rewriting/deleting code I just keep adding to it. I originally calculated the max of the three to just calcualte the person with the best score's result but then my friend told me that he wanted me to give individual feedback. I revised the version I sent you. Below is the revised version along with the other BlackJack's I have made for my friends in addition to a Wordle code if you are interested. And I know that my code is useless at times I still need to work on optimization and I truthfully do not understand how to use local variables.
wordle_Check2.aia (95.3 KB)
tyler30.aia (5.1 MB)
blackJack (2) (1).aia (4.4 MB)
blackJack3 (1).aia (4.3 MB)
blackJack2_checkpoint1 (1).aia (5.1 MB)

Local variables and functions (value procedures) are great at reducing the complexity of your code.

They both help you get a handle on the data flow in your app.

Here's my version of Wordle, with commentary:

thank you again!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.