Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@individ-divided
Copy link

I've implemented a new gather order that has been been requested in the forums:

Interleaved Decks: Gathers cards by taking one card at a time from each deck in order. This allows new cards to be distributed
evenly across decks. Cards from each subdeck are gathered in ascending position. If the number of decks are not equal to the
daily limit of the selected deck, the last round of cards will be drawn from a random sample of decks.

To make the gather order more predictable, I'm not going to randomize the deck order, instead it is round robin. You can always use the sort order to accomplish random order, so I think this is more useful like this.

I knew about #4352 when I wrote this.

This algorithm is O(n) over time for n: gathered cards.

@individ-divided
Copy link
Author

Please let me know if there are any problems testing-wise with my PR, it tests fine on my end but the github builder does not seem to agree. I read the log but couldn't make any sense of it.

$ ./ninja check
    Finished `release` profile [optimized] target(s) in 0.25s
n2: no work to do

Build succeeded in 0.07s.
$ 

@individ-divided individ-divided marked this pull request as draft January 10, 2026 07:41
@ZornHadNoChoice
Copy link

Hi! I'm not a dev so I'm not sure I understand this correctly (clear examples for all cases would help), but it doesn't seem to do the random picking desired by the links in that topic.

You can always use the sort order to accomplish random order, so I think this is more useful like this.

Part of the request was to preserve the order of the cards within each subdeck, so this wouldn't work.

It's still a nice option to have, just under a different name.

@individ-divided
Copy link
Author

individ-divided commented Jan 10, 2026

@ZornHadNoChoice Yes, you are absolutely right, it does not exactly implement your suggested algorithm. This PR will make it so that if the deck is like this:

 Deck         
 ┣━━Child_1
 ┃  ┗━━Grandchild
 ┗━━Child_2      

Then if there is a limit of 8 cards, they will be drawn like this:

Deck       Card 1
Child_1    Card 1
Grandchild Card 1
Child_2    Card 1
Deck       Card 2
Child_1    Card 2
Grandchild Card 2
Child_2    Card 2

I could implement your algorithm directly, however, hear me out...

There are down-sides to drawing random decks. It's difficult to explain. It is sort of the problem with the long piece in Tetris. I think it might be a mistake to make it completely random. It is random in (original) Tetris, and that is not perceived very well by people. (People do not think it is random, when in fact it is.) And maybe it is not even good game design to have it random. Which is why many modern Tetris have a variety of algorithms. Another example of shuffled lists that are not random are music playlists that are being shuffled with user expectations taken into consideration. (Not the same artist back-to-back, don't repeat sequences, i.e. avoiding behaviors that will appear in uniformally randomized lists, etc.)

So imagine if I made a new sort option that took deck id into consideration, I could theoretically make it shuffle with intra-deck card order preserved. That way it could be the best of two worlds.

Or maybe I could just shuffle all the first cards (Card 1 above), shuffle the second cards (Card 2 above) and so on.

@ZornHadNoChoice
Copy link

In your example, it sounds like 2 cards would be pulled from Child_1 in each "round" (compared to 1 card for Child_2). It doesn't feel better to me.

That said, I'll leave it for folks smarter than me to weigh in.

@individ-divided
Copy link
Author

individ-divided commented Jan 11, 2026

In your example, it sounds like 2 cards would be pulled from Child_1 in each "round" (compared to 1 card for Child_2). It doesn't feel better to me.

No. All decks have two cards drawn from them in total. One deck at a time. There is an equal amount of cards from Child_1 and Child_2. That's by design.

If 8 cards are drawn:

1. One card from Deck       (First card in deck)
2. One card from Child_1    (First card in deck)
3. One card from Grandchild (First card in deck)
4. One card from Child_2    (First card in deck)
5. One card from Deck       (Second card in deck)
6. One card from Child_1    (Second card in deck)
7. One card from Grandchild (Second card in deck)
8. One card from Child_2    (Second card in deck)

@ZornHadNoChoice
Copy link

ZornHadNoChoice commented Jan 11, 2026

You're treating cards in Grandchild as if they're not in Child_1. This may be technically true, but in practice, they are considered Child_1 cards.

Edit: see #4352 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants