Example Code

Conway's Game of Life Simulation

Code and Documents

Attachment

Download All

This is a simulation that Jason and Jared (myself) put together for a Computer Simulation course at the University of Florida (Fall 2011). It uses LabVIEW as the programming environment. It is an implementation of Conway's Game of Life (http://en.wikipedia.org/wiki/Conway's_Game_of_Life).

See http://www.youtube.com/watch?v=uNlxQaOhJGA for a demonstration. This is a little long (10 minutes) because it was our deliverable for our project.

Features

  • Initialize the board
    • Randomly
    • With a catalog of interesting shapes (add more as text files)
    • From an image (.jpg | .png. | .bmp)
  • Control the simulation
    • Controls: Play, pause, rewind, forward, stop
    • Speed: Slider to control the time delay between successive steps
    • Zoom: Zoom slider for resizing the game board
  • Record the simulation
    • Start and stop the recording to save to a .avi file (requires ffmpeg command-line utility, also requires that ffmpeg's location be included in the system's path variable)
  • Musical playback
    • Uses winmm.dll (Windows Midi Controller) to play a note based on birth and death rates
    • User-selectable instrument (piano, organ, drums, sound effects). 128 total!
  • Statistics
    • Population, birth rate, and death rate graphs over time

Note: the source is written in LabVIEW 2011

Overview.PNG

Jared A.
Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
HunterSeeker
Member
Member
on

This is wonderful, would you mind saving a version for LabVIEW 2009?

jallen88
NI Employee (retired)
on

Sure!

Just a warning though - this VI makes heavy use of the Silver Controls palette new to LabVIEW 2011. Because of this, when you load the code in 2009, many of the controls will be blank.

I briefly tested this in 2009, and all the functionality seems to be there. Enjoy!

Jared A.
Applications Engineer
National Instruments
Contributors