4 ms·
Not that I had a similar situation, but how to implement actions such as shuffle or draw and make them-resource like?
by salex89 11y ago
Not that I had a similar situation, but how to implement actions such as shuffle or draw and make them-resource like?
- SilasX 11y agoI 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.
- salex89 11y agoI 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 :) .
- oneeyedpigeon 11y agoYou 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 :)