[Math] Probability of getting “war” in a Game of War (card game)

probability

I am coding War as a game, and I was wondering what the probability of getting "war" would be. I am probably wrong, but when each player has 26 cards (52/2), the chance of getting the same card value (like 2x Jacks), would that be 100/26 = 3.84615385%?

I assume not, because: Each game loses at least 2 cards from the total, which would make the next iteration be 100/25 = 4% chance of starting a war. The next would then be 100/24… I think you get the point. When both players have 1 card (assuming you don't steal the cards), the chance of starting a war would be 100/1 = 100%, which is wrong.

How am I supposed to calculate this correctly? I want to know the probability of starting a war (2 of the same cards) as well as the probability of starting a war within a war (2 of the same cards within a started war). Thanks in advance!

EDIT: Oh I think I forgot this: https://en.wikipedia.org/wiki/War_(card_game)#Gameplay

EDIT 2: If we assume there are 52 cards total and I pick a random card. Then there are 51 cards left in the deck. 3 of those have the same value as my card, which makes that a 3/51 = 0.0588235294% chance of starting a war.

Best Answer

The probability of getting a war on the first hand is 1/17 because whatever Player 1 card is there are 3 out of 51 cards that are the same rank.

From then on it's complicated conditional probabilities.

Call Player 1's first card R1, and Players 2's first card S1. If R1 $\ne$ S1 (16/17 probability) and Players 2's second card (R2) is neither R1 nor R2 (a 44/50 = 22/25 probability) then there 3/49 probability that player 2's second card is a war (16/17*22/25*3/49). But if R2 = (R1 or S1) (a 6/50 = 3/25 probability then there is a 2/49 that the second hand is a war. Or

So the probability of hand1 not a war hand2 being war is 16/17(22/25*3/49 + 3/25*2/49).

But if hand1 was a war the probability of the second hand being a war is: if R2 = R1 = S1, (a 2/50 = 1/25 probability) then the probability is 1/49 (total: 1/17*1/25*1/49) but if R2 $ne$ R1 (a 48/50 = 24/25 probability) then the probability of a war is 3/49 (total: 1/17*24/25*3/49)

So the probability of hand 2 being a war is

16/17(22/25*3/49 + 3/25*2/49) + 1/17(1/25*1/49 + 24/25*3/49) =

(16(22*3 + 3*2) + 1 + 24*3)/(17*25*49)=

(16(72)+72 + 1)/17*25*49 = (17*72 + 1)/17*25*49 = 1/17

So basically every hand the probability of a war is 1/17.