LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A simple Ball Firing Game used LabVIEW Basic Algorithm's

Hi Friends,

HERE I DESIGNED A BALL FIRING GAME USING SIMPLE VI'S.

*Used 3 Level's (SLOW, MEDIUM, FAST)
*Used 3 Indicator's (TOTAL BALL'S, FIRED BALL'S, UN-FIRED BALL'S)

 

Step's to Play;

*Before you click RUN button select the Game Level in GAME MODE.
*After you started the game the BALL's (LED's) will glow-up randomly.
*You have to CLICK the BALL before it goes to disappear.
*Total Ball's will show how many ball's glowed.
*Fired Ball's will show how many ball's you fired (clicked).
*Un-Fired Ball's will show how many ball's you missed to click.
*Game will automatically STOP when Un-Fired ball's reaches 25.

 

Just try and tell me is there any options to add nor any simple algorithms that you know to replace mine..


Thank You......

0 Kudos
Message 1 of 4
(3,274 Views)

Show this to your instructor and ask if it's OK, or show it to your fellow students and get their suggestions.

 

What do you think of your code?  Does it look "easy to understand"?  One measure of this is do you think you could take, say, a Matlab user, and explain to him/her what you are doing?  If the answer is not "Yes, it's really obvious when you look at this diagram", think about how you might reorganize the algorithm and the representation of the algorithm to make things more intuitive.

 

Bob Schor

0 Kudos
Message 2 of 4
(3,243 Views)

I am certain you can get rid of that big giant case structure with nearly identical code in all of the cases.  I would start by putting the individual buttons into a cluster.  You can then easily set all of the buttons with a single local variable (Initialize Array to put all of the values to FALSE, Replace Array Subset to set the one button to TRUE, Array to Cluster, and then write to the local variable for the cluster).  You can do something similar for the Enable/Disable with a FOR loop.  After the time has elapsed, use Index Array to get the single value you care about.

 

And now to talk about some Rube Goldbergs...

  1. Comparing a boolean to FALSE is the same as NOT.  But the fact that you are just going straight to a case structure, do not even bother with it.
  2. You have several places where you initialize an array with a single value and then index out the first element.  Remove that stuff and wire the value straight through.

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 3 of 4
(3,229 Views)

Wholly redundant code Batman!

 

You case is full of redundant code, your total balls and unfired ball count does not need to be in every case. Do that once after all your LED changes and such.

 

Granted I am not a fan of Event Structures, but this is one program that could probably benefit from using one to handle the "mouse down" events of clicking on the LED's.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 4
(3,226 Views)