Skip to content

Arom1a/rusty-lights

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rusty Lights

A TUI version of the lightsout game written in Rust.

Highlights:

  • Written in Rust! 🦀
  • Play the lightsout game in your terminal with vim keybinds.
  • Blazing fast board solver power by linear algebra! 1
  • Fully compatible with the loplayer used for CMU 15-122. 2

Installation

cargo install rusty-lights

Usage

$ rusty-lights --help
The lightsout game written in rust.

Usage: rusty-lights [OPTIONS] [FILE]

Arguments:
  [FILE]  Start the game from a given file. If not provided, the program will
          randomly generate games with a 5x5 board

Options:
  -v, --variant          When present, play the variant version of lightsout: a
                         tap will switch lights on the whole row and the whole
                         column
  -W, --width <WIDTH>    The width of the board. The width and the height
                         should be both provided at the same time. This field
                         will be omitted if a specific file is given
  -H, --height <HEIGHT>  The height of the board. The width and the height
                         should be both provided at the same time. This field
                         will be omitted if a specific file is given
  -t, --tui              Play the TUI version of the game. Note that this flag
                         only takes effect when a file is given
      --enable-solver    Enable the solver
  -h, --help             Print help
  -V, --version          Print version

Examples:

$ rusty-lights boards/5x5_eg1.txt
Try your best to get all the lights out!!!
Now enter the 0-indexed coordinate you want to tap in "row:column" form:
● ○ ○ ○ ○
○ ○ ○ ○ ○
○ ○ ○ ○ ○
○ ○ ○ ○ ○
○ ○ ○ ○ ○
1:3
Flipping 1:3
● ○ ○ ● ○
○ ○ ● ● ●
○ ○ ○ ● ○
○ ○ ○ ○ ○
○ ○ ○ ○ ○
2:4
Flipping 2:4
● ○ ○ ● ○
○ ○ ● ● ○
○ ○ ○ ○ ●
○ ○ ○ ○ ●
○ ○ ○ ○ ○
$ rusty-lights -W 3 -H 5
# This starts a random game with a board of 3 rows and 5 columns

$ rusty-lights -W 3 -H 5 -v
# This starts a random variant game with a board of 3 rows and 5 columns

$ rusty-lights -W 3 -H 5 --enable-solver
# This starts a game with the solver enabled

$ rusty-lights ferris.txt
# This starts a game from the board file "ferris.txt" and play with cli

$ rusty-lights ferris.txt --tui
# This starts a game from the board file "ferris.txt" and play with tui

Footnotes

  1. Disabled by default. Enable it by passing --enable-solver flag.

  2. Pass a board file to get the same behavior as loplayer. Check the examples.

About

The lightsout game written in rust.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages