LIGHTS_OUT_OPENGL
OpenGL version of "Lights Out"


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.

Usage:

lights_out_opengl width height moves
where

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

LIGHTS_OUT_OPENGL is available in a C version and a C++ version.

Related Data and Programs:

CAUSTIC_OPENGL, a C++ program which computes a caustic curve and displays it using OpenGL.

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.

LISSAJOUS_OPENGL, a C++ program which computes a Lissajous figure and displays it using OpenGL.

OPENGL, C++ programs which illustrate the use of the OpenGL graphics library;

POLYGONAL_SURFACE_DISPLAY_OPENGL, a C++ program which displays a surface in 3D described as a set of polygons, using OpenGL.

ROTATING_CUBE_DISPLAY_OPENGL, a C++ program which displays a rotating color cube in 3D, using OpenGL;

SPHERE_XYZ_DISPLAY_OPENGL, a C++ program which reads XYZ information defining points in 3D, and displays a unit sphere and the points, using OpenGL.

TRIANGULATION_DISPLAY_OPENGL, a C++ program which reads files defining a triangulation and displays an image using Open GL.

XYF_DISPLAY_OPENGL, a C++ program which reads XYF information defining points and faces in 2D, and displays an image using OpenGL.

XYZ_DISPLAY_OPENGL, a C++ program which reads an XYZ file of 3D point coordinates, and displays an image of those points using OpenGL.

XYZF_DISPLAY_OPENGL, a C++ program which reads XYZF information defining points and faces in 3D, and displays an image in a MATLAB graphics window.

XYZL_DISPLAY_OPENGL, a C++ program which reads XYZL information defining points and lines in 3D, and displays an image in a MATLAB graphics window.

Reference:

  1. Marlow Anderson, Todd Feil,
    Turning Lights Out With Linear Algebra,
    Mathematics Magazine,
    Volume 71, Number 4, October 1998, pages 300-303.
  2. Edward Angel,
    Interactive Computer Graphics, a Top-Down Approach with OpenGL,
    Addison-Wesley, 2000,
    ISBN: 0-201-38597-X,
    LC: T385.A514.
  3. Oscar Martin-Sanchez,
    Two Analyses of Lights Out,
    Mathematics Magazine,
    Volume 74, Number 4, October 2001, pages 295-304.

Source Code:

Examples and Tests:

List of Routines:

You can go up one level to the C++ source codes.


Last revised on 17 January 2009.