Timeline for UNO for ncurses
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 23, 2017 at 12:41 | history | edited | CommunityBot |
replaced http://stackoverflow.com/ with https://stackoverflow.com/
|
|
Nov 5, 2015 at 1:11 | vote | accept | Earth2 | ||
Nov 4, 2015 at 19:24 | comment | added | Deduplicator | @chux: Yes, for the times it's used at the end of a round, good idea. I must admit that I didn't look at that too hard, as I recommended full replacement ;-) | |
Nov 4, 2015 at 19:19 | comment | added | chux |
In that case, I'd recommend OP's code to go from clean(pile); clean(discard); to clean(pile); pile = NULL; clean(discard); discard = NULL; following the C paradigm that free(ptr); ptr = NULL; ... free(ptr); should not error.
|
|
Nov 4, 2015 at 19:12 | comment | added | Deduplicator | Well, you get the most useful encoding if the colors are in the lowest bits (and I would use manual encoding, probably with a helper for getting the ui-color (black+4), one for getting the card-color (4), and one for getting the symbol). See, then we have: 0..3 invalid 4..11 wild cards 12..23 other special cards 24..63 plain old cards | |
Nov 4, 2015 at 19:05 | comment | added | Earth2 | @Deduplicator I really like the idea of using bit fields to store the cards. Not being well-practiced (yet) in using bit masking myself, would you suggest I use the first two bits for the colors (meaning no flag for "no color"), and the rest for the symbols? | |
Nov 4, 2015 at 18:20 | comment | added | Deduplicator | @chux: That's not a weakness, that's a strength. See stackoverflow.com/questions/33374483/… (Though the link is about Visual-C++ and using C++ not not C, it applies.) | |
Nov 4, 2015 at 18:14 | comment | added | chux |
A weakness to clean(struct Handcard* head) is that although head is free'd, the calling code's head is not affected. By using clean2(struct Handcard** head) , the calling code's clean2(&head) can also result in that head == NULL .
|
|
Nov 4, 2015 at 12:37 | history | edited | Deduplicator | CC BY-SA 3.0 |
added 411 characters in body
|
Nov 4, 2015 at 3:54 | history | answered | Deduplicator | CC BY-SA 3.0 |