LIGHTS_OUT_OPENGL is a C program which sets up the "Lights Out" game and allows a user to try to solve it.
The Lights Out game is played on a rectangular board of squares, each representing a light that may be on or off. Clicking the mouse on a light switches it from on to off and vice versa. However, when you switch a light, you also switch the lights to the immediate left, right, above and below. (There is no "wrap around" however, in this basic version of the game.)
You start the game by specifying the width and height of the board to be used, and the number of moves the program should make in setting up the inital board. Specifying 10 moves, for instance, means that the program, starting from a board with all lights off, will randomly switch a light and its neighbors 10 times.
lights_out_opengl width height moveswhere
The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.
LIGHTS_OUT_OPENGL is available in a C version and a C++ version and a MATLAB version.
FERN_OPENGL, a C program which uses OpenGL to display the Barnsley fractal fern.
FLOOD_OPENGL, a C program which uses OpenGL to allow the user to select regions of a 2D image and flood them with color, by Art Wetzel.
LIFE_OPENGL, a C program which uses OpenGL to display the evolution of John Conway's "Game of Life", by Simon Green.
OPENGL, C programs which illustrate the use of the OpenGL graphics library;
SCREENSHOT_OPENGL, a C program which shows how a program using the OpenGL graphics library can save a screenshot of the graphics being displayed.
lights_out_opengl 6 9 20
You can go up one level to the C source codes.