12-05-2016 12:29 PM
Hello everyone. I am currently in the process of making a game. In this game I want a player to press a button and have random digits 1-9 roll. I have completed this, but I also want it so that if a player rolls the same number, he gets a point. I have got the basic idea of this, but I don't know how to make it so that a point is added to a digit. In my program, the point system is not consistent. It never adds on. Anyway to make this smoother or fix it all together?
Solved! Go to Solution.
12-05-2016 03:29 PM
You should remove the logic you have and add a simple shift register and a case structure to increment the score if the two numbers are the same. See snippet and also link for shift registers.
12-05-2016 05:08 PM
12-05-2016 05:16 PM
i like those big indicators. I like your method better, i fixed the problem, but i didnt optomize it in my example.
12-06-2016 06:23 AM
@JÞB wrote:
There is more than 1 way to skin a cat.
Personally, I would just use the OpenG Random Number. It would be less random numbers being generated (2 vs 18), which should make it more efficient than the Riffle.
12-06-2016 07:46 AM - edited 12-06-2016 07:49 AM
@JÞB wrote:
There is more than 1 way to skin a cat.
Okay Jeff. You initialize an array of 9 zeroes, then Riffle that. I wonder what the result would be?
EDIT:
Is there something wrong with the code capture tool? I see your snippet says it is LabVIEW 2013. But when I go to drag it into a LV 2014 block diagram, it says it can't convert and it is a LV 2016 file.
12-06-2016 08:33 AM
@RavensFan wrote:
Okay Jeff. You initialize an array of 9 zeroes, then Riffle that. I wonder what the result would be?
I had the same thought. But then I actually looked closer. Jeff is using the Index output, which tells you where each element used to be. So he is actually getting 9 non-repeating random numbers (0 through 8). But then he only uses the first element, which seems like a waste to me.
12-06-2016 09:09 AM
You're right. Forgive me Jeff. I couldn't see that from the image. (And I couldn't drag it into LV like I tried to play with it.)
12-06-2016 11:21 AM
@RavensFan wrote:
@JÞB wrote:
There is more than 1 way to skin a cat.
Okay Jeff. You initialize an array of 9 zeroes, then Riffle that. I wonder what the result would be?
EDIT:
Is there something wrong with the code capture tool? I see your snippet says it is LabVIEW 2013. But when I go to drag it into a LV 2014 block diagram, it says it can't convert and it is a LV 2016 file.
We should discuss that on the dedicated thread Here
I admit I did try to prove my point of using several methods to skin a cat. Surprizingly, the color boxes were "Work In Progress" for a current project (The Captions will display with a format specifier of "%.1d °C" the Value property is to be glanced at from across the room will display an type-def Enum selection) 😉
So, I did attempt to show the CCT in 2013 (the OP's Original version- I Hit Ctrl+I, if you don't know why Ctrl+I was used, look into finding an old QRC) Since the color boxes make no sense out-of context, I added in the FP with the CCT. Riffleing an array and using the index output was a nice trick I learned 'round here
(Dr. Kinion I assume) and since it is no longer Biased and some arguments persist about how rnd really works Riffle.vi (Although Im sure there is a PRNG in there somewhere) seemed appropriate to generate a 0-n random, non-repeating integer series.
Call it a waste of <1kbits if you want Tim! Hardly the kind of optomization needed for a user clocked mouse-click!
Serendipity is alive and well on the forums today
12-06-2016 11:42 AM
thank u all!