batankyu2:
It prolly starts from an sorted fresh new deck at each hand too
As far as sorted fresh decks are concerned,
we can fairly assume that the decks are sorted according to
the encoding of the cards, each card being encoded by an integer in the range 0..51.
The encoding of a deck at poker tables differs from the encoding of a deck at blackjack tables:
-- Poker tables use the following encoding:
2c=00, 3c=01, 4c=02, ..., Qc=10, Kc=11, Ac=12 (clubs)
2d=13, 3d=14, 4d=15, ..., Qd=23, Kd=24, Ad=25 (diams)
2h=26, 3h=27, 4h=28, ..., Qh=36, Kh=37, Ah=38 (hearts)
2s=39, 3s=40, 4s=41, ..., Qs=49, Ks=50, As=51 (spades)
... that is, clubs first, then diams, then hearts, and finally spades, from deuce to ace.
-- Blackjack tables use the following (orthogonal) encoding:
2c=00, 3c=04, 4c=08, ..., Qc=40, Kc=44, Ac=48 (clubs)
2d=01, 3d=05, 4d=09, ..., Qd=41, Kd=45, Ad=49 (diams)
2h=02, 3h=06, 4h=10, ..., Qh=42, Kh=46, Ah=50 (hearts)
2s=03, 3s=07, 4s=11, ..., Qs=43, Ks=47, As=51 (spades)
... that is, deuces first, then treys, ..., then Kings, and finally Aces, from clubs to spades.
A fresh sorted deck is just the sequence of codes:
00, 01, 02, 03, ..., 48 , 49, 50, 51.
Therefore, a fresh poker deck is sorted by suits first: 2c..Ac,2d..Ad,2h..Ah,2s..As.
while a fresh blackjack deck is sorted by ranks first: 2c,2d,2h,2s,....,Ac,Ad,Ah,As.
Then, Fisher-Yates is applied to shuffle them.