LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming the game "Craps" in Labview

I've been given two weeks on this project. Time is running short, and given that I'm not a natural with LabVIEW programming, it still hasn't been enough time for me to make significant progress. The objective is to have six dice (with indicators and a case structure), a default case, and having a master stop button. The game should start over automatically at the first role after a game finishes. There must be a numeric display logic to determine the score of the dice using the following rules: a number 1 is worth 100 points, a number 5 is worth 50 points, three of a kind is worth 100 times the face value of the dice. The player should roll six dice a total of four times and display the total score. If over 2,000 points is scored, a message should be displayed that indicates an excellent game.

 

I've provided what I have so far, and given that my dice don't work properly, you can tell just how much of a novice I am lol. Can anybody at least point me in the right direction?

Message 1 of 14
(5,809 Views)
Your code and your task description do not match. Your code has one ' dice' but you say you need 6. The case statement is senseless. You aren't taking any sort of score.
0 Kudos
Message 2 of 14
(5,792 Views)

That "dice" is a random number between zero and one. The mathematical formula it's connected to is exactly what was described in the project handout sheet. The formula is supposedly feeding into the case structure and supplying all 6 dice indicators with data. It says create a random number between zero and one, multiply by 7, and round to the nearest integer for each die. If there is an error, I appreciate that you recognise it, but I'm hoping for constructive criticism with helpful pointers, not demeaning criticism.

0 Kudos
Message 3 of 14
(5,787 Views)
It is irrelevant whether you think the criticism is demeaning or not. You are the one that said you needed 6 dice and you have only 1. The case statement does not accomplish anything that is in your description either.
0 Kudos
Message 4 of 14
(5,783 Views)

I won't deny that what I have so far is out of left field. I imagine it was. Can you at least provide a small tip on how to start correcting it? So far I gather that having one case structure to represent each dice is wrong, and that I probably need one small case structure for each.

0 Kudos
Message 5 of 14
(5,725 Views)
By now, you should have been able to take one of the tutorials. Did you?

Lets start with the basics of your task. You need 6 separate instances of your random number generator to represent the 6 dice. Or, place the one you have inside a for loop and have it run 6 times. You'll get an array output that you can index and wire to the indicators you have. I don't understand why you want to use a case statement on any of the dice results. You will have to look at all of the results and then do some logic (i.e. Determine if there are 3 of a kind).
0 Kudos
Message 6 of 14
(5,707 Views)

Go back to message 4 in your original thread to see the proper way to randomly generate the number 1 through 6 with equal probability.

http://forums.ni.com/t5/LabVIEW/any-tips-on-programming-craps-in-labview/m-p/2642855#M789229

 

Also, Craps only uses two dice.

 

Now that you are proposing a game that uses 6 dice, you should call it something else.

0 Kudos
Message 7 of 14
(5,693 Views)

Hi,

 

I'm unable to see your vi because it's posted it in 2013 Smiley Sad

Anyway looking at the comments I found out you already questioned the dice generator last time.

I made a quick example of how a dice game could look like, it isn't special nor great programmed.

It's very simple using only two dices.

 

Koen

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
Message 8 of 14
(5,668 Views)

KoenR94, I'm glad you want to help - and I'm glad you used an event structure. However (and I don't mean any harm to The Batman), if you do his assignments for him, it may take him longer to learn. Sometimes it's enough to give a smaller piece of the answer. Just a thought.

Message 9 of 14
(5,662 Views)

Yes maybe you are right.

It was just an example, his assignment has to contain 6 dices.

Though I guess you are right, I could've attached less code.

 

 

---

UnCertified LabVIEW Student
Mistakes are for learning, that's why suggestions are always welcome!
Message 10 of 14
(5,657 Views)