lights_out


lights_out, a MATLAB code 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, usually a 5x5 grid, each square containingr 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.

You start the game with a randomly chosen configuration of lights and it's up to you to figure out how to get them all out.

Licensing:

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

Languages:

lights_out is available in a C version and a C++ version and a MATLAB version.

Related Data and Programs:

brownian_motion_simulation, a MATLAB code which simulates brownian motion in an m-dimensional region.

coin_simulation, a MATLAB code which looks at ways of simulating or visualizing the results of many tosses of a fair or biased coin.

dice_simulation, a MATLAB code which simulates n tosses of m dice, making a histogram of the results.

duel_simulation, a MATLAB code which simulates n repetitions of a duel between two players, each of whom has a known firing accuracy.

fair_dice_simulation, a MATLAB code which simulates n tosses of 2 dice, making a histogram of the results.

gamblers_ruin_simulation, a MATLAB code which simulates the game of gambler's ruin.

high_card_simulation, a MATLAB code which simulates a situation in which you see the cards in a deck one by one, and must select the one you think is the highest and stop.

ising_2d_simulation, a MATLAB code which carries out a monte carlo simulation of an ising model, a 2d array of positive and negative charges, each of which is likely to flip to be in agreement with neighbors.

poisson_simulation, a MATLAB code which simulates a poisson process in which events randomly occur with an average waiting time of lambda.

random_walk_1d_simulation, a MATLAB code which simulates a random walk in a 1-dimensional region.

random_walk_2d_avoid_simulation, a MATLAB code which simulates a self-avoiding random walk in a 2-dimensional region.

random_walk_2d_simulation, a MATLAB code which simulates a random walk in a 2-dimensional region.

random_walk_3d_simulation, a MATLAB code which simulates a random walk in a 3-dimensional region.

reactor_simulation, a MATLAB code which is a simple monte carlo simulation of the shielding effect of a slab of a certain thickness in front of a neutron source. this program was provided as an example with the book "numerical methods and software."

roulette_simulation, a MATLAB code which simulates the spinning of a roulette wheel and the evaluation of certain common roulette bets.

sir_simulation, a MATLAB code which simulates the spread of a disease through a hospital room of m by n beds, using the susceptible/infected/recovered (sir) model.

snakes_and_ladders, MATLAB codes which simulate the game of snakes and ladders.

traffic_simulation, a MATLAB code which simulates the cars waiting to get through a traffic light.

truel_simulation, a MATLAB code which simulates n repetitions of a duel between three players, each of whom has a known firing accuracy.

Reference:

  1. Marlow Anderson, Todd Feil,
    Turning Lights Out With Linear Algebra,
    Mathematics Magazine,
    Volume 71, Number 4, October 1998, pages 300-303.
  2. Oscar Martin-Sanchez,
    Two Analyses of Lights Out,
    Mathematics Magazine,
    Volume 74, Number 4, October 2001, pages 295-304.

Source Code:


Last revised on 08 November 2017.