README (2376B)
1 nnfc: no-nonsense FreeCell game in under 300 SLOC of POSIX AWK 2 -------------------------------------------------------------- 3 This is a simple and straightforward FreeCell implementation that adheres 4 to the POSIX AWK standard. Within <300 SLOC, it features: 5 6 * simple line-oriented command prompt compatible with standard move notation; 7 * Unicode/ASCII card suit signs (Unicode by default); 8 * color/monochrome display selection (color by default); 9 * M$-FreeCell-compatible deal seeding by the game number; 10 * FreeCell Pro-compatible supermoves to move stacks of cards between columns; 11 * FreeCell Pro-compatible card autohoming ("safe autoplay" strategy); 12 * internal help screen. 13 14 == How to run == 15 16 The game is run as a usual AWK script: 17 18 awk -f nnfc.awk [-v ASCII=1] [-v MONOCHROME=1] [-v SEED=xxxxx] 19 20 Available parameters to pass to the script: 21 22 * `-v ASCII=1`: display Latin letters (c, d, h, s) instead of UTF-8 suits 23 * `-v MONOCHROME=1`: disable colors when displaying cards (e.g. on e-ink) 24 * `-v SEED=xxxxx`: set the PRNG seed (game number) to start a predefined game 25 26 == How to play == 27 28 Once run, the game shows the current seed (game) number, the playfield with 29 all the cards in the traditional columnar layout and a command prompt. 30 Press Enter/Return after every command entry. 31 32 Move commands are entered with two characters without any separator: 33 34 * 0 or h is foundation/home cell (can be omitted and can only be the second) 35 * 1 to 8 are column (tableau) numbers 36 * a to d are freecell IDs 37 38 Examples: 39 40 * 7a: move from column 7 to freecell a 41 * 63: move (as many cards as possible) from column 6 to column 3 42 * d1: move from freecell d to column 1 43 * 4 (or 40, or 4h): move from column 4 to the foundation/home cell 44 * c (or c0, or ch): move from freecell c to the foundation/home cell 45 46 Besides moves, the following commands are available: 47 48 * h: display a help screen 49 * u: undo the last move (the history is saved from the beginning) 50 * r: restart (undo to the starting playfield) 51 * q: quit the game 52 53 == Compatibility == 54 55 Primary testing was done on nawk and busybox awk, but the game should work 56 correctly on mawk, gawk and any other POSIX-compliant AWK implementation. 57 Particularly, additional tweaking had been done to make sure the game works 58 correctly with gawk --posix and mawk -W posix flags. 59 60 == Credits == 61 62 Created by Luxferre in 2024. Released into public domain. 63