Solitaire with text-based interface in C
github.com
Solitaire with text-based interface in C
1–10 of 11 posts
Re: Solitaire with text-based interface in C
#2This is a writeup of how the game was made, using the vim+gcc+gdb stack.
Although working on a completely different tech stack at work, I like C, there's something zen-like about being close to the machine and almost universally portable.
Re: Solitaire with text-based interface in C
#3I've just finished implementing my Solitaire game with curses interface in C. Solitaire was the first computer game I have played and I never got around to implementing it. This is a writeup of how the game was made, using the vim+gcc+gdb stack. Although working on a completely different tech stack at work, I like C, there's something zen-like about being close to the machine and almost universally portable.
Re: Solitaire with text-based interface in C
#4fyi I noticed that your mallocz seems to reimplement calloc: https://pubs.opengroup.org/onlinepubs/009695399/functions/ca...
Re: Solitaire with text-based interface in C
#5I probably would have opted for the array representation instead of linked lists, but that is somewhat subjective thing. I do note that each card can be represented by single byte fairly easily (2 bits for suit, 4 bits for rank, 1 bit for revealed (maybe)), which would reduce memory consumption if that is concern. Thinking more of it, I think the whole board-state could be represented with 13+52 byte array, having ma…
A multiple-gap buffer is more difficult to handle than a linked list, yeah.
Re: Solitaire with text-based interface in C
#6Re: Solitaire with text-based interface in C
#7Mac need to use ncurses and no tinfo and not sure the implication.
And do not type c8, segment fault. Thought it use linked list not array ...
Very good game and play a few round
Re: Solitaire with text-based interface in C
#8Good game and good implementation; Mac need to use ncurses and no tinfo and not sure the implication. And do not type c8, segment fault. Thought it use linked list not array ... Very good game and play a few round
Linking without tinfo shouldn’t be a problem
Re: Solitaire with text-based interface in C
#9Good game and good implementation; Mac need to use ncurses and no tinfo and not sure the implication. And do not type c8, segment fault. Thought it use linked list not array ... Very good game and play a few round
Re: Solitaire with text-based interface in C
#10Good game and good implementation; Mac need to use ncurses and no tinfo and not sure the implication. And do not type c8, segment fault. Thought it use linked list not array ... Very good game and play a few round
Thanks for finding the bug - I haven’t caught this one! It crashes because it wasn’t checking the column id, that’s an array of piles in game_state, the piles themselves are linked lists. Linking without tinfo shouldn’t be a problem