Home License -- for personal use only. Not for government, academic, research, commercial, or other organizational use. 12-Nov-2024 09:16:44 lights_out_test(): MATLAB/Octave version 9.11.0.2358333 (R2021b) Update 7 lights_out() examines the 5x5 Lights Out game. lo_initialize_random(m,n,k) randomly initializes the board with k lights turned on. Random board with 15 lights illuminated. . * * * . . * * * . . * * . * * . * * . . * . * * lo_initialize_solvable(m,n,push) randomly initializes the board with push = 5 button pushes. Solvable board with 12 lights illuminated * * . * * * . * . * * * . * * . . * . . . . . . . lo_update(L,i,j) updates the board after button (i,j) = (2,3) was pushed. Updated board with 15 lights illuminated * * * * * * * . * * * * * * * . . * . . . . . . . lo_solvability_matrices() returns matrices N1 and N2 which test a board configuration for solvability. Solvability matrix N1 . * * * . * . * . * * * . * * * . * . * . * * * . Solvability matrix N2 * . * . * * . * . * . . . . . * . * . * * . * . * lo_dot() computes the dot product modulo 2 of two board configurations. Dot product of N1 and N2 is 0 Dot product of L1 and N1 is 0 Dot product of L1 and N2 is 0 Dot product of L2 and N1 is 1 Dot product of L2 and N2 is 0 lo_solvable(L) determines whether configuration L is solvable. Test lo_initialize_solvable() configurations Solvable? true Solvable? true Solvable? true Solvable? true Solvable? true Test lo_initialize_random() configurations Solvable? true Solvable? false Solvable? false Solvable? false Solvable? false lo_light_chase(L) pushes buttons to shut off all lights above the bottom row. Initial configuration L0 * * . . . * . . . . . . . . . . * * . . * . . * . Light chasing required 10 button pushes. After light chasing: . . . . . . . . . . . . . . . . . . . . . * * . * lo_light_chase_top(L) examines a Lights Out configuration after the light chase algorithm has been completed. It reports whether the problem is completed, unsolvable, or solvable. For solvable problems, it suggests which buttons to push on the top row, so that restarting the light chase algorithm will solve the problem. Initial configuration L0 * * . * * * . . . . . . . * * * . . . * * * . . . Light chasing required 6 button pushes. After light chasing: . . . . . . . . . . . . . . . . . . . . * * . * * This configuration is solvable. Pushing these buttons in top row: 0 0 1 0 0 Then do a second round of light chasing. After pushing top row buttons: . * * * . . . * . . . . . . . . . . . . * * . * * Light chasing required 9 button pushes. After second round of light chasing: . . . . . . . . . . . . . . . . . . . . . . . . . lights_out_test(): Normal end of execution. 12-Nov-2024 09:16:44