From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
10-16-2016 10:29 PM
I need to create a Yahtzee game on Labview. I figured out the entire way to generate random numbers but I need to find a way so that the User can stop certain numbers from rolling so that they get their 3 times to try to get highest numbers they can. Here is a preview of the program. Any tips?
https://postimg.org/image/uk5gz70oj/
10-17-2016 07:33 AM - edited 10-17-2016 07:33 AM
You will want an array of buttons stating which elements to leave alone. Then just use a case structure so that you do not replace elements you want to keep.
10-17-2016 10:44 AM
I'm confused on whats going on with left side of your picture. What are these current values?
10-17-2016 10:49 AM
That is an array constant to give initial values to your dice.
(You can't replace the value of an array, if there wasn't an array element there to begin with.)
10-17-2016 11:09 AM
@djcdominic wrote:What are these current values?
It is mostly just a place holder. In theory, you will be storing those values in a shift register on your outside loop.
10-17-2016 01:42 PM - edited 10-17-2016 01:42 PM
OK so I have fixed it up a bit. I still have problems with the following:
-Keeping the value on the screen once locking it to the array
-System ending once all Three rolls are completed
Thank you guys so much.
Here is how it looks now. What should I fix?
10-17-2016 02:04 PM - edited 10-17-2016 02:06 PM
Your array constants are empty. Crossrulz's are not empty and consist of 5 zeroes.
(His image is a snippet. Drag that image to your desktop. Then drag the image to your block diagram. Now you have is code.)
Also, you have 5 copies of that code. Notice he only has 1 copy and he is working on an array of 5 "dice" and 5 boolean switches for what to keep.
Also, I think you have too many loops, that or they are in the wrong order. Right now if you hit okay, the inner For Loop executes 3 times without ever giving the user a chance to check or uncheck which dice they want to keep. Your outermost while loop shoud have the shift registers, and the game should end once you've pressed Roll 3 times.
You should rename your controls to be something meaningful. Stop 1, 2, 3, 4, 5 doesn't sound anything like the dice you want to keep. And OK doesn't sound like it is a button you'd press to Roll the dice.
10-17-2016 02:53 PM
Try something like this. Let me know if you have any questions.
Of course you should expand it into a state machine where you can start over with a new set of three rolls without stopping the program. e.g. implement a reset function.
10-20-2016 01:20 PM
OK I have taken all your advice. Here is my program right now. Anyways to have to numbers stored in the number when pressed KEEP instead of it turning to 0? Also Is it possible to make the Stop button reset the program instead of closing it?
10-20-2016 01:38 PM
You need to put your array wire into a shift register on the outer while loop as well. Right now all of your dice reset to zero upon a new roll because you intialized your inner For Loop shift register to do that.
If you want the stop button to just reset the game, create an event for that, inside that event case, place the initial all-zero array as a constant to wire into the shift registers.
Don't forget to add a new stop button and an event case for that which will actually stop the VI.