LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help for a project

Hi, I would like to create a project but I am new to Labview. I would like to simulate a penalty shootout where a user chooses a direction to shoot (center, right, or left) and an opposing goalkeeper simulated by a random number generator (ranging from 1 to 3) determines where the goalkeeper dives and if they dive on the same side as the shot, they stop it. When they stop a shot their score increases by 1, but if they don't stop it, the player's score increases by 1 and the game ends when one of the two reaches 5 (with a while loop). The score is displayed in a table with multiple rows and the score's progress is visible through a graph. Could someone give me some advice on how to do this?

0 Kudos
Message 1 of 10
(1,512 Views)

No one is going to help you with the project or homework if you haven't started doing anything. You can start by going thru some self-learning with LabVIEW Tutorial and try your best to come out with something. Post a more specific question that you encounter and need advice on.

 

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 2 of 10
(1,504 Views)

Don't think about LabVIEW.  Use pencil (or pen) and paper and write down what you want to do (you described it pretty nicely).  Do you see "steps" that are repetitious?  Do you see "data that need to be acquired at regular intervals"?  Do you see "decisions that need to be made and actions that need to be taken based on the data"?

 

Once you have a clear idea about the "What", you can begin to think about the "How do I do that with LabVIEW?"  Hopefully you've covered the first several lessons in "Introduction to LabVIEW" that tells you about data types, Controls and Indicators, Wires, some of the important "Structures", and you have a good understanding of these concepts.

 

Another thing that is helpful, particularly if there is a "feature" that isn't quite clear (for example, how to choose 1, 2, or 3 "at random"), you can write a tiny test program with indicators at various key places and run your test code to see if it "does what you want", as opposed to "does what you tell it to do" (it will more often do the latter than the former).  Because LabVIEW can run much faster than we can see, you should learn how to "slow it down" by using the "Wait until next Multiple" function.

 

Bob Schor

Message 3 of 10
(1,469 Views)

Hello, I have indeed started coding. So far, I have tried to create the part where the player chooses to shoot either in the center, right, or left. I associate each direction with a number from 1 to 3 using a switch-case structure, and then compare it to the random number generator. If they are equal, the goalkeeper's score increases by 1, and if they are different, the player wins 1 point. For this, I use a shift register to initialize both scores, and then use two cases for the increment of either score. My problem for now is that both scores increase at the same time, the player's score starts at 1 instead of 0, and another minor issue is that the LED indicating if the goalkeeper stops the shot never turns on. How could I improve and correct these errors?

Zlatoun_1-1681300531065.png

 

0 Kudos
Message 4 of 10
(1,438 Views)

let's avoid having 2 parallel threads for this...

https://lavag.org/topic/23103-help-project/#comment-149521


We have two ears and one mouth so that we can listen twice as much as we speak.

Epictetus

Antoine Chalons

0 Kudos
Message 5 of 10
(1,430 Views)

@Zlatoun wrote:

Hello, I have indeed started coding. So far, I have tried to create the part where the player chooses to shoot either in the center, right, or left. I associate each direction with a number from 1 to 3 using a switch-case structure, and then compare it to the random number generator. If they are equal, the goalkeeper's score increases by 1, and if they are different, the player wins 1 point. For this, I use a shift register to initialize both scores, and then use two cases for the increment of either score. My problem for now is that both scores increase at the same time, the player's score starts at 1 instead of 0, and another minor issue is that the LED indicating if the goalkeeper stops the shot never turns on. How could I improve and correct these errors?

Zlatoun_1-1681300531065.png

 


 

We cannot debug the image, So always better to share the code.

 

If your problem is Handling two Individual Numbers, then you have to go with two different Shit registers for Incrementing two Values.

 

Use case Selector Instead of Case Structure for easy understanding since you have only two options (True/False)

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 6 of 10
(1,428 Views)

I hope you have posted in Multiple Forums.

 

Please find the below link, and make sure you understand before using, seems i have done your home work program.

https://lavag.org/topic/23103-help-project/?do=findComment&comment=149523 

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 7 of 10
(1,412 Views)

@PalanivelThiruvenkadam wrote:


If your problem is Handling two Individual Numbers, then you have to go with two different **bleep** registers....


I was trying to think of something clever about #1 and #2 but nothing is coming to mind. 

😂

aputman
0 Kudos
Message 8 of 10
(1,355 Views)

Sorry if I confused you. Sorry for not checking spelling too just noticed.

 

Both are of different statements, one is on using two shift registers for holding values of player and goal keeper.

 Second is a suggestion to go with case selector function instead of case structure.

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 9 of 10
(1,347 Views)

If you run it in Highlight mode you'll see what happens. When the program starts the Shoot is False, which'll send a False to the last Case, which'll increase player score by 1.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 10
(1,318 Views)