Skip to main content

Let's Make War --- Just for Fun

Wars are all over the place.  Please forget about Syria, Libya, and Afghanistan for a couple of minutes.  These are serious and tragic wars with many lives lost.   But kids play wars, too, like in the card game. Let's do this.


    Almost every kid plays war of some kind. Aside from the usual cowboy and other war games, rainy afternoons were often the time to get out a deck of cards and play the card game War. As many times as I played this game as a kid, I can hardly ever remember finishing a game. What I can remember mostly is making a "tactical" agreement to quit and do something else.

    The other day, I thought to play war again --- but on a computer. For a game of pure chance, there is a remarkable amount of mathematics involved. If your mathematical toolkit includes course in probability, then you can appreciate just how complex this simple kids game is. Just determining the expected outcome after playing the first round after dealing is complex enough, let alone subsequent rounds --- when the players have unequal numbers of cards. The game is amazingly complex even when one restricts the size of the deck in almost any way. For example, suppose there are just hearts and diamonds numbered two to three. This game, with just eight cards, is very complicated, and way too complicated for a theoretical analysis. What we want to do here is simulate the play on a computer. The results will not be mathematical theorems but rather a collection of averages percentages based on assorted contingencies.

    For example, do you always win if you begin with four aces? Do you always win when you begin with four aces and four kings? Answer to both: no. Well, then how often do you win? How many "wars" per game can you expect to play? And very important: how long does take to play a game? Answer: not forever. These are some of the questions we'll consider. The results will be averages based on simulations. For our simulations, we will play over a million games of war, more than the average kid, even an avid war buff.

So we played games on the computer.  Here are the results.

The game. With the deck well shuffled, we deal the cards and play the game. Programming the game is relatively straight forward. It is just of loop of compare statements with a subroutine for a "war." Lets look at the results. First, we played many, very many, games. One feature of the program is that the user can enter the number of games to be played in a set. For example, you could request it to play 100 games, or 1000, or even one million games. Call this a set. The output is a collection of statistics about the play. We selected sets of 100, 500, 1000, 2500, 5000, 10,000, 50,000, 100,000, 1,000,000 and even 15,000,000 games. Depending on how many games are in a set, there were a number of interesting features. Below we list features more or less common to most of the sets.

Results.
  ∙  Each player won approximately, in fact, very nearly, half the games.  Indeed, for the longest set of games, player A (who begins) won 7,498,859 games and Player B won 7,501,141 games. 
  ∙  The average length of a game was 296 plays, with a war counting as one play. However, the standard deviation was 218. This indicates quite a wide spread in the number of plays per game. In games played with 2 down cards for a war, the average length was about 225 plays with a standard deviation of 171 plays.
  ∙  The average number of "wars" per game was about twenty --- and about fifteen for games played with two down cards.
  ∙  Approximately 25% of all games ended in default. That is, during a "war", the opponent did not have enough cards to complete the play - scored as a loss. Thus, about 75% of all games ended with one player's last card being captured. These percentages change to 40% and 60%, respectively, when a war is played with two down cards.
  ∙  The longest game of a set naturally increased as the number of games in the set increased. For example, in a set of 100 games, the longest games was 1428 plays. In the set we played of fifteen million games, the longest game was 4511 plays. To predict the expected duration of longest game in a set of say N games is a rather complicated mathematical problem, and requires considerable information about the probabilistic nature of the game itself. By the way, the shortest game played in the set of fifteen million was just 39 plays, a short game indeed. (Question. Using our definition of a play, what is the shortest possible game?  Answer: one play.  How?)
  ∙  This game, in probability expert circles, is often considered a deterministic game. The randomness is all in the shuffle. This means, once the deck is shuffled the outcome is completely determined. This does not imply one can make a function from the shuffle to the outcome.  After all, there are 52!≐8.08×10⁶⁷shuffles, a huge number greater than the estimated number of atoms in our galaxy!   Accounting for the hierarchy, an ace is an ace independent of suit etc, we should note there are in this game 52!/(4!)¹³= 92024 242230271 040357108 320801872 044844750 000000000 9 ≐ 2024×10⁴⁹ actual shuffles, still a mighty big number.

Aces and Kings.  For winning with aces and kings here is a table of percentages from the simulations.
Even beginning with each four aces and kings, you can still lose.  Winning is only about 96.2% probable.  Beginning with two each of aces and kings is about 50% probable.  These values are simply impossible to achieve, or even estimate, mathematically.

Timings. How fast did the computer play a games? This again depended on the number of games to a set and the computer. On a typical PC, a Dell, the run time for 15,000,000 games was just over 3917 seconds, or about 65.3 minutes. Translated to smaller numbers the computer played about 3829 games per second! Much of that time, was spent shuffling the pseudo-deck.

Oh well, what else can you do on a rainy Saturday afternoon.  Football?  :)


For your review, here are the rules for the card game of war.

1.Shuffle the deck and deal an equal number of cards to each player. Players are not permitted to select specific cards for play.
2.Each player plays a card from the top of the deck; the winner of the play is the player with the higher face value; he takes both cards and places them at the bottom of his deck.
3.In the event both players play a card of the same face value, a "war" is declared. In this case both players play a new card face down and a second card face up. The winner of the "war" is the player with the higher face value for the second card. The winner takes all six cards (and places them at the bottom of the deck). If the second cards have the same face value, a new "war" is declared. The above process is repeated, and repeated again until one player has a higher second card. The winner collects all cards.
4.When one player's cards are depleted, the other player is the winner. If one player runs out of cards during a war, the other player declared the winner. If both players simultaneously run out of cards, the game is considered a draw. This is the only condition for a draw.  In our simulations not a single draw occurred.
5.One game variation is to play wars with two down cards. Another variation is to play three down cards and the player selects one of them as the up card.


Want to play roulette?  http://used-ideas.blogspot.com/2012/06/lets-play-roulette-just-for-fun.html

Comments

Popular posts from this blog

Accepting Fake Information

Every day, we are all bombarded with information, especially on news channels.  One group claims it's false; another calls it the truth. How can we know when to accept it or alternatively how can we know it's false? There are several factors which influence acceptance of fake or false information. Here are the big four.  Some just don’t have the knowledge to discern fact/truth from fiction/fact/false*. Some fake information is cleverly disguised and simply appears to be correct. Some fake information is accepted because the person wants to believe it. Some fake information is accepted because there is no other information to the contrary. However, the acceptance of  information  of any kind become a kind of  truth , and this is a well studied topic. In the link below is an essay on “The Truth About Truth.” This shows simply that what is your point of view, different types of information are generally accepted, fake or not.   https://www.linkedin.com/posts/g-donald-allen-420b03

Your Brain Within Your Brain

  Your Bicameral Brain by Don Allen Have you ever gone to another room to get something, but when you got there you forgot what you were after? Have you ever experienced a flash of insight, but when you went to look it up online, you couldn’t even remember the keyword? You think you forgot it completely. How can it happen so fast? You worry your memory is failing. Are you merely absent-minded? You try to be amused. But maybe you didn’t forget.   Just maybe that flash of insight, clear and present for an instant, was never given in the verbal form, but another type of intelligence you possess, that you use, and that communicates only to you. We are trained to live in a verbal world, where words matter most. Aside from emotions, we are unable to conjure up other, nonverbal, forms of intelligence we primitively, pre-verbally, possess but don’t know how to use. Alas, we live in a world of words, stewing in the alphabet, sleeping under pages of paragraphs, almost ignoring one of

Is Artificial Intelligence Conscious?

  Is Artificial Intelligence Conscious? I truly like the study of consciousness, though it is safe to say no one really knows what it is. Some philosophers has avoided the problem by claiming consciousness simply doesn’t exist. It's the ultimate escape clause. However, the "therefore, it does not exist" argument also applies to "truth", "God", and even "reality" all quite beyond a consensus description for at least three millennia. For each issue or problem defying description or understanding, simply escape the problem by claiming it doesn’t exist. Problem solved or problem avoided? Alternately, as Daniel Dennett explains consciousness as an account of the various calculations occurring in the brain at close to the same time. However, he goes on to say that consciousness is so insignificant, especially compared to our exalted notions of it, that it might as well not exist [1] . Oh, well. Getting back to consciousness, most of us have view