To download NI software, including the products shown below, visit ni.com/downloads.
Overview
Lights out 2014 is a software version of the classic LightsOut (and LightsOut 2000) game. The aim of this addictive game is to reduce the 5x5 matrix of lights such that no lights are on.
Description
Pressing a lit light toggles it to the off position but also toggles its 4 neighbouring lights. The image below best describes the game:
Image taken from http://people.math.sfu.ca/~jtmulhol/math302/notes/24-Lights-Out.pdf
The matrix is generated from patterns that are stored in the "Levels.txt" file - there is code supplied that also allows you to generate your own levels. If you use this code, please check what level you're currently at (by looking in the levels.txt file) and counting the rows. Then add one to this value and that goes in the level control on the front panel.
It uses the Queued Message Handler architecture so that it's modular and expandable I'm currently working on the code for solving the matrix mathematically. This can be done by using Gaussian elemination (in mod 2) and solving the linear equation Ax = b where 'A' is a 25x25 matrix of how each light interacts with the whole matrix, 'x' is the "toggle matrix" indicating which lights need to be toggled to complete the game and 'b' is the "inital configuration matrix". I would also like to add in more states for the lights to increase the difficulty - hence why I use an array of colour box constants instead of Boolean switches.
I've used the "Determine Clicked Array Element Index in LabVIEW" SubVI from here - https://decibel.ni.com/content/docs/DOC-22434 to determine the clicked cell.
Requirement
Steps to Implement or Execute Code
NOTE: The "Reset Levels" resets your level back to 1.
Additional Information or References
Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
You should include the entire distribution of the Determine Clicked Array Element Index. You failed to include the subVIs in your zip file.
Hi crossrulz, thanks for pointing that out, I've uploaded the new revision, all should be fine now!
The whole distribution of the Determine Clicked Array Element Index should be used. The subVIs were missing from your zip file. The whole distribution of the Determine Clicked Array Element Index should be used. The subVIs were missing from your zip file.