LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count the number of losses and wins

Hi everyone,
I'm a beginner in LabVIEW, how can I use the numeric indicator to count the number of wins and losses? Or any other solutions?

0 Kudos
Message 1 of 8
(380 Views)

Screenshot 2025-05-18 195132.png

0 Kudos
Message 2 of 8
(376 Views)

Hi Erin,

 

learn about shift registers and select nodes...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 8
(374 Views)
  • You seem to have programmed a game, but you did not explain the rules or attached your code.
  • You use the rather usual construct of a shift register with seven histories.
  • You seem to use 8 LEDs for an animation showing a rolling TRUE, something that could easily be done with an array of LEDs, for 8x fewer terminal and simpler code.
  • If you would use proper dataflow, you would not need the inner sequence structure..
  • We cannot debug truncated code pictures, but please explain why there is an outer sequence frame. What's the purpose?
  • You can anchor a shift register (initialized with zero) on the outer loop that e.g. counts wins. Form that and the "round" value, you can calculate the number of looses.

 

For us to give more specific advice, please explain the rules an attach your VI. Make sure to do a "save for previous" (2020 or below, e.g. 2015). This way we can see things that a picture cannot show (front panel, mechnical action settings, configure input range for the guess, code outside the picture, etc.etc.)

 

0 Kudos
Message 4 of 8
(340 Views)

Thanks for your reminder. Below is my front panel and entire block diagram.

Screenshot 2025-05-18 235136.png

Screenshot 2025-05-18 235122.png

  • The first outer sequence is the effect for 8 LEDs
  • After pressing the START button, the LEDs begin blinking one by one
  • In YOUR GUESS, choose one number(0 to 7) , and then press the STOP button
  • When YOUR GUESS is the same as the RESULT, the MESSAGE is YOU WIN, otherwise YOU LOSE
  • I have only one problem: how to count the number of times YOU WIN and also YOU LOSE
0 Kudos
Message 5 of 8
(326 Views)

@ErinBlue wrote:

Below is my front panel and entire block diagram


No, these are just pictures.

 

All you need is a simple state machine. No local variable should be needed at all.

0 Kudos
Message 6 of 8
(314 Views)

Oh, sorry for my confusion and misunderstanding...so, how can I use the LEDs without a local variable? My teacher taught me to just use the local variable, and he never talked about what a simple state machine is.

0 Kudos
Message 7 of 8
(288 Views)

Hi, I have already been consulting with another expert for my project, and my problem has been solved. Now I understand how to build a simple state machine and enum. Thanks for your advice😊

0 Kudos
Message 8 of 8
(272 Views)