11-23-2016 03:05 AM
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......
11-23-2016 08:50 AM
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
11-23-2016 11:08 AM
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...
11-23-2016 11:18 AM
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.