64 lines
2.3 KiB
Plaintext
64 lines
2.3 KiB
Plaintext
nnfc: no-nonsense FreeCell game in under 300 SLOC of POSIX AWK
|
|
--------------------------------------------------------------
|
|
This is a simple and straightforward FreeCell implementation that adheres
|
|
to the POSIX AWK standard. Within <300 SLOC, it features:
|
|
|
|
* simple line-oriented command prompt compatible with standard move notation;
|
|
* Unicode/ASCII card suit signs (Unicode by default);
|
|
* color/monochrome display selection (color by default);
|
|
* M$-FreeCell-compatible deal seeding by the game number;
|
|
* FreeCell Pro-compatible supermoves to move stacks of cards between columns;
|
|
* FreeCell Pro-compatible card autohoming ("safe autoplay" strategy);
|
|
* internal help screen.
|
|
|
|
== How to run ==
|
|
|
|
The game is run as a usual AWK script:
|
|
|
|
awk -f nnfc.awk [-v ASCII=1] [-v MONOCHROME=1] [-v SEED=xxxxx]
|
|
|
|
Available parameters to pass to the script:
|
|
|
|
* `-v ASCII=1`: display Latin letters (c, d, h, s) instead of UTF-8 suits
|
|
* `-v MONOCHROME=1`: disable colors when displaying cards (e.g. on e-ink)
|
|
* `-v SEED=xxxxx`: set the PRNG seed (game number) to start a predefined game
|
|
|
|
== How to play ==
|
|
|
|
Once run, the game shows the current seed (game) number, the playfield with
|
|
all the cards in the traditional columnar layout and a command prompt.
|
|
Press Enter/Return after every command entry.
|
|
|
|
Move commands are entered with two characters without any separator:
|
|
|
|
* 0 or h is foundation/home cell (can be omitted and can only be the second)
|
|
* 1 to 8 are column (tableau) numbers
|
|
* a to d are freecell IDs
|
|
|
|
Examples:
|
|
|
|
* 7a: move from column 7 to freecell a
|
|
* 63: move (as many cards as possible) from column 6 to column 3
|
|
* d1: move from freecell d to column 1
|
|
* 4 (or 40, or 4h): move from column 4 to the foundation/home cell
|
|
* c (or c0, or ch): move from freecell c to the foundation/home cell
|
|
|
|
Besides moves, the following commands are available:
|
|
|
|
* h: display a help screen
|
|
* u: undo the last move (the history is saved from the beginning)
|
|
* r: restart (undo to the starting playfield)
|
|
* q: quit the game
|
|
|
|
== Compatibility ==
|
|
|
|
Primary testing was done on nawk and busybox awk, but the game should work
|
|
correctly on mawk, gawk and any other POSIX-compliant AWK implementation.
|
|
Particularly, additional tweaking had been done to make sure the game works
|
|
correctly with gawk --posix and mawk -W posix flags.
|
|
|
|
== Credits ==
|
|
|
|
Created by Luxferre in 2024. Released into public domain.
|
|
|