War - Puzzle Discussion

Thank you, I ended up figuring out the solution.

Hello,

At the moment I am at a loss here.
I’ve read basically the whole forum thread and I am still confused as why my long game terminates after 1162 rounds with PAT:

An excerpt from my log

P1 startdeck AH,4H,5D,6D,QC,JS,8S,2D,7D,JD,JC,6C,KS,QS,9D,2C,5S,9S,6S,8H,AD,4D,2H,2S,7S,8C
P2 startdeck 10H,4C,6H,3C,KC,JH,10C,AS,5H,KH,10S,9H,9C,8D,5C,AC,3H,4S,KD,7C,3S,QH,10D,3D,7H,QD
Current battle cards P1:AH P2: 10H
Turn:0=>AH 10H P1 WINS
P1 deck after winning battle 4H,5D,6D,QC,JS,8S,2D,7D,JD,JC,6C,KS,QS,9D,2C,5S,9S,6S,8H,AD,4D,2H,2S,7S,8C,AH,10H
Current battle cards P1:4H P2: 4C
Turn:1=>4H 4C !!!WAR!!!
P1 Wardeck  4H,5D,6D,QC
P2 Wardeck  4C,6H,3C,KC
Deck counts: 23 21
Current battle cards P1:JS P2: JH
Turn:1=>JS JH !!!WAR!!!
P1 Wardeck  4H,5D,6D,QC,JS,8S,2D,7D
P2 Wardeck  4C,6H,3C,KC,JH,10C,AS,5H
Deck counts: 19 17
Current battle cards P1:JD P2: KH
Turn:1=>JD KH P2 WINS
P2 deck after winning war 10S,9H,9C,8D,5C,AC,3H,4S,KD,7C,3S,QH,10D,3D,7H,QD,4H,5D,6D,QC,JS,8S,2D,7D,KH,4H,5D,6D,QC,JS,8S,2D,7D,JD

If I understood correctly, at the moment P2 wins above battle, the cards are added to his deck (queue-wise) like this:

[battlecardP1+3warcardsP1][battlecardP1+3warcardsP1][winningBattleCard**][battlecardP2+3warcardsP2][battlecardP2+3warcardsP2][losingBattleCard**]

** regardless the player.

As some of the posts contradicts other posts I am not sure what the correct order should be.
Anyone out there that’s able to help me out?

Besides that: cases 7-8-9 fails me.
Whereas when I make some changes sometimes 9 will succeed and 8 keeps failing with the dreaded timeout (e.g. it crashes vscode on my local machine if I try to run it there)

Thanks in advance for any reply.

Regarding your log, which test case is it?

The long game

Bonjour ,
Si les administrateurs l’accepte, ci-joint les commentaires de ma gestion des piles de cartes (ps: mon programme fonctionne :slight_smile: )

Bon courage.