War - Puzzle Discussion


#108

I'm not sure what's wrong with your input, but each player has 9 cards in that test case, not 6.
P1 has: 8C, KD, AH, QH, 3D, KD, AH, QH, 6D
P2 has: 8D, 2D, 3H, 4D, 3S, 2D, 3H, 4D, 7H

8C vs. 8D: WAR
8C, KD, AH, QH and 8D, 2D, 3H, 4D go to each "war deck"
Next they draw: 3D, 3S: WAR
3D, KD, AH, QH and 3S, 2D, 3H, 4D go to each "war deck"
Next they draw: 6D, 7H: Player 2 wins and gets everything.

Maybe there is something wrong when you read the input?

Edit: Looks like all cards which go into the war deck are duplicates. Do you possibly have a unique check somewhere?


#110

Wow… Come on !! Thank you Garrincha !!


#111

you are probably dealing the card in the opposite order


#112

Not as useless as you might think !
What was your problem? Because I probably have the same.


#114

I was confused by this game, because I did not return the 3 cards one by one (making things complex for realistic when the algo is simple).
It would have been better with clear examples :wink: