01-03-2020 08:39 AM
Hey Guys,
I have attached the code below. I am interested in specifically the double case structure towards the right side of the screen. I am pretty familiar with using language similar to "i = i+1" so naturally I use a lot local variables. But I need to begin to simplify with labview, I know it is important use local variables/ property nodes only when necessary. I know I need shift registers, but I need some suggestions on how to simplify this code. Thanks for your help.
Solved! Go to Solution.
01-03-2020 08:54 AM
Sequence Structures usually scream that you need to look at using a State Machine.
Related, the waits are not necessary since you already have user interactions handled with popups and/or Event Structures.
The Timeout event should not be needed. I think you can just replace it with a Reset button's value change event. The logic for going over should be moved to the Hit value change event.
For the dealer, the logic should cover if they beat the player (either the player went over or the dealer already has a higher value) or the dealer went over. That is the main advantage of being dealer in Black Jack.
But, yes, all of your local variables could easier be handled with Shift Registers, especially in a well designed state machine.
01-03-2020 08:58 AM
Thanks for being concise, will make the updates.