Oliver-Akins / Phantom-Ink-Online

The online prototype for Resonym's game titled Phantom Ink.
http://phantominkgame.com/
6 stars 2 forks source link

Deck drawing #21

Closed Oliver-Akins closed 3 years ago

Oliver-Akins commented 3 years ago

There are two ways that the decks can be drawn from:

  1. Shuffle the array of cards, stays in that order once created. Drawing from one end of the array only.
  2. Don't shuffle the array of cards, stays in the same order as the file is read from. Drawing is done by picking a pseudorandom number for the index of the array.

Both of these have the same time/space complexity in the code, the second one is just a lot easier to implement, the first one, this is because there's really no nice way of shuffling an array in TS, but if there's a chance of there being a "view the top X cards of the deck", then we need to use the first one as the second one will not work for the use case to any degree.

If there are currently no plans for the "view top cards" of the deck I will implement it as option 2, and then if that changes sometime in the future I can revisit the implementation and modify as needed.

Ramenhotep commented 3 years ago

There are currently no plans to "view the top X cards," and honestly I can't imagine a world where we'd want to do that.

The only function I can imagine that even comes close is drawing a sample Object card, but if we ever add that it can just be hardcoded

Oliver-Akins commented 3 years ago

Cool, in that case the Deck object is fine as it is currently. I'll close this issue now that it's resolved.