A dependency-free terminal game for learning dynamic-programming sequence alignment. It supports:
- Longest common subsequence
- Needleman–Wunsch global alignment
- Smith–Waterman local alignment
- Custom scoring and nucleotide/amino-acid sequences
- Random sequence generation
- Live table and alignment checking
- Multiple independently submitted alignments/LCS options
- Extending either sequence without losing completed cells
- Multiple valid optimal alignments
Ruby 3.1 or newer is recommended.
bin/alignment-gameIf needed, make the launcher executable first:
chmod +x bin/alignment-game- Arrow keys: move between logical cells and controls
- Type a number: replace the selected DP value (negative and multi-digit values work)
- Type a residue/base: replace an alignment cell
- Type a number in the score section: enter the alignment score
- Backspace: clear the selected cell
- Enter: activate a sequence/alignment extension arrow or Submit
- Tab: cycle through the DP table, every solution builder, score, and Submit
- Shift+Tab: move to the previous section
- While an alignment/LCS panel is active,
+adds another option - While an alignment/LCS panel is active,
-removes that option - In a pairwise alignment panel, move right from
>to↔and press Enter to reverse the character order of both alignment strings - Space: toggle correctness highlighting
H: reveal a small hintR: clear the active sectionQ: quit
After submitting, press R to repeat the same exercise from a completely
fresh board while keeping its algorithm, sequences, and scoring.
Press N after submitting to start another exercise with newly generated
sequences. The algorithm, scoring, alphabet, and current sequence lengths are
preserved.
Press M after submitting to return to the main setup menu.
Sequence 1 is always vertical and sequence 2 is always horizontal. Gap and mismatch settings are entered as positive penalties and displayed in the recurrences as negative contributions.
Longest common subsequence uses a single solution row. The pairwise alignment algorithms use the conventional two rows with connector bars.
Press + while an alignment/LCS panel is active to add another panel.
Additional panels appear to the right of the existing ones. Every submitted
option is checked independently; duplicate options are reported as duplicates.
ruby -Ilib -e 'Dir["test/**/*_test.rb"].sort.each { |file| require_relative file }'