nnfc

No-nonsense FreeCell game
git clone git://git.luxferre.top/nnfc.git
Log | Files | Refs

commit 06d1ddbcf3506e4e24592d334573101c8a749b3c
parent 42bcb48ae43b59180aec1ebffc3192fad00747ab
Author: Luxferre <lux@ferre>
Date:   Tue, 16 Jan 2024 12:25:31 +0200

Switched to a bit more standard notation

Diffstat:
Mnnfc.awk | 23++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/nnfc.awk b/nnfc.awk @@ -1,10 +1,10 @@ # no-nonsense FreeCell in POSIX AWK # run as: [n]awk -f nnfc.awk [-v ASCII=1] [-v MONOCHROME=1] [-v SEED=x] # commands: q - quit, u - undo, -# [number] [number] - move from column/freecell to column/freecell/foundation: +# [number][number] - move from column/freecell to column/freecell/foundation: # - 0 is foundation (can be omitted) # - 1 to 8 are column numbers -# - 9 to 12 are freecell numbers +# - a, b, c, d are freecell numbers # SEED variable can be used to init games M$-style # no supermove support for now, need to move cards one at a time # created by Luxferre in 2024, released into public domain @@ -98,11 +98,20 @@ function domove(cmd, valid, nums, from, to, si) { } valid = 0 # invalid by default until all checks are done # if cmd is not q or one of the above, then it must be two numbers - # 1 to 8 is the column (tableau) number - # 9 to 12 are free cell indices, 0 means foundation - split(cmd, nums, " ") # numbers must be space-separated - from = int(nums[1]) # location from which we're moving - to = int(nums[2]) # location to which we're moving + split(cmd, nums, "") # numbers must be space-separated + from = nums[1] # location from which we're moving + to = nums[2] # location to which we're moving + # identify free cells + if(from == "a") from = 9 + if(from == "b") from = 10 + if(from == "c") from = 11 + if(from == "d") from = 12 + if(to == "a") to = 9 + if(to == "b") to = 10 + if(to == "c") to = 11 + if(to == "d") to = 12 + from = int(from) + to = int(to) rfrom = from - 1 # real from location rto = to - 1 # real to location if(from > 0 && from < 13 && to > -1 && to < 13) { # first check