LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Game of Life

Hello, 

I have been working on my Game of Life 3D and was wondering if anyone would have a look and give me any feedback, positive or negative. I feel like it has gone well so far and any feedback would be greatly appreciated. 
Still wondering if anyone else has had a go at anything like this before?
The SubVI's are needed to run the program and basic information is given on how to run it, if more explanation is needed then just ask and will be happy to add more detail into getting it working. 

Thank in advanced, Myron 

0 Kudos
Message 1 of 19
(2,901 Views)

I see several problems.

 

1)  Your button selection scheme doesn't appear to work correctly.  Also, why are you comparing your buttons to a true?  The button itself is either true or false, you don't need the comparison operator in there.

 

2)  Check the mechanical action of all the buttons.  Continuous and Pause shoud have a Latch action instead of a Switch action.

 

3)  The block diagram of your Life or Death VI is so messy it's impossible to tell where the wires are going.  Clean it up.  I don't think it's wired the way you intended it to be.  Get rid of all the duplicate +1 and -1 primitives.

 

4)  In both the Life or Death VI and the 3D Array to 3x1D arrays VI you are checking to see if a double is equal to 1.  Due to rounding errors this comparison will usually be false when it should be true.  Instead, round to nearest then convert to an I32 and compare to and I32 value of 1.

 

That should get you started.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 2 of 19
(2,853 Views)

Hey, 

Thanks for the feedback, I didn't realise about the buttons, I am pretty sure that they work as they should, sometimes it doesn't read a click on the continious when it is paused, I think that is due to it scanning the rest of the program. 
I have tried to sort the wires out for the Life and Death SubVI, I am unsure how better to organise it, I could add diagrams of which cells is which if necessary:)
I didn't realise about the rounding of numbers that LabVIEW does, I am relatively new, thanks
With the button comparision I was unsure how else to recognise if the button has been pressed, that is why I had that comparator which would compare if the button is pressed and if so assign a number to the case structure to run a certain case, which would correspond to the button pressed.

Thanks again, if there are any other stupid mistakes I have done I would be very happy to take feedback, I have included the changes,

Thanks, Myron 

0 Kudos
Message 3 of 19
(2,822 Views)

Look at this for better organization of your block diagram.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 4 of 19
(2,816 Views)

Wow... Thanks, so much better!

I guess I need to learn how to tidy my programs up better:P

0 Kudos
Message 5 of 19
(2,802 Views)

Let's think about how you want the controls to operate.  Here's my thoughts:

 

The Continuous button is not needed.

Once the program starts the Volume of Cube and Living Percentage controls should be disabled and grayed because they don't work.

  • If no buttons are activated the game runs continuously.  Only the PAUSE & STOP buttons will do anything in this state.
  • If PAUSE is selected it should latch and the game should pause and stay that way as long as the button is latched.
  • While paused selecting the NEXT button should allow one step and the button should not latch.  The button should have no effect if PAUSE is not latched on.
  • Selecting STOP should work whether the game is paused or not.  The button should not latch and the game should exit cleanly.

Does this fit with what you were thinking?

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 6 of 19
(2,785 Views)

Yeah, that makes more sense and easier... Thanks!

0 Kudos
Message 7 of 19
(2,775 Views)

Please post your revised VIs when you're done with them.  No hurry, I'd just like to see how your changes look.

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
0 Kudos
Message 8 of 19
(2,773 Views)

I have made the changes to the button and they work well, but I am unsure how to hide the volume and percentage controls after the program is ran:/
Also, is there anything else you think I should add any features or anything else?
Thanks for all the help!:)

0 Kudos
Message 9 of 19
(2,764 Views)

To disable and gray a control/indicator right-click on the control and select Create|Property Node|Disabled.  Drop the Property Node on the block diagram, right-click on the node, and chose Change All to Write.  Now right-click on the property and select Create|Constant.  You can use the same constant for both property nodes.  Make sure you wire the error cluster out of to the structures so you know when the controls are disabled and don't forget to enable the again when the VI stops.

 

You should also move your delay out of the case structures and just have it in the loop.

 

Game of Life.png

 

You didn't fully understand about comparing doubles.

double compare.png

 

Kelly Bersch
Certified LabVIEW Developer
Kudos are always welcome
Message 10 of 19
(2,749 Views)