]> git.gir.st - solVItaire.git/log
solVItaire.git
5 years agoWIP: freecell implementation (unfinished)
girst [Thu, 14 Feb 2019 20:30:30 +0000 (21:30 +0100)]
WIP: freecell implementation (unfinished)

what's missing:
 - t2t() and corresponding undo_pop()
 - get_cmd() "select from which {cell,foundation}?" dialog
 - some mouse details (term2pile, wait_mouse_up, set_mouse)
 - join() for freecell

no of the additions affect klondike or spider, so its safe to commit.

5 years agojoin() fixes for w2t
girst [Thu, 14 Feb 2019 16:34:44 +0000 (17:34 +0100)]
join() fixes for w2t

you could join onto the waste and if the waste was -1.

5 years agoremove stupid {1, ...} initialisation
girst [Wed, 13 Feb 2019 23:43:24 +0000 (00:43 +0100)]
remove stupid {1, ...} initialisation

5 years agonew todo: freecell
girst [Wed, 13 Feb 2019 17:15:38 +0000 (18:15 +0100)]
new todo: freecell

5 years agoallow disabling visual bell (might change)
girst [Wed, 13 Feb 2019 16:42:24 +0000 (17:42 +0100)]
allow disabling visual bell (might change)

thanks to github user mikezila for the idea. will be replaced by a
less-annoying visbell in the future

5 years agoremove spider.c symlink
girst [Tue, 12 Feb 2019 20:04:42 +0000 (21:04 +0100)]
remove spider.c symlink

let's do the straight-forward thing and just spell out sol.c.

5 years agofix 80 columns, todo->done
girst [Tue, 12 Feb 2019 19:59:55 +0000 (20:59 +0100)]
fix 80 columns, todo->done

5 years agofinish active-cursor-hider
girst [Tue, 12 Feb 2019 19:57:43 +0000 (20:57 +0100)]
finish active-cursor-hider

yeah, it's a hack.

5 years agoWIP: hide active cursor when using mouse (/u/TooEarlyForMe)
girst [Tue, 12 Feb 2019 19:54:07 +0000 (20:54 +0100)]
WIP: hide active cursor when using mouse (/u/TooEarlyForMe)

5 years ago`:help` to show keyhelp (/u/Valley6660)
girst [Tue, 12 Feb 2019 19:41:10 +0000 (20:41 +0100)]
`:help` to show keyhelp (/u/Valley6660)

5 years agoallow using `10` instead of `X` on card face (/u/Valley6660)
girst [Tue, 12 Feb 2019 19:36:06 +0000 (20:36 +0100)]
allow using `10` instead of `X` on card face (/u/Valley6660)

5 years agohide old internal notes
girst [Tue, 12 Feb 2019 18:03:59 +0000 (19:03 +0100)]
hide old internal notes

5 years agoadd keybindings info
girst [Tue, 12 Feb 2019 18:01:28 +0000 (19:01 +0100)]
add keybindings info

5 years ago'join' with right mouse, update keybindings help
girst [Tue, 12 Feb 2019 18:00:38 +0000 (19:00 +0100)]
'join' with right mouse, update keybindings help

5 years agofix segfault when mouse-moving multiple cards to empty tableu
girst [Sun, 3 Feb 2019 16:54:57 +0000 (17:54 +0100)]
fix segfault when mouse-moving multiple cards to empty tableu

the "up to?" dialog calls getch(NULL), which caused a segfault.
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000004030fb in getch (buf=0x0) at spider.c:940
> 940             if (buf[3]) {
> (gdb) bt
> #0  0x00000000004030fb in getch (buf=0x0) at spider.c:940
> #1  0x0000000000402c97 in get_cmd (from=0x7ffeba433bfc, to=0x7ffeba433bf8,
>     opt=0x7ffeba433bf4) at spider.c:808
> #2  0x0000000000400ebf in sol () at spider.c:108
> #3  0x0000000000400e2f in main (argc=2, argv=0x7ffeba433d28) at spider.c:88

5 years agoAdd LICENSE
girst [Sat, 2 Feb 2019 18:39:47 +0000 (19:39 +0100)]
Add LICENSE

this is the first version covered by and released under the terms of the
GNU GPL version 3. Older versions are _not_ relicensed.

5 years agoimprove readme
girst [Sat, 2 Feb 2019 18:39:40 +0000 (19:39 +0100)]
improve readme

5 years agofriendly readme opening
girst [Sat, 2 Feb 2019 18:03:57 +0000 (19:03 +0100)]
friendly readme opening

elevator pitch of the controls

5 years agomouse: allow dragging
girst [Sat, 2 Feb 2019 17:57:04 +0000 (18:57 +0100)]
mouse: allow dragging

one can now drag the mouse cursor from one pile to another and it'll
register as two events and do the right thing.

5 years agohandle SIGTSTP, fix mouse ctrlseq
girst [Sat, 26 Jan 2019 18:44:07 +0000 (19:44 +0100)]
handle SIGTSTP, fix mouse ctrlseq

5 years agocleanup mouse
girst [Tue, 22 Jan 2019 22:07:32 +0000 (23:07 +0100)]
cleanup mouse

still needs some features like dragging and 'if to is empty, how many
cards?'

5 years agomouse mode (needs cleanup)
girst [Tue, 22 Jan 2019 21:59:56 +0000 (22:59 +0100)]
mouse mode (needs cleanup)

5 years agofix overlong lines
girst [Tue, 22 Jan 2019 00:38:35 +0000 (01:38 +0100)]
fix overlong lines

5 years agofix spider foundation printing
girst [Tue, 22 Jan 2019 00:22:36 +0000 (01:22 +0100)]
fix spider foundation printing

5 years agoclean up reworked join
girst [Mon, 21 Jan 2019 23:36:45 +0000 (00:36 +0100)]
clean up reworked join

5 years agorewrite join() prediction engine
girst [Mon, 21 Jan 2019 23:27:27 +0000 (00:27 +0100)]
rewrite join() prediction engine

5 years agofix 'make test'
girst [Mon, 21 Jan 2019 21:16:17 +0000 (22:16 +0100)]
fix 'make test'

symlink duplicated all TODOs in sol.c

5 years agojoin: in SPIDER, prefer completing a stack
girst [Mon, 21 Jan 2019 21:12:13 +0000 (22:12 +0100)]
join: in SPIDER, prefer completing a stack

5 years agobetter join for klondike
girst [Mon, 21 Jan 2019 20:45:36 +0000 (21:45 +0100)]
better join for klondike

join to foundation, better to-tableu join

5 years agoallow joining to foundation
girst [Mon, 21 Jan 2019 19:59:36 +0000 (20:59 +0100)]
allow joining to foundation

5 years agoallow inverted moves
girst [Mon, 21 Jan 2019 18:39:09 +0000 (19:39 +0100)]
allow inverted moves

5 years agouse getch() everywhere
girst [Mon, 21 Jan 2019 18:29:49 +0000 (19:29 +0100)]
use getch() everywhere

except for inside getch(), of course. where no mouse is needed, one can
pass NULL instead of a buffer; KEY_INVAL will then be returned if a
mouse click was received.

5 years agosupport 'real' cursor keys
girst [Mon, 21 Jan 2019 18:19:16 +0000 (19:19 +0100)]
support 'real' cursor keys

keyhandling imported from minesviiper (minor changes); mouse support
stubbed.

5 years agomake Makefile portable
girst [Mon, 21 Jan 2019 16:21:04 +0000 (17:21 +0100)]
make Makefile portable

apparently, the "prerequisite name != target rule name" only works in
GNU make. symlinking sol.c to spider.c and changing the makefile works.

5 years agoimplement restart same game, increase portability, update TODOs
girst [Sun, 20 Jan 2019 23:44:15 +0000 (00:44 +0100)]
implement restart same game, increase portability, update TODOs

 * use rand() instead of random() to get in line with mines and viiper
 * reorder playfield struct for better alignment
 * remove ignore warnings pragma (not needed any more)
 * remove _POSIX_C_SOURCE feture test (not needed and breaks freebsd)

5 years agofix off-by-one
girst [Sun, 20 Jan 2019 23:11:49 +0000 (00:11 +0100)]
fix off-by-one

cursor could 'escape' the playfield in KLONDIKE

5 years agoactually useful CMD_JOIN implementation
girst [Sun, 20 Jan 2019 23:09:07 +0000 (00:09 +0100)]
actually useful CMD_JOIN implementation

5 years agofirst version of join() -- to be replaced
girst [Sun, 20 Jan 2019 20:32:24 +0000 (21:32 +0100)]
first version of join() -- to be replaced

this version is very suboptimal. we shouldn't take from longest piles,
as that will rip apart already constructed piles. instead, take from
piles where the card we want to move has the least amount of movable
cards _above_ it. even better if the card above is closed. even better
yet if there is no card above (resulting in an empty pile)

5 years agoautomagic conserve space
girst [Sun, 20 Jan 2019 18:50:19 +0000 (19:50 +0100)]
automagic conserve space

only when the window size would be too small to display a pile
completely. still has the problem that sometimes the terminal is too
small for even the extreme overlap.

5 years agoimplement 'M' keybinding
girst [Sun, 20 Jan 2019 18:00:02 +0000 (19:00 +0100)]
implement 'M' keybinding

moves active cursor to the centre pile

5 years agorework command line arguments
girst [Sun, 20 Jan 2019 17:15:37 +0000 (18:15 +0100)]
rework command line arguments

don't require long string arguments

5 years agofix BULCARD() padding
girst [Sun, 20 Jan 2019 17:05:52 +0000 (18:05 +0100)]
fix BULCARD() padding

using ESC produces tofu on some terminal emulators. switching to SI
(Switch To Standard Charset) for padding seems to work better. (SI
should have no effect on Unicode terminal emulators). this also made
detecting the padded lines easier, as \017 (SI) is only appearing in
those.

5 years agofix foundation rendering (SPIDER)
girst [Sat, 19 Jan 2019 16:37:02 +0000 (17:37 +0100)]
fix foundation rendering (SPIDER)

by using a static int to store the foundation index, it couldn't be
reset when a new game was started. this caused the first pile to be e.g.
to end up on the second foundation if the game before had 1 completed.

5 years agofix bold hack; extreme overlap: always show top selected card
girst [Fri, 11 Jan 2019 20:29:48 +0000 (21:29 +0100)]
fix bold hack; extreme overlap: always show top selected card

5 years agofix broken halfcard rendering
girst [Thu, 10 Jan 2019 14:16:31 +0000 (15:16 +0100)]
fix broken halfcard rendering

due to the faint hack, black cards were 1 byte shorter than red cards.
this meant, that the offset for halfcard was off for red colors (as it
has been adjusted for black cards), which caused printing errors in
spider's foundation for overlapping red cards. can't pad with zero bytes
(as that would end the string), but using an extra escape seems to be OK
for xterm and vte-based terminals.

5 years agoupdate TODOs
girst [Tue, 8 Jan 2019 19:30:06 +0000 (20:30 +0100)]
update TODOs

5 years agoassimilate remove_if_complete
girst [Tue, 8 Jan 2019 18:21:18 +0000 (19:21 +0100)]
assimilate remove_if_complete

so spider's "double-click" action has the same feedback as sol's.

5 years agoawful hack that un-breaks faint+bold printing
girst [Mon, 7 Jan 2019 17:12:55 +0000 (18:12 +0100)]
awful hack that un-breaks faint+bold printing

bold and faint can bet set individually, but only reset both at once.
this causes the bold attribute (useful for determining with cards are
movable) to be reset when faint was. we are splitting the string at a
known-whitespace position only if we are at the faint printed lines
(str[n]==033).

5 years agofix turn over bug
girst [Mon, 7 Jan 2019 14:20:01 +0000 (15:20 +0100)]
fix turn over bug

5 years agoundo for spider
girst [Mon, 7 Jan 2019 14:11:09 +0000 (15:11 +0100)]
undo for spider

note that there is a bug in turn-over-detection when to==FOUNDATATION[0]

5 years agoproperly free undo allocations
girst [Mon, 7 Jan 2019 13:16:33 +0000 (14:16 +0100)]
properly free undo allocations

5 years agoimplement undo for KLONDIKE
girst [Mon, 7 Jan 2019 13:03:38 +0000 (14:03 +0100)]
implement undo for KLONDIKE

for now, redo has been scrapped (would require an additional field in
f., and I don't see the need)

5 years agoimplement 'up to' space/return
girst [Sun, 6 Jan 2019 00:14:45 +0000 (01:14 +0100)]
implement 'up to' space/return

5 years agoremove redundant display calls
girst [Sun, 6 Jan 2019 00:06:14 +0000 (01:06 +0100)]
remove redundant display calls

5 years agoundo_pop pseudo implementation
girst [Sat, 5 Jan 2019 23:58:25 +0000 (00:58 +0100)]
undo_pop pseudo implementation

5 years agomove data structure definition into .h
girst [Sat, 5 Jan 2019 23:09:32 +0000 (00:09 +0100)]
move data structure definition into .h

can't declare functions otherwise :|
forward declarations are a mess!

5 years agorename append_undo to undo_push; subs for undo_pop, free_undo
girst [Sat, 5 Jan 2019 22:57:31 +0000 (23:57 +0100)]
rename append_undo to undo_push; subs for undo_pop, free_undo

5 years agosquash another bug
girst [Sat, 5 Jan 2019 22:01:18 +0000 (23:01 +0100)]
squash another bug

what did that semicolon here!?
note that WASTE is not -1 but 0, as it is used as the second index into
action[][]

5 years agofix is_movable
girst [Sat, 5 Jan 2019 21:43:36 +0000 (22:43 +0100)]
fix is_movable

that's why I don't want to refactor these functions.
remember that comment?
> not extensively tested, but should work(TM)
yeah.

5 years agoadd append_undo() to all x2y() functions
girst [Sat, 5 Jan 2019 20:58:26 +0000 (21:58 +0100)]
add append_undo() to all x2y() functions

one ugly hack: w2f() in klondike; the option field needs to encode both,
the uglyest scheme was chosen out of spite to my lack of planning ahead.

5 years agoadd missing function declaration to .h
girst [Sat, 5 Jan 2019 20:58:05 +0000 (21:58 +0100)]
add missing function declaration to .h

5 years agocomments on the undo feature
girst [Sat, 5 Jan 2019 19:46:43 +0000 (20:46 +0100)]
comments on the undo feature

5 years agoupdate TODOs
girst [Sat, 5 Jan 2019 19:06:45 +0000 (20:06 +0100)]
update TODOs

5 years agoadd vim folds and organize code a bit
girst [Sat, 5 Jan 2019 18:51:33 +0000 (19:51 +0100)]
add vim folds and organize code a bit

emphasis being on "a bit".

5 years agofactor out rank comparison
girst [Sat, 5 Jan 2019 18:41:31 +0000 (19:41 +0100)]
factor out rank comparison

not extensively tested, but should work(TM)

5 years agofix ex commands not displaying, end screen cut off placeholders
girst [Sat, 5 Jan 2019 18:14:43 +0000 (19:14 +0100)]
fix ex commands not displaying, end screen cut off placeholders

5 years agoex command mode
girst [Fri, 4 Jan 2019 19:24:26 +0000 (20:24 +0100)]
ex command mode

5 years agoremove interactive key help
girst [Fri, 4 Jan 2019 19:15:28 +0000 (20:15 +0100)]
remove interactive key help

5 years agochange unicode_large_color, implement extreme overlap heuristic
girst [Fri, 4 Jan 2019 19:08:22 +0000 (20:08 +0100)]
change unicode_large_color, implement extreme overlap heuristic

colorscheme was unusable on white-bg terminals; extreme overlap must be
enabled with -oconsv (conserve vertical space), cutoff was chosen
arbitrarily

5 years agoadd signal handler, atexit, more vimkeys
girst [Fri, 4 Jan 2019 18:16:27 +0000 (19:16 +0100)]
add signal handler, atexit, more vimkeys

5 years agoimplement getopt, restarting, help
girst [Fri, 4 Jan 2019 17:30:07 +0000 (18:30 +0100)]
implement getopt, restarting, help

5 years agocleanup cursor addressing
girst [Fri, 4 Jan 2019 16:47:53 +0000 (17:47 +0100)]
cleanup cursor addressing

bugs squashed, looks a bit better too :)

5 years agocursor keys (hjkl) first pass
girst [Fri, 4 Jan 2019 14:50:37 +0000 (15:50 +0100)]
cursor keys (hjkl) first pass

still needs cleanup, some minor bugs (e.g. direct -> cursor/empty in
spider doesn't work)

5 years agoimplement extreme overlap
girst [Mon, 3 Dec 2018 22:47:11 +0000 (23:47 +0100)]
implement extreme overlap

still needs the 'when to activate' heuristic

5 years agocancel command w/ space; comment cleanup
girst [Mon, 3 Dec 2018 21:40:22 +0000 (22:40 +0100)]
cancel command w/ space; comment cleanup

5 years agocleanup spider:foundation
girst [Mon, 3 Dec 2018 21:29:15 +0000 (22:29 +0100)]
cleanup spider:foundation

5 years agofix spider:foundation-overlap for unicode_small_mono (req. cleanup)
girst [Mon, 3 Dec 2018 20:41:02 +0000 (21:41 +0100)]
fix spider:foundation-overlap for unicode_small_mono (req. cleanup)

5 years agoput is_consecutive() in sol.h
girst [Sun, 2 Dec 2018 18:37:23 +0000 (19:37 +0100)]
put is_consecutive() in sol.h

5 years agosimplify empty tableu handling
girst [Sun, 2 Dec 2018 18:03:07 +0000 (19:03 +0100)]
simplify empty tableu handling

5 years agodon't check if stock empty
girst [Sun, 2 Dec 2018 17:51:41 +0000 (18:51 +0100)]
don't check if stock empty

can't reverse-look through the stack otherwise

5 years ago"optimize" foundationcheck to near unreadability
girst [Sun, 2 Dec 2018 17:45:06 +0000 (18:45 +0100)]
"optimize" foundationcheck to near unreadability

just for fun.

5 years agoklondike: autoselect foundation (to tableu) if possible
girst [Sun, 2 Dec 2018 17:36:21 +0000 (18:36 +0100)]
klondike: autoselect foundation (to tableu) if possible

5 years agospider: auto-move to empty if possible
girst [Sun, 2 Dec 2018 16:23:25 +0000 (17:23 +0100)]
spider: auto-move to empty if possible

5 years agomove getchar() out of x2y() functions
girst [Fri, 30 Nov 2018 10:53:54 +0000 (11:53 +0100)]
move getchar() out of x2y() functions

also some minor stuff (remove remnant of deal() tester, untested
spider:remove-after-stockdeal)

5 years agodon't allow taking from empty piles (ugly)
girst [Thu, 29 Nov 2018 13:11:16 +0000 (14:11 +0100)]
don't allow taking from empty piles (ugly)

5 years agofix `make getfuns`
girst [Thu, 29 Nov 2018 12:51:49 +0000 (13:51 +0100)]
fix `make getfuns`

5 years agoupdate undo data structure (comments only)
girst [Thu, 29 Nov 2018 12:25:33 +0000 (13:25 +0100)]
update undo data structure (comments only)

5 years agospider:overlapping foundation
girst [Thu, 29 Nov 2018 12:08:25 +0000 (13:08 +0100)]
spider:overlapping foundation

5 years agosimplify movable-bold
girst [Thu, 29 Nov 2018 10:51:04 +0000 (11:51 +0100)]
simplify movable-bold

5 years agooverlap stack in spider, some scaffolding for overlapping spider foundation
girst [Mon, 26 Nov 2018 17:47:06 +0000 (18:47 +0100)]
overlap stack in spider, some scaffolding for overlapping spider foundation

5 years agospider fixes, show spider stock, makefile test lineno
girst [Mon, 26 Nov 2018 17:18:15 +0000 (18:18 +0100)]
spider fixes, show spider stock, makefile test lineno

5 years agomake movable cards bold (useful in spider)
girst [Mon, 26 Nov 2018 17:13:43 +0000 (18:13 +0100)]
make movable cards bold (useful in spider)

this breaks 'non-bright white' color of the black cards, they now appear
white. :/ using 'bright black' is a bit too dark for my liking.

5 years agofix cursor hidden after exiting from win_anim()
girst [Mon, 26 Nov 2018 16:57:02 +0000 (17:57 +0100)]
fix cursor hidden after exiting from win_anim()

5 years agofix off by one in spider remove_if_complete()
girst [Fri, 9 Nov 2018 11:10:10 +0000 (12:10 +0100)]
fix off by one in spider remove_if_complete()

5 years agofix check_won
girst [Tue, 6 Nov 2018 12:38:44 +0000 (13:38 +0100)]
fix check_won

5 years agofix SEGV in spider
girst [Mon, 5 Nov 2018 15:35:14 +0000 (16:35 +0100)]
fix SEGV in spider

waste was defined as 11, but action[][] is only 10 wide. m(

5 years agorestructure todos
girst [Sun, 4 Nov 2018 23:25:07 +0000 (00:25 +0100)]
restructure todos

5 years agoremove "off-by-one", robust(er) get_cmd()
girst [Sun, 4 Nov 2018 21:03:44 +0000 (22:03 +0100)]
remove "off-by-one", robust(er) get_cmd()

5 years agohighlighting (dirty alpha), fix remove_if_complete, find_top
girst [Sun, 4 Nov 2018 17:02:12 +0000 (18:02 +0100)]
highlighting (dirty alpha), fix remove_if_complete, find_top

5 years agoonly reset fg-color, not all attributes
girst [Sun, 4 Nov 2018 16:59:16 +0000 (17:59 +0100)]
only reset fg-color, not all attributes

Imprint / Impressum