12-01-2024 03:41 PM
I finally was able to open your code. Here are some comments.
Bob Schor
12-01-2024 06:47 PM
Hi Bob,
Thank you very much for all your comments and directives to make it cleaner and readable.
I am not tryingto make a dart game but a dart score app. I have to have a numeric pad for the player to enter their score, Also, I haven't used any arrays yet. I used numeric buttons. I don't know if you familiar with dart scoring goes.
There are 2 main games ( 501 and 301).
players1 starts with 501 points. Throws 3 darts and add up the total wich will be substact from 501 ( ie 501 - 45 = 456 ) that will be saved untill his turn again
Then he will start from 456 not 501 and totals his 3 darts count and goes on untill whoever reach 0 first. I just gave the basic rundown as far as couting. the game is a little more complicated than that. Back to my problem is the fact that i cannot figure out the part where the substration happens and saving the score after every 3 darts. ( ie 501 - 45 -60 -22) untill his turn again. Try to run my vi untill you enter random score for player 1.You have to follow the notes in the ui
Thank you very much again
12-04-2024 03:45 PM
@soccerfan wrote:
Hi Bob,
Thank you very much for all your comments and directives to make it cleaner and readable.
I am not tryingto make a dart game but a dart score app. I have to have a numeric pad for the player to enter their score,
The score is a number (in fact, an integer). If you make a Front Panel Control by dropping a "Numeric Control" from the Numeric Palette, it will put down a Floating Point Control (you can tell it is a Float because it is Orange on the Block Diagram). Go to the Block Diagram, right-click the Control, choose "Properties", make it an I32 (32-bit Integer), and notice it turns dark Blue (guess what that means). Now double-click the name ("Numeric") and make a "User-sensible name" such as "Score" or "Points" (or whatever is appropriate). Let LabVIEW do the "hard work" of assembling single digits into a number for you. You can type "123<backspace><backspace>45<enter>" to enter "145" (the two backspaces "erase" the previous 3 and 2 characters, and the <enter> "sets the numeric value" to "145").
Also, I haven't used any arrays yet. I used numeric buttons. I don't know if you familiar with dart scoring goes.
There are 2 main games ( 501 and 301).
players1 starts with 501 points. Throws 3 darts and add up the total wich will be substact from 501 ( ie 501 - 45 = 456 ) that will be saved untill his turn again
There are several ways to manage a "turn". You throw three darts, one at a time. This suggests you enter 3 scores, which (in turn) suggests a For Loop with 3 wired to "N". Inside the Loop, you read one score (see above) and bring its value out of the loop in an "indexing tunnel" (which looks like an open square with a pair of brackets, "[ ]", inside it). This creates an Array of the three Scores you just entered.
Now you can sum these three numbers (look in Array Palette for "Sum") and subtract it from the "Current Score" which is being held in a Shift Register (with 501, or whatever the starting Score is wired to the outside of the While Loop that controls the entire game).
I'm sure there are more rules to incorporate (for example, what if your current score is 25, and you throw 10, 15, and 20 -- if you need to use all three scores, you zoom past zero! But you know the rules, so you can build them into your code (like have the game end and say "Ha, ha, you overshot, I win!!!".
Then he will start from 456 not 501 and totals his 3 darts count and goes on untill whoever reach 0 first. I just gave the basic rundown as far as couting. the game is a little more complicated than that. Back to my problem is the fact that i cannot figure out the part where the substration happens and saving the score after every 3 darts. ( ie 501 - 45 -60 -22) untill his turn again. Try to run my vi untill you enter random score for player 1.You have to follow the notes in the ui
Thank you very much again
12-04-2024 11:43 PM - edited 12-04-2024 11:48 PM
Hello again,
Floating Point Control (you can tell it is a Float because it is Orange on the Block Diagram
It doesn't show orange on my side. It's purple ( string controls)
You throw three darts, one at a time. This suggests you enter 3 scores, which (in turn) suggests a For Loop with 3 wired to
But you score the total of your 3 darts ( not one at the time) you can't move from the throw line untill you throw all the darts and then you walk to the score board and enter
your total . If your not good at math then you use the add button and total your 3 darts one at the time
'm sure there are more rules to incorporate (for example, what if your current score is 25, and you throw 10, 15, and 20 -- if you need to use all three scores, you zoom past zero!
It is called a "bust" and you come back to the previous score
I am aware of all the theory that you mentionned. However, i am stuck in the practicality of things. I appreciate if you open my block diagram and show me were things went wrong (not the whole project but only the user input and substraction). There are a lot of work still to be done
Thank you for your tiime