War card game: Difference between revisions

From Rosetta Code
Content added Content deleted
(Created page with "Category: Card Games {{draft task}} War Card Game Simulate the card game War. Use the Bicycle playing card manufacturer's rules. Show a game as played. User input is o...")
 
Line 84: Line 84:
Q♣ 2♠ Player 1 takes the cards.
Q♣ 2♠ Player 1 takes the cards.
10♥ 6♣ Player 1 takes the cards.
10♥ 6♣ Player 1 takes the cards.

J♦ 10♣ Player 1 takes the cards.
... many other lines ...
7♥ 6♠ Player 1 takes the cards.

7♣ A♦ Player 2 takes the cards.
J♥ K♠ Player 2 takes the cards.
Q♥ 7♠ Player 1 takes the cards.
7♦ 10♠ Player 2 takes the cards.
5♦ K♥ Player 2 takes the cards.
3♥ 8♥ Player 2 takes the cards.
8♦ K♦ Player 2 takes the cards.
2♦ 5♠ Player 2 takes the cards.
J♣ 6♥ Player 1 takes the cards.
5♥ 3♦ Player 1 takes the cards.
A♠ J♠ Player 1 takes the cards.
4♦ 9♣ Player 2 takes the cards.
9♠ 4♥ Player 1 takes the cards.
9♦ 3♠ Player 1 takes the cards.
3♣ A♣ Player 2 takes the cards.
8♣ 9♥ Player 2 takes the cards.
4♠ Q♠ Player 2 takes the cards.
2♥ 5♣ Player 2 takes the cards.
A♥ 8♠ Player 1 takes the cards.
2♣ 6♦ Player 2 takes the cards.
Q♣ 10♦ Player 1 takes the cards.
2♠ 4♣ Player 2 takes the cards.
10♥ K♣ Player 2 takes the cards.
6♣ Q♦ Player 2 takes the cards.
J♦ A♦ Player 2 takes the cards.
10♣ 7♣ Player 1 takes the cards.
7♥ K♠ Player 2 takes the cards.
6♠ J♥ Player 2 takes the cards.
Q♥ 10♠ Player 1 takes the cards.
7♠ 7♦ Tie!
? ? Cards are face down.
6♥ 5♦ Player 1 takes the cards.
5♥ 8♥ Player 2 takes the cards.
3♦ 3♥ Tie!
? ? Cards are face down.
J♠ 8♦ Player 1 takes the cards.
9♠ 5♠ Player 1 takes the cards.
4♥ 2♦ Player 1 takes the cards.
9♦ 9♣ Tie!
? ? Cards are face down.
A♥ A♣ Tie!
? ? Cards are face down.
Q♣ 9♥ Player 1 takes the cards.
10♦ 8♣ Player 1 takes the cards.
10♣ Q♠ Player 2 takes the cards.
7♣ 4♠ Player 1 takes the cards.
Q♥ 5♣ Player 1 takes the cards.
10♠ 2♥ Player 1 takes the cards.
6♥ 6♦ Tie!
? ? Cards are face down.
7♠ 4♣ Player 1 takes the cards.
7♦ 2♠ Player 1 takes the cards.
J♣ K♣ Player 2 takes the cards.
K♥ 10♥ Player 1 takes the cards.
J♠ Q♦ Player 2 takes the cards.
8♦ 6♣ Player 1 takes the cards.
3♦ A♦ Player 2 takes the cards.
3♥ J♦ Player 2 takes the cards.
A♠ K♠ Player 1 takes the cards.
K♦ 7♥ Player 1 takes the cards.
9♠ J♥ Player 2 takes the cards.
5♠ 6♠ Player 2 takes the cards.
4♥ 8♥ Player 2 takes the cards.
2♦ 5♥ Player 2 takes the cards.
Q♣ Q♠ Tie!
? ? Cards are face down.
9♦ K♣ Player 2 takes the cards.
9♣ J♣ Player 2 takes the cards.
3♠ Q♦ Player 2 takes the cards.
4♦ J♠ Player 2 takes the cards.
A♥ A♦ Tie!
? ? Cards are face down.
8♠ J♦ Player 2 takes the cards.
3♣ 3♥ Tie!
? ? Cards are face down.
8♣ 9♠ Player 2 takes the cards.
7♣ 6♠ Player 1 takes the cards.
4♠ 5♠ Player 2 takes the cards.
Q♥ 8♥ Player 1 takes the cards.
5♣ 4♥ Player 1 takes the cards.
10♠ 5♥ Player 1 takes the cards.
2♥ 2♦ Tie!
? ? Cards are face down.
4♣ 9♦ Player 2 takes the cards.
6♥ Q♣ Player 2 takes the cards.
6♦ Q♠ Player 2 takes the cards.
5♦ 9♥ Player 2 takes the cards.
2♣ 10♣ Player 2 takes the cards.
7♦ J♣ Player 2 takes the cards.
2♠ 9♣ Player 2 takes the cards.
K♥ Q♦ Player 1 takes the cards.
10♥ 3♠ Player 1 takes the cards.
8♦ J♠ Player 2 takes the cards.
6♣ 4♦ Player 1 takes the cards.
A♠ J♦ Player 1 takes the cards.
K♠ 8♠ Player 1 takes the cards.
K♦ A♥ Player 2 takes the cards.
7♥ A♦ Player 2 takes the cards.
7♣ A♣ Player 2 takes the cards.
6♠ 3♦ Player 1 takes the cards.
Q♥ 9♠ Player 1 takes the cards.
8♥ 8♣ Tie!
? ? Cards are face down.
4♥ 3♥ Player 1 takes the cards.
10♠ 10♦ Tie!
? ? Cards are face down.
K♥ 5♠ Player 1 takes the cards.
Q♦ 4♠ Player 1 takes the cards.
10♥ 9♦ Player 1 takes the cards.
3♠ 4♣ Player 2 takes the cards.
6♣ 2♥ Player 1 takes the cards.
4♦ 2♦ Player 1 takes the cards.
A♠ 7♠ Player 1 takes the cards.
J♦ K♣ Player 2 takes the cards.
K♠ Q♣ Player 1 takes the cards.
8♠ 6♥ Player 1 takes the cards.
6♠ Q♠ Player 2 takes the cards.
3♦ 6♦ Player 2 takes the cards.
Q♥ 9♥ Player 1 takes the cards.
9♠ 5♦ Player 1 takes the cards.
4♥ 10♣ Player 2 takes the cards.
3♥ 2♣ Player 1 takes the cards.
8♥ J♣ Player 2 takes the cards.
8♣ 7♦ Player 1 takes the cards.
5♣ 9♣ Player 2 takes the cards.
3♣ 2♠ Player 1 takes the cards.
K♥ J♠ Player 1 takes the cards.
5♠ 8♦ Player 2 takes the cards.
10♠ A♥ Player 2 takes the cards.
10♦ K♦ Player 2 takes the cards.
5♥ A♦ Player 2 takes the cards.
J♥ 7♥ Player 1 takes the cards.
Q♦ A♣ Player 2 takes the cards.
4♠ 7♣ Player 2 takes the cards.
10♥ 4♣ Player 1 takes the cards.
9♦ 3♠ Player 1 takes the cards.
6♣ K♣ Player 2 takes the cards.
2♥ J♦ Player 2 takes the cards.
4♦ Q♠ Player 2 takes the cards.
2♦ 6♠ Player 2 takes the cards.
A♠ 6♦ Player 1 takes the cards.
7♠ 3♦ Player 1 takes the cards.
K♠ 10♣ Player 1 takes the cards.
Q♣ 4♥ Player 1 takes the cards.
8♠ J♣ Player 2 takes the cards.
6♥ 8♥ Player 2 takes the cards.
Q♥ 9♣ Player 1 takes the cards.
9♥ 5♣ Player 1 takes the cards.
9♠ 8♦ Player 1 takes the cards.
5♦ 5♠ Tie!
? ? Cards are face down.
2♣ 10♠ Player 2 takes the cards.
8♣ K♦ Player 2 takes the cards.
7♦ 10♦ Player 2 takes the cards.
3♣ A♦ Player 2 takes the cards.
2♠ 5♥ Player 2 takes the cards.
K♥ A♣ Player 2 takes the cards.
J♠ Q♦ Player 2 takes the cards.
J♥ 7♣ Player 1 takes the cards.
7♥ 4♠ Player 1 takes the cards.
10♥ K♣ Player 2 takes the cards.
4♣ 6♣ Player 2 takes the cards.
9♦ J♦ Player 2 takes the cards.
3♠ 2♥ Player 1 takes the cards.
A♠ Q♠ Player 1 takes the cards.
6♦ 4♦ Player 1 takes the cards.
7♠ 6♠ Player 1 takes the cards.
3♦ 2♦ Player 1 takes the cards.
K♠ J♣ Player 1 takes the cards.
10♣ 8♠ Player 1 takes the cards.
Q♣ 8♥ Player 1 takes the cards.
4♥ 6♥ Player 2 takes the cards.
Q♥ 10♠ Player 1 takes the cards.
9♣ 2♣ Player 1 takes the cards.
9♥ 5♦ Player 1 takes the cards.
5♣ 5♠ Tie!
? ? Cards are face down.
8♦ A♥ Player 2 takes the cards.
J♥ K♦ Player 2 takes the cards.
7♣ 8♣ Player 2 takes the cards.
7♥ 10♦ Player 2 takes the cards.
4♠ 7♦ Player 2 takes the cards.
3♠ A♦ Player 2 takes the cards.
2♥ 3♣ Player 2 takes the cards.
A♠ 5♥ Player 1 takes the cards.
Q♠ 2♠ Player 1 takes the cards.
6♦ A♣ Player 2 takes the cards.
4♦ K♥ Player 2 takes the cards.
7♠ Q♦ Player 2 takes the cards.
6♠ J♠ Player 2 takes the cards.
3♦ K♣ Player 2 takes the cards.
2♦ 10♥ Player 2 takes the cards.
K♠ 6♣ Player 1 takes the cards.
J♣ 4♣ Player 1 takes the cards.
10♣ J♦ Player 2 takes the cards.
8♠ 9♦ Player 2 takes the cards.
Q♣ 6♥ Player 1 takes the cards.
8♥ 4♥ Player 1 takes the cards.
Q♥ A♥ Player 2 takes the cards.
10♠ 8♦ Player 1 takes the cards.
9♣ 5♣ Player 1 takes the cards.
2♣ 5♠ Player 2 takes the cards.
9♥ 9♠ Tie!
? ? Cards are face down.
A♠ K♦ Player 1 takes the cards.
5♥ J♥ Player 2 takes the cards.
Q♠ 8♣ Player 1 takes the cards.
2♠ 7♣ Player 2 takes the cards.
K♠ 10♦ Player 1 takes the cards.
6♣ 7♥ Player 2 takes the cards.
J♣ 7♦ Player 1 takes the cards.
4♣ 4♠ Tie!
? ? Cards are face down.
6♥ 3♠ Player 1 takes the cards.
8♥ 3♣ Player 1 takes the cards.
4♥ 2♥ Player 1 takes the cards.
10♠ A♣ Player 2 takes the cards.
8♦ 6♦ Player 1 takes the cards.
9♣ K♥ Player 2 takes the cards.
5♣ 4♦ Player 1 takes the cards.
A♠ Q♦ Player 1 takes the cards.
K♦ 7♠ Player 1 takes the cards.
9♥ J♠ Player 2 takes the cards.
9♠ 6♠ Player 1 takes the cards.
5♦ K♣ Player 2 takes the cards.
3♥ 3♦ Tie!
? ? Cards are face down.
8♣ 2♦ Player 1 takes the cards.
K♠ J♦ Player 1 takes the cards.
10♦ 10♣ Tie!
? ? Cards are face down.
7♦ 8♠ Player 2 takes the cards.
6♥ A♥ Player 2 takes the cards.
3♠ Q♥ Player 2 takes the cards.
4♣ 5♠ Player 2 takes the cards.
4♠ 2♣ Player 1 takes the cards.
Q♣ J♥ Player 1 takes the cards.
A♦ 5♥ Player 1 takes the cards.
8♥ 7♣ Player 1 takes the cards.
3♣ 2♠ Player 1 takes the cards.
4♥ 7♥ Player 2 takes the cards.
2♥ 6♣ Player 2 takes the cards.
8♦ A♣ Player 2 takes the cards.
6♦ 10♠ Player 2 takes the cards.
5♣ K♥ Player 2 takes the cards.
4♦ 9♣ Player 2 takes the cards.
A♠ J♠ Player 1 takes the cards.
Q♦ 9♥ Player 1 takes the cards.
K♦ K♣ Tie!
? ? Cards are face down.
9♠ 8♠ Player 1 takes the cards.
6♠ 7♦ Player 2 takes the cards.
8♣ 10♦ Player 2 takes the cards.
2♦ 10♣ Player 2 takes the cards.
3♥ J♣ Player 2 takes the cards.
3♦ 9♦ Player 2 takes the cards.
Q♠ A♥ Player 2 takes the cards.
10♥ 6♥ Player 1 takes the cards.
K♠ Q♥ Player 1 takes the cards.
J♦ 3♠ Player 1 takes the cards.
4♠ 5♠ Player 2 takes the cards.
2♣ 4♣ Player 2 takes the cards.
Q♣ 7♥ Player 1 takes the cards.
J♥ 4♥ Player 1 takes the cards.
A♦ 6♣ Player 1 takes the cards.
5♥ 2♥ Player 1 takes the cards.
8♥ A♣ Player 2 takes the cards.
7♣ 8♦ Player 2 takes the cards.
3♣ 10♠ Player 2 takes the cards.
2♠ 6♦ Player 2 takes the cards.
A♠ K♥ Player 1 takes the cards.
J♠ 5♣ Player 1 takes the cards.
Q♦ 9♣ Player 1 takes the cards.
9♥ 4♦ Player 1 takes the cards.
9♠ 7♦ Player 1 takes the cards.
8♠ 6♠ Player 1 takes the cards.
K♦ 10♦ Player 1 takes the cards.
K♣ 8♣ Player 1 takes the cards.
7♠ 10♣ Player 2 takes the cards.
5♦ 2♦ Player 1 takes the cards.
10♥ J♣ Player 2 takes the cards.
6♥ 3♥ Player 1 takes the cards.
K♠ 9♦ Player 1 takes the cards.
Q♥ 3♦ Player 1 takes the cards.
J♦ A♥ Player 2 takes the cards.
3♠ Q♠ Player 2 takes the cards.
Q♣ 5♠ Player 1 takes the cards.
7♥ 4♠ Player 1 takes the cards.
J♥ 4♣ Player 1 takes the cards.
4♥ 2♣ Player 1 takes the cards.
A♦ A♣ Tie!
? ? Cards are face down.
5♥ 8♦ Player 2 takes the cards.
2♥ 7♣ Player 2 takes the cards.
A♠ 10♠ Player 1 takes the cards.
K♥ 3♣ Player 1 takes the cards.
J♠ 6♦ Player 1 takes the cards.
5♣ 2♠ Player 1 takes the cards.
Q♦ 10♣ Player 1 takes the cards.
9♣ 7♠ Player 1 takes the cards.
9♥ J♣ Player 2 takes the cards.
4♦ 10♥ Player 2 takes the cards.
9♠ A♥ Player 2 takes the cards.
7♦ J♦ Player 2 takes the cards.
8♠ Q♠ Player 2 takes the cards.
6♠ 3♠ Player 1 takes the cards.
K♦ 8♦ Player 1 takes the cards.
10♦ 5♥ Player 1 takes the cards.
K♣ A♦ Player 2 takes the cards.
8♣ A♣ Player 2 takes the cards.
5♦ 6♣ Player 2 takes the cards.
2♦ 8♥ Player 2 takes the cards.
6♥ 7♣ Player 2 takes the cards.
3♥ 2♥ Player 1 takes the cards.
K♠ J♣ Player 1 takes the cards.
9♦ 9♥ Tie!
? ? Cards are face down.
3♦ 4♦ Player 2 takes the cards.
Q♣ A♥ Player 2 takes the cards.
5♠ 9♠ Player 2 takes the cards.
7♥ J♦ Player 2 takes the cards.
4♠ 7♦ Player 2 takes the cards.
J♥ Q♠ Player 2 takes the cards.
4♣ 8♠ Player 2 takes the cards.
4♥ A♦ Player 2 takes the cards.
2♣ K♣ Player 2 takes the cards.
A♠ A♣ Tie!
? ? Cards are face down.
K♥ 6♣ Player 1 takes the cards.
3♣ 5♦ Player 2 takes the cards.
J♠ 8♥ Player 1 takes the cards.
6♦ 2♦ Player 1 takes the cards.
5♣ 7♣ Player 2 takes the cards.
2♠ 6♥ Player 2 takes the cards.
Q♦ 4♦ Player 1 takes the cards.
10♣ 3♦ Player 1 takes the cards.
9♣ 9♦ Tie!
? ? Cards are face down.
6♠ Q♥ Player 2 takes the cards.
3♠ 10♥ Player 2 takes the cards.
K♦ A♥ Player 2 takes the cards.
8♦ Q♣ Player 2 takes the cards.
10♦ 9♠ Player 1 takes the cards.
5♥ 5♠ Tie!
? ? Cards are face down.
2♥ 7♥ Player 2 takes the cards.
K♠ 7♦ Player 1 takes the cards.
J♣ 4♠ Player 1 takes the cards.
K♥ Q♠ Player 1 takes the cards.
6♣ J♥ Player 2 takes the cards.
A♠ 8♠ Player 1 takes the cards.
A♣ 4♣ Player 1 takes the cards.
10♠ A♦ Player 2 takes the cards.
8♣ 4♥ Player 1 takes the cards.
J♠ K♣ Player 2 takes the cards.
8♥ 2♣ Player 1 takes the cards.
6♦ 5♦ Player 1 takes the cards.
2♦ 3♣ Player 2 takes the cards.
Q♦ 7♣ Player 1 takes the cards.
4♦ 5♣ Player 2 takes the cards.
10♣ 6♥ Player 1 takes the cards.
3♦ 2♠ Player 1 takes the cards.
10♦ Q♥ Player 2 takes the cards.
9♠ 6♠ Player 1 takes the cards.
K♠ 9♣ Player 1 takes the cards.
7♦ 9♦ Player 2 takes the cards.
J♣ 7♠ Player 1 takes the cards.
4♠ 9♥ Player 2 takes the cards.
K♥ 10♥ Player 1 takes the cards.
Q♠ 3♠ Player 1 takes the cards.
A♠ A♥ Tie!
? ? Cards are face down.
A♣ Q♣ Player 1 takes the cards.
4♣ 8♦ Player 2 takes the cards.
8♣ 7♥ Player 1 takes the cards.
4♥ 2♥ Player 1 takes the cards.
8♥ 5♥ Player 1 takes the cards.
2♣ 5♠ Player 2 takes the cards.
6♦ 3♥ Player 1 takes the cards.
5♦ J♦ Player 2 takes the cards.
Q♦ J♥ Player 1 takes the cards.
7♣ 6♣ Player 1 takes the cards.
10♣ A♦ Player 2 takes the cards.
6♥ 10♠ Player 2 takes the cards.
3♦ K♣ Player 2 takes the cards.
2♠ J♠ Player 2 takes the cards.
9♠ 3♣ Player 1 takes the cards.
6♠ 2♦ Player 1 takes the cards.
K♠ 5♣ Player 1 takes the cards.
9♣ 4♦ Player 1 takes the cards.
J♣ Q♥ Player 2 takes the cards.
7♠ 10♦ Player 2 takes the cards.
K♥ 9♦ Player 1 takes the cards.
10♥ 7♦ Player 1 takes the cards.
Q♠ 9♥ Player 1 takes the cards.
3♠ 4♠ Player 2 takes the cards.
A♣ 8♦ Player 1 takes the cards.
Q♣ 4♣ Player 1 takes the cards.
A♠ 5♠ Player 1 takes the cards.
A♥ 2♣ Player 1 takes the cards.
8♠ J♦ Player 2 takes the cards.
K♦ 5♦ Player 1 takes the cards.
8♣ A♦ Player 2 takes the cards.
7♥ 10♣ Player 2 takes the cards.
4♥ 10♠ Player 2 takes the cards.
2♥ 6♥ Player 2 takes the cards.
8♥ K♣ Player 2 takes the cards.
5♥ 3♦ Player 1 takes the cards.
6♦ J♠ Player 2 takes the cards.
3♥ 2♠ Player 1 takes the cards.
Q♦ Q♥ Tie!
? ? Cards are face down.
7♣ 10♦ Player 2 takes the cards.
6♣ 7♠ Player 2 takes the cards.
9♠ 4♠ Player 1 takes the cards.
3♣ 3♠ Tie!
? ? Cards are face down.
2♦ 8♠ Player 2 takes the cards.
K♠ A♦ Player 2 takes the cards.
5♣ 8♣ Player 2 takes the cards.
9♣ 10♣ Player 2 takes the cards.
4♦ 7♥ Player 2 takes the cards.
K♥ 10♠ Player 1 takes the cards.
9♦ 4♥ Player 1 takes the cards.
10♥ 6♥ Player 1 takes the cards.
7♦ 2♥ Player 1 takes the cards.
Q♠ K♣ Player 2 takes the cards.
9♥ 8♥ Player 1 takes the cards.
A♣ J♠ Player 1 takes the cards.
8♦ 6♦ Player 1 takes the cards.
Q♣ 10♦ Player 1 takes the cards.
4♣ 7♣ Player 2 takes the cards.
A♠ Q♦ Player 1 takes the cards.
5♠ Q♥ Player 2 takes the cards.
A♥ J♥ Player 1 takes the cards.
2♣ J♣ Player 2 takes the cards.
K♦ 7♠ Player 1 takes the cards.
5♦ 6♣ Player 2 takes the cards.
5♥ 8♠ Player 2 takes the cards.
3♦ 2♦ Player 1 takes the cards.
3♥ 3♣ Tie!
? ? Cards are face down.
9♠ 6♠ Player 1 takes the cards.
4♠ J♦ Player 2 takes the cards.
K♥ A♦ Player 2 takes the cards.
10♠ K♠ Player 2 takes the cards.
9♦ 8♣ Player 1 takes the cards.
4♥ 5♣ Player 2 takes the cards.
10♥ 10♣ Tie!
? ? Cards are face down.
7♦ 7♥ Tie!
? ? Cards are face down.
9♥ K♣ Player 2 takes the cards.
8♥ Q♠ Player 2 takes the cards.
A♣ 7♣ Player 1 takes the cards.
J♠ 4♣ Player 1 takes the cards.
8♦ Q♥ Player 2 takes the cards.
6♦ 5♠ Player 1 takes the cards.
Q♣ J♣ Player 1 takes the cards.
10♦ 2♣ Player 1 takes the cards.
A♠ 6♣ Player 1 takes the cards.
Q♦ 5♦ Player 1 takes the cards.
A♥ 8♠ Player 1 takes the cards.
J♥ 5♥ Player 1 takes the cards.
K♦ J♦ Player 1 takes the cards.
7♠ 4♠ Player 1 takes the cards.
3♦ A♦ Player 2 takes the cards.
2♦ K♥ Player 2 takes the cards.
9♠ K♠ Player 2 takes the cards.
6♠ 10♠ Player 2 takes the cards.
3♥ 5♣ Player 2 takes the cards.
3♣ 4♥ Player 2 takes the cards.
2♠ K♣ Player 2 takes the cards.
3♠ 9♥ Player 2 takes the cards.
9♦ 10♥ Player 2 takes the cards.
8♣ 10♣ Player 2 takes the cards.
A♣ 6♥ Player 1 takes the cards.
7♣ 9♣ Player 2 takes the cards.
J♠ 7♦ Player 1 takes the cards.
4♣ 7♥ Player 2 takes the cards.
6♦ 2♥ Player 1 takes the cards.
5♠ 4♦ Player 1 takes the cards.
Q♣ Q♠ Tie!
? ? Cards are face down.
10♦ Q♥ Player 2 takes the cards.
2♣ 8♦ Player 2 takes the cards.
A♠ A♦ Tie!
? ? Cards are face down.
Q♦ K♥ Player 2 takes the cards.
5♦ 2♦ Player 1 takes the cards.
A♥ K♠ Player 1 takes the cards.
8♠ 9♠ Player 2 takes the cards.
J♥ 10♠ Player 1 takes the cards.
5♥ 6♠ Player 2 takes the cards.
K♦ 5♣ Player 1 takes the cards.
J♦ 3♥ Player 1 takes the cards.
7♠ 4♥ Player 1 takes the cards.
4♠ 3♣ Player 1 takes the cards.
A♣ K♣ Player 1 takes the cards.
6♥ 2♠ Player 1 takes the cards.
J♠ 9♥ Player 1 takes the cards.
7♦ 3♠ Player 1 takes the cards.
6♦ 10♥ Player 2 takes the cards.
2♥ 9♦ Player 2 takes the cards.
5♠ 10♣ Player 2 takes the cards.
4♦ 8♣ Player 2 takes the cards.
5♦ 9♣ Player 2 takes the cards.
2♦ 7♣ Player 2 takes the cards.
A♥ 7♥ Player 1 takes the cards.
K♠ 4♣ Player 1 takes the cards.
J♥ Q♥ Player 2 takes the cards.
10♠ 10♦ Tie!
? ? Cards are face down.
5♣ Q♠ Player 2 takes the cards.
J♦ J♣ Tie!
? ? Cards are face down.
7♠ 8♦ Player 2 takes the cards.
4♥ 2♣ Player 1 takes the cards.
4♠ K♥ Player 2 takes the cards.
3♣ Q♦ Player 2 takes the cards.
A♣ A♠ Tie!
? ? Cards are face down.
6♥ 6♣ Tie!
? ? Cards are face down.
J♠ 9♠ Player 1 takes the cards.
9♥ 8♠ Player 1 takes the cards.
7♦ 6♠ Player 1 takes the cards.
3♠ 5♥ Player 2 takes the cards.
A♥ 10♥ Player 1 takes the cards.
7♥ 6♦ Player 1 takes the cards.
K♠ 9♦ Player 1 takes the cards.
4♣ 2♥ Player 1 takes the cards.
4♥ 10♣ Player 2 takes the cards.
2♣ 5♠ Player 2 takes the cards.
J♠ 8♣ Player 1 takes the cards.
9♠ 4♦ Player 1 takes the cards.
A♣ 9♣ Player 1 takes the cards.
A♠ 5♦ Player 1 takes the cards.
K♣ 7♣ Player 1 takes the cards.
A♦ 2♦ Player 1 takes the cards.
6♥ Q♥ Player 2 takes the cards.
6♣ J♥ Player 2 takes the cards.
2♠ Q♠ Player 2 takes the cards.
3♦ 5♣ Player 2 takes the cards.
9♥ 10♠ Player 2 takes the cards.
8♠ 10♦ Player 2 takes the cards.
7♦ K♦ Player 2 takes the cards.
6♠ Q♣ Player 2 takes the cards.
A♥ 8♦ Player 1 takes the cards.
10♥ 7♠ Player 1 takes the cards.
7♥ J♦ Player 2 takes the cards.
6♦ J♣ Player 2 takes the cards.
K♠ 3♥ Player 1 takes the cards.
9♦ 8♥ Player 1 takes the cards.
4♣ K♥ Player 2 takes the cards.
2♥ 4♠ Player 2 takes the cards.
J♠ Q♦ Player 2 takes the cards.
8♣ 3♣ Player 1 takes the cards.
9♠ 5♥ Player 1 takes the cards.
4♦ 3♠ Player 1 takes the cards.
A♣ 10♣ Player 1 takes the cards.
9♣ 4♥ Player 1 takes the cards.
A♠ 5♠ Player 1 takes the cards.
5♦ 2♣ Player 1 takes the cards.
K♣ Q♥ Player 1 takes the cards.
7♣ 6♥ Player 1 takes the cards.
A♦ J♥ Player 1 takes the cards.
2♦ 6♣ Player 2 takes the cards.
A♥ Q♠ Player 1 takes the cards.
8♦ 2♠ Player 1 takes the cards.
10♥ 5♣ Player 1 takes the cards.
7♠ 3♦ Player 1 takes the cards.
K♠ 10♠ Player 1 takes the cards.
3♥ 9♥ Player 2 takes the cards.
9♦ 10♦ Player 2 takes the cards.
8♥ 8♠ Tie!
? ? Cards are face down.
3♣ 7♦ Player 2 takes the cards.
9♠ Q♣ Player 2 takes the cards.
5♥ 6♠ Player 2 takes the cards.
4♦ J♦ Player 2 takes the cards.
3♠ 7♥ Player 2 takes the cards.
A♣ J♣ Player 1 takes the cards.
10♣ 6♦ Player 1 takes the cards.
9♣ K♥ Player 2 takes the cards.
4♥ 4♣ Tie!
? ? Cards are face down.
5♠ 2♥ Player 1 takes the cards.
5♦ Q♦ Player 2 takes the cards.
2♣ J♠ Player 2 takes the cards.
K♣ 6♣ Player 1 takes the cards.
Q♥ 2♦ Player 1 takes the cards.
7♣ 9♥ Player 2 takes the cards.
6♥ 3♥ Player 1 takes the cards.
A♦ 10♦ Player 1 takes the cards.
J♥ 9♦ Player 1 takes the cards.
A♥ 7♦ Player 1 takes the cards.
Q♠ 3♣ Player 1 takes the cards.
8♦ 8♥ Tie!
? ? Cards are face down.
10♥ 8♣ Player 1 takes the cards.
5♣ K♦ Player 2 takes the cards.
7♠ Q♣ Player 2 takes the cards.
3♦ 9♠ Player 2 takes the cards.
K♠ 6♠ Player 1 takes the cards.
10♠ 5♥ Player 1 takes the cards.
A♣ J♦ Player 1 takes the cards.
J♣ 4♦ Player 1 takes the cards.
10♣ 7♥ Player 1 takes the cards.
6♦ 3♠ Player 1 takes the cards.
5♠ K♥ Player 2 takes the cards.
2♥ 9♣ Player 2 takes the cards.
4♥ Q♦ Player 2 takes the cards.
4♣ 5♦ Player 2 takes the cards.
A♠ J♠ Player 1 takes the cards.
4♠ 2♣ Player 1 takes the cards.
K♣ 9♥ Player 1 takes the cards.
6♣ 7♣ Player 2 takes the cards.
Q♥ K♦ Player 2 takes the cards.
2♦ 5♣ Player 2 takes the cards.
6♥ Q♣ Player 2 takes the cards.
3♥ 7♠ Player 2 takes the cards.
A♦ 9♠ Player 1 takes the cards.
10♦ 3♦ Player 1 takes the cards.
J♥ K♥ Player 2 takes the cards.
9♦ 5♠ Player 1 takes the cards.
A♥ 9♣ Player 1 takes the cards.
7♦ 2♥ Player 1 takes the cards.
Q♠ Q♦ Tie!
? ? Cards are face down.
10♥ 5♦ Player 1 takes the cards.
8♣ 4♣ Player 1 takes the cards.
8♦ 7♣ Player 1 takes the cards.
8♥ 6♣ Player 1 takes the cards.
2♠ K♦ Player 2 takes the cards.
8♠ Q♥ Player 2 takes the cards.
K♠ 5♣ Player 1 takes the cards.
6♠ 2♦ Player 1 takes the cards.
10♠ Q♣ Player 2 takes the cards.
5♥ 6♥ Player 2 takes the cards.
A♣ 7♠ Player 1 takes the cards.
J♦ 3♥ Player 1 takes the cards.
J♣ K♥ Player 2 takes the cards.
4♦ J♥ Player 2 takes the cards.
10♣ K♦ Player 2 takes the cards.
7♥ 2♠ Player 1 takes the cards.
6♦ Q♥ Player 2 takes the cards.
3♠ 8♠ Player 2 takes the cards.
A♠ Q♣ Player 1 takes the cards.
J♠ 10♠ Player 1 takes the cards.
4♠ 6♥ Player 2 takes the cards.
2♣ 5♥ Player 2 takes the cards.
K♣ K♥ Tie!
? ? Cards are face down.
A♦ J♥ Player 1 takes the cards.
9♠ 4♦ Player 1 takes the cards.
10♦ K♦ Player 2 takes the cards.
3♦ 10♣ Player 2 takes the cards.
9♦ Q♥ Player 2 takes the cards.
5♠ 6♦ Player 2 takes the cards.
A♥ 8♠ Player 1 takes the cards.
9♣ 3♠ Player 1 takes the cards.
7♦ 6♥ Player 1 takes the cards.
2♥ 4♠ Player 2 takes the cards.
10♥ 5♥ Player 1 takes the cards.
5♦ 2♣ Player 1 takes the cards.
Q♠ K♦ Player 2 takes the cards.
Q♦ 10♦ Player 1 takes the cards.
3♣ 10♣ Player 2 takes the cards.
4♥ 3♦ Player 1 takes the cards.
8♣ Q♥ Player 2 takes the cards.
4♣ 9♦ Player 2 takes the cards.
8♦ 6♦ Player 1 takes the cards.
7♣ 5♠ Player 1 takes the cards.
8♥ 4♠ Player 1 takes the cards.
6♣ 2♥ Player 1 takes the cards.
K♠ K♦ Tie!
? ? Cards are face down.
6♠ 10♣ Player 2 takes the cards.
2♦ 3♣ Player 2 takes the cards.
A♣ Q♥ Player 1 takes the cards.
7♠ 8♣ Player 2 takes the cards.
J♦ 9♦ Player 1 takes the cards.
3♥ 4♣ Player 2 takes the cards.
7♥ 10♣ Player 2 takes the cards.
2♠ 6♠ Player 2 takes the cards.
A♠ K♠ Player 1 takes the cards.
Q♣ K♦ Player 2 takes the cards.
J♠ 5♣ Player 1 takes the cards.
10♠ Q♠ Player 2 takes the cards.
A♦ 3♣ Player 1 takes the cards.
J♥ 2♦ Player 1 takes the cards.
K♣ 8♣ Player 1 takes the cards.
K♥ 7♠ Player 1 takes the cards.
9♥ 4♣ Player 1 takes the cards.
J♣ 3♥ Player 1 takes the cards.
9♠ 10♣ Player 2 takes the cards.
4♦ 7♥ Player 2 takes the cards.
A♥ 6♠ Player 1 takes the cards.
8♠ 2♠ Player 1 takes the cards.
9♣ K♦ Player 2 takes the cards.
3♠ Q♣ Player 2 takes the cards.
7♦ Q♠ Player 2 takes the cards.
6♥ 10♠ Player 2 takes the cards.
10♥ 10♣ Tie!
? ? Cards are face down.
5♦ 7♥ Player 2 takes the cards.
2♣ 4♦ Player 2 takes the cards.
Q♦ K♦ Player 2 takes the cards.
10♦ 9♣ Player 1 takes the cards.
4♥ Q♣ Player 2 takes the cards.
3♦ 3♠ Tie!
? ? Cards are face down.
6♦ 7♦ Player 2 takes the cards.
7♣ 10♠ Player 2 takes the cards.
5♠ 6♥ Player 2 takes the cards.
8♥ 7♥ Player 1 takes the cards.
4♠ 5♦ Player 2 takes the cards.
6♣ 10♥ Player 2 takes the cards.
2♥ 10♣ Player 2 takes the cards.
A♣ 5♥ Player 1 takes the cards.
Q♥ 9♠ Player 1 takes the cards.
J♦ 4♦ Player 1 takes the cards.
9♦ 2♣ Player 1 takes the cards.
A♠ K♦ Player 1 takes the cards.
K♠ Q♦ Player 1 takes the cards.
J♠ Q♣ Player 2 takes the cards.
5♣ 4♥ Player 1 takes the cards.
A♦ 7♦ Player 1 takes the cards.
3♣ 6♦ Player 2 takes the cards.
J♥ 3♦ Player 1 takes the cards.
2♦ 3♠ Player 2 takes the cards.
K♣ 8♦ Player 1 takes the cards.
8♣ Q♠ Player 2 takes the cards.
K♥ 10♠ Player 1 takes the cards.
7♠ 7♣ Tie!
? ? Cards are face down.
4♣ 5♠ Player 2 takes the cards.
J♣ 5♦ Player 1 takes the cards.
3♥ 4♠ Player 2 takes the cards.
A♥ 10♥ Player 1 takes the cards.
6♠ 6♣ Tie!
? ? Cards are face down.
2♠ 2♥ Tie!
? ? Cards are face down.
9♣ J♠ Player 2 takes the cards.
8♥ 6♦ Player 1 takes the cards.
7♥ 3♣ Player 1 takes the cards.
A♣ 3♠ Player 1 takes the cards.
5♥ 2♦ Player 1 takes the cards.
Q♥ Q♠ Tie!
? ? Cards are face down.
J♦ 5♠ Player 1 takes the cards.
4♦ 4♣ Tie!
? ? Cards are face down.
2♣ 7♣ Player 2 takes the cards.
A♠ 9♥ Player 1 takes the cards.
K♦ 6♥ Player 1 takes the cards.
K♠ 4♠ Player 1 takes the cards.
Q♦ 3♥ Player 1 takes the cards.
5♣ J♠ Player 2 takes the cards.
4♥ 9♣ Player 2 takes the cards.
A♦ 6♠ Player 1 takes the cards.
7♦ 6♣ Player 1 takes the cards.
J♥ 8♠ Player 1 takes the cards.
3♦ 10♣ Player 2 takes the cards.
K♣ 2♠ Player 1 takes the cards.
8♦ 2♥ Player 1 takes the cards.
K♥ 10♦ Player 1 takes the cards.
10♠ Q♣ Player 2 takes the cards.
J♣ 7♣ Player 1 takes the cards.
5♦ 2♣ Player 1 takes the cards.
A♥ 4♦ Player 1 takes the cards.
10♥ 4♣ Player 1 takes the cards.
8♥ 9♦ Player 2 takes the cards.
6♦ 7♠ Player 2 takes the cards.
7♥ J♠ Player 2 takes the cards.
3♣ 5♣ Player 2 takes the cards.
A♣ 9♣ Player 1 takes the cards.
3♠ 4♥ Player 2 takes the cards.
5♥ 10♣ Player 2 takes the cards.
2♦ 3♦ Player 2 takes the cards.
J♦ Q♣ Player 2 takes the cards.
5♠ 10♠ Player 2 takes the cards.
Q♥ 9♦ Player 1 takes the cards.
Q♠ 8♥ Player 1 takes the cards.
9♠ 7♠ Player 1 takes the cards.
8♣ 6♦ Player 1 takes the cards.
A♠ J♠ Player 1 takes the cards.
9♥ 7♥ Player 1 takes the cards.
K♦ 5♣ Player 1 takes the cards.
6♥ 3♣ Player 1 takes the cards.
K♠ 4♥ Player 1 takes the cards.
4♠ 3♠ Player 1 takes the cards.
Q♦ 10♣ Player 1 takes the cards.
3♥ 5♥ Player 2 takes the cards.
A♦ 3♦ Player 1 takes the cards.
6♠ 2♦ Player 1 takes the cards.
7♦ Q♣ Player 2 takes the cards.
6♣ J♦ Player 2 takes the cards.
J♥ 10♠ Player 1 takes the cards.
8♠ 5♠ Player 1 takes the cards.
K♣ 5♥ Player 1 takes the cards.
2♠ 3♥ Player 2 takes the cards.
8♦ Q♣ Player 2 takes the cards.
2♥ 7♦ Player 2 takes the cards.
K♥ J♦ Player 1 takes the cards.
10♦ 6♣ Player 1 takes the cards.
J♣ 3♥ Player 1 takes the cards.
7♣ 2♠ Player 1 takes the cards.
5♦ Q♣ Player 2 takes the cards.
2♣ 8♦ Player 2 takes the cards.
A♥ 7♦ Player 1 takes the cards.
4♦ 2♥ Player 1 takes the cards.
10♥ Q♣ Player 2 takes the cards.
10♥ Q♣ Player 2 takes the cards.
4♣ 5♦ Player 2 takes the cards.
4♣ 5♦ Player 2 takes the cards.

Revision as of 08:19, 26 December 2020


War card game is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

War Card Game

Simulate the card game War. Use the Bicycle playing card manufacturer's rules. Show a game as played. User input is optional.

References:

  • Bicycle card company War game site. [[1]]
  • Wikipedia entry. [[2]]


Julia

<lang julia># https://bicyclecards.com/how-to-play/war/

using Random

const SUITS = ["♣", "♦", "♥", "♠"] const FACES = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A" ] const DECK = vec([f * s for s in SUITS, f in FACES]) const rdict = Dict(DECK[i] => div(i + 3, 4) for i in eachindex(DECK))

deal2(deck) = begin d = shuffle(deck); d[1:2:51], d[2:2:52] end

function turn!(d1, d2, pending)

   (isempty(d1) || isempty(d2)) && return false
   c1, c2 = popfirst!(d1), popfirst!(d2)
   r1, r2 = rdict[c1], rdict[c2]
   print(rpad(c1, 10), rpad(c2, 10))
   if r1 > r2
       println("Player 1 takes the cards.")
       push!(d1, c1, c2, pending...)
       empty!(pending)
   elseif r1 < r2
       println("Player 2 takes the cards.")
       push!(d2, c2, c1, pending...)
       empty!(pending)
   else # r1 == r2
       println("Tie!")
       (isempty(d1) || isempty(d2)) && return false
       c3, c4 = popfirst!(d1), popfirst!(d2)
       println(rpad("?", 10), rpad("?", 10), "Cards are face down.")
       turn!(d1, d2, push!(pending, c1, c2, c3, c4))
   end
   return true

end

function warcardgame()

   deck1, deck2 = deal2(DECK)
   while turn!(deck1, deck2, []) end
   if isempty(deck2)
       if isempty(deck1)
           println("Game ends as a tie.")
       else
           println("Player 1 wins the game.")
       end
   else
       println("Player 2 wins the game.")
   end

end

warcardgame()

</lang>

Output:
5♦        3♥        Player 1 takes the cards.
8♥        K♥        Player 2 takes the cards.
5♠        K♦        Player 2 takes the cards.
3♦        6♥        Player 2 takes the cards.
9♣        J♠        Player 2 takes the cards.
8♦        2♦        Player 1 takes the cards.
J♣        5♥        Player 1 takes the cards.
3♠        4♥        Player 2 takes the cards.
9♥        A♣        Player 2 takes the cards.
9♠        9♦        Tie!
?         ?         Cards are face down.     
A♠        4♦        Player 1 takes the cards.
5♣        Q♠        Player 2 takes the cards.
6♦        8♠        Player 2 takes the cards.
4♣        10♦       Player 2 takes the cards.
4♠        2♥        Player 1 takes the cards.
Q♦        K♣        Player 2 takes the cards.
A♥        2♣        Player 1 takes the cards.
Q♣        2♠        Player 1 takes the cards.
10♥       6♣        Player 1 takes the cards.

... many other lines ...

10♥       Q♣        Player 2 takes the cards.
4♣        5♦        Player 2 takes the cards.
A♣        8♦        Player 1 takes the cards.
9♣        2♣        Player 1 takes the cards.
Q♥        Q♣        Tie!
?         ?         Cards are face down.
Q♠        5♦        Player 1 takes the cards.
8♥        4♣        Player 1 takes the cards.
Player 1 wins the game.