LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lotto + Point System

Solved!
Go to solution

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?

 

0 Kudos
Message 1 of 11
(3,456 Views)

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.

 

Shift Registers



-Matt
0 Kudos
Message 2 of 11
(3,413 Views)
Solution
Accepted by topic author scumbagsteve

There is more than 1 way to skin a cat.

Spoiler
Example_VI.png

"Should be" isn't "Is" -Jay
Message 3 of 11
(3,399 Views)

Smiley Surprised i like those big indicators. I like your method better, i fixed the problem, but i didnt optomize it in my example.



-Matt
0 Kudos
Message 4 of 11
(3,392 Views)

@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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 11
(3,350 Views)

@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?  Smiley Wink

 

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.

0 Kudos
Message 6 of 11
(3,339 Views)

@RavensFan wrote:

Okay Jeff.  You initialize an array of 9 zeroes, then Riffle that.  I wonder what the result would be?  Smiley Wink


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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 11
(3,326 Views)

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.)

0 Kudos
Message 8 of 11
(3,319 Views)

@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?  Smiley Wink

 

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


"Should be" isn't "Is" -Jay
0 Kudos
Message 9 of 11
(3,299 Views)

thank u all!

0 Kudos
Message 10 of 11
(3,285 Views)