#puzzle #solution #tui #date #generate #calendar #browse

bin+lib a-puzzle-a-day

Generate and browse all solutions to A-Puzzle-A-Day

2 releases

0.1.1 Mar 13, 2024
0.1.0 Mar 13, 2024

#199 in Visualization

GPL-2.0-only

150KB
1.5K SLoC

A-Puzzle-A-Day

DragonFjord's A-Puzzle-A-Day tasks you with placing eight pieces within a calendar frame to reveal the current date. There are roughly 60 thousand ways the pieces can fit in the frame, and of those arrangements over 24 thousand are valid solutions. That is an average of 67 solutions per date, and yet some days solving the puzzle can seem utterly and hopelessly impossible.

This piece of software can serve as a holy light for those despondent, ego-shattering days, allowing you to generate and browse all solutions for all days at your leisure.

Usage

There are three main modes of use: browse, random, and generate.

Browse

image

$ a-puzzle-a-day browse [-f/--file <FILE>] [-d/--date <DATE>]

Open a TUI showing all solutions. The UI is split into two panes: the date pane (left) and the solution pane (right). To navigate, use the arrow buttons or hjkl. To switch panes, press Tab or Enter. To quit, press Escape or q.

Alternatively, there is full mouse support, including scroll.

Note that colors were chosen with a dark terminal theme in mind. There is currently no way to change colorschemes.

Random

$ a-puzzle-a-day random [-f/--file <FILE>] [-d/--date <DATE>]

This will display a random solution for the current date, or the date specified by the option -d or --date.

Generate

generate

$ a-puzzle-a-day generate [-f/--file <FILE>]

This will generate all solutions and write them to the file solutions.apad, or the file specified by the option -f or --file (this file is identical to the solutions file found in this repository). The file created uses a custom-built binary file format, named APAD.

Solutions are found using brute-force, each piece placed on each square in parallel. Care has been made in minimizing the amount of work needed, but the generation will take at least a few seconds and a few dozen threads.

Note: this is generally unnecessary, as the solutions are included in the binary.

Installation

Currently, this software can only be installed from source, using Cargo:

$ cargo install --git https://github.com/mrbjarksen/a-puzzle-a-day

This will place the exectuable a-puzzle-a-day into $HOME/.cargo/bin (by default), which should be added to $PATH.

Dependencies

~9–17MB
~223K SLoC