News for hackers. Stuff that matters.
Re:Show HN: Deck of Cards – A playing card API by SilasX on Monday May 11, 2015 @04:17AM (#9523320)
I guess shuffles and draws should be their own resources, and you POST to it to do that action? You'd then keep a table of shuffle/draw events, which mutate the deck as a side effect.
Re:Show HN: Deck of Cards – A playing card API by salex89 on Monday May 11, 2015 @04:37AM (#9523367)
I get it. I had an idea to make a "shuffled-copy" or a new deck with one less card, made from the original deck. Than you can theoretical rewind your shuffle process, since it's a chain of immutable decks. But I'm afraid that will really consume too much storage for a rather unimportant thing, at least in this case :) .
Re:Show HN: Deck of Cards – A playing card API by oneeyedpigeon on Monday May 11, 2015 @06:10AM (#9523618)
You could shuffle in a deterministic way, using a smallish seed, and store a list of those seeds which would cut down on storage. I realise that you probably wouldn't want to do this if you're trying to recreate Vegas, but it's an interesting challenge to mull over nonetheless :)