<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>DanAllan.com &#187; games</title>
	<atom:link href="http://www.danallan.com/tag/games/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danallan.com</link>
	<description></description>
	<lastBuildDate>Thu, 02 Sep 2010 19:22:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Risk</title>
		<link>http://www.danallan.com/projects/2008/12/risk/</link>
		<comments>http://www.danallan.com/projects/2008/12/risk/#comments</comments>
		<pubDate>Wed, 31 Dec 2008 01:16:34 +0000</pubDate>
		<dc:creator>Dan Allan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[Monte Carlo method]]></category>

		<guid isPermaLink="false">http://www.danallan.com/?p=509</guid>
		<description><![CDATA[I considered two questions about the board game <a title="Wikipedia article" href="http://en.wikipedia.org/Risk_(game)">Risk</a>.
<ol>
	<li>What are the odds of winning a particular dice roll? (like 3 dice vs. 2 dice, 3 dice vs. 1 die, etc.)</li>
	<li>What are the odds of conquering a territory? (for example, 20 men invading 17 men)</li>
</ol>
Anyone who has played risk has an intuitive sense of the answers to the first question.  Odds of winning a 3 dice vs. 2 dice battle are about 50/50.  The invading army gets the advantage of an extra die, but ties go to the defender.  It turns out that these advantages roughly balance each other out.  (<a href="http://www.danallan.com/wp-content/uploads/2008/12/risk-single-engagement-odds.png">Full results</a>.)

Question #2 is harder because battles between a large number of soldiers are complicated.  It all comes down to who has to roll with a reduced number of dice.  For example, if a large army is cut down early with a string of bad luck, its odds of winning go down much faster.]]></description>
			<content:encoded><![CDATA[<p>I considered two questions about the board game <a title="Wikipedia article" href="http://en.wikipedia.org/Risk_(game)">Risk</a>.</p>
<ol>
<li>What are the odds of winning a particular dice roll? (like 3 dice vs. 2 dice, 3 dice vs. 1 die, etc.)</li>
<li>What are the odds of conquering a territory? (for example, 20 men invading 17 men)</li>
</ol>
<p>Anyone who has played risk has an intuitive sense of the answers to the first question.  Odds of winning a 3 dice vs. 2 dice battle are about 50/50.  The invading army gets the advantage of an extra die, but ties go to the defender.  It turns out that these advantages roughly balance each other out.  (<a href="http://www.danallan.com/wp-content/uploads/2008/12/risk-single-engagement-odds.png" rel="shadowbox[post-509];player=img;">Full results</a>.)</p>
<p>Question #2 is harder because battles between a large number of soldiers are complicated.  It all comes down to who has to roll with a reduced number of dice.  For example, if a large army is cut down early with a string of bad luck, its odds of winning go down much faster.</p>
<p> This table gives the odds of winning a whole series of dice rolls and <strong>capturing a territory</strong>.  The number of invading soldiers is along the side, defending soldiers along the top. Their corresponding entry gives the invaders&#8217; odds of wiping out the defending army. One is always subject to luck, but with this table at least you can know what you&#8217;re getting into.  Only the truly dedicated would want to memorize some of this; it is more interesting to look for and internalize patterns. </p>
<p><div id="attachment_513" class="wp-caption aligncenter" style="width: 509px"><a href="http://www.danallan.com/wp-content/uploads/2008/12/risk-conquest-odds.png" rel="shadowbox[post-509];player=img;" title="risk-conquest-odds"><img class="size-medium wp-image-513" title="risk-conquest-odds" src="http://www.danallan.com/wp-content/uploads/2008/12/risk-conquest-odds-499x229.png" alt="Click to enlarge!" width="499" height="229" /></a><p class="wp-caption-text">Click to enlarge!</p></div></p>
<p><strong>About this table:</strong></p>
<ul>
<li>Of course there is never a 100% probability of success.  I round to 100% when the probability is greater than 99.5%.</li>
<li>This table considers up to 20 soldiers, but it could easily be extended.</li>
<li>It&#8217;s obvious that more soldiers = better odds.  But following along the diagonals reveals interesting features. Notice how 2 vs. 1 is better than 3 vs. 2 but not as good as 4 vs. 3.</li>
<li>To generate this table I computed 3 800 000 simulated conquests (10 000 per entry) using a Monte Carlo algorithm coded in <em>Mathematica</em>.</li>
</ul>
<p><strong>Previous Work. </strong>There is a web <a title="Word document" href="http://www.recreationalmath.com/Risk/RiskPaper.doc">article</a> by Daniel C. Taflin (2001) that considers Question #1 and explains the underlying mathematics of his approach in detail.<strong></strong></p>
<p><strong>Other important life lessons.</strong> Alliances are made to be broken; Asia is weak; never leave Australia unattended.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danallan.com/projects/2008/12/risk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uno Games</title>
		<link>http://www.danallan.com/projects/2008/08/uno-games/</link>
		<comments>http://www.danallan.com/projects/2008/08/uno-games/#comments</comments>
		<pubDate>Tue, 12 Aug 2008 02:19:48 +0000</pubDate>
		<dc:creator>Dan Allan</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[card game]]></category>
		<category><![CDATA[games]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.danallan.com/?p=102</guid>
		<description><![CDATA[<a title="Wikipedia article" href="http://en.wikipedia.org/wiki/Uno_(game)" target="_blank">Uno games</a> can go on forever. Game length depends mainly on how the cards get shuffled.  How long is an Uno game likely to take?  Does including more players make a <em>longer</em> game or just more chances for <em>someone</em> to win and end it?

Sounds like the perfect way to squirm out of taking History of Mathematics by writing an independent paper about Uno!  <em>My musings here are brief and not math-y.</em>]]></description>
			<content:encoded><![CDATA[<p><a title="Wikipedia article" href="http://en.wikipedia.org/wiki/Uno_(game)" target="_blank">Uno games</a> can go on forever. Game length depends mainly on how the cards get shuffled.  How long is an Uno game likely to take?  Does including more players make a <em>longer</em> game or just more chances for <em>someone</em> to win and end it?</p>
<p>Sounds like the perfect way to squirm out of taking History of Mathematics by writing an independent paper about Uno!  <em>My musings here are brief and not math-y.</em></p>
<p>Most people play Uno with a pretty basic strategy, and it&#8217;s not hard to program a computer to play as well as a casual human player.  My laptop can simulate one million Uno games in about five minutes.  Then it tells me how long the games took.  The results look like this.</p>
<p><div id="attachment_104" class="wp-caption alignnone" style="width: 510px"><a href="http://www.danallan.com/wp-content/uploads/2008/08/2-4-players-unscaled.png" rel="shadowbox[post-102];player=img;" title="2-4-players-unscaled"><img class="size-full wp-image-104" title="2-4-players-unscaled" src="http://www.danallan.com/wp-content/uploads/2008/08/2-4-players-unscaled.png" alt="Red = 2-player games; Green = 3-player games; Blue = 4-player games" width="500" height="325" /></a><p class="wp-caption-text">Red = 2-player games; Green = 3-player games; Blue = 4-player games</p></div></p>
<p>See that the blue line generally stays higher than the red line?  This tells us that adding players makes the game take longer.  Not a surprise.</p>
<p>But there are two ways to count how long an Uno game takes.  You could count <em>total number of turns </em>or you could count <em>rounds</em> — that is, times that play circles around the table.  (Rounds = Turns / # Players.)  Here&#8217;s the same data, counting rounds this time.</p>
<p><div id="attachment_106" class="wp-caption alignnone" style="width: 510px"><a href="http://www.danallan.com/wp-content/uploads/2008/08/2-4-players-scaled.png" rel="shadowbox[post-102];player=img;" title="2-4-players-scaled"><img class="size-medium wp-image-106" title="2-4-players-scaled" src="http://www.danallan.com/wp-content/uploads/2008/08/2-4-players-scaled-500x319.png" alt="Red = 2-player games; Green = 3-player games; Blue = 4-player games" width="500" height="319" /></a><p class="wp-caption-text">Red = 2-player games; Green = 3-player games; Blue = 4-player games</p></div></p>
<p>The curves have changed places: adding players makes for <em>shorter </em>Uno games if we count rounds.  This makes sense: more players means more chances that <em>someone </em>is holding a winning hand.</p>
<p><strong>The Conclusion: </strong>Uno games with more players tend to take longer in terms of actual turns, but it takes fewer <em>rounds </em>of play for someone to win.</p>
<p><strong>Another Quick Observation: </strong>The first player has a measurable advantage.  Each player has (approximately) a 0.5% better chance of winning than the player who plays after him.  (This is true no matter how many people are playing.)  Obviously, the advantage is small.  Practically speaking, it makes little difference who goes first.</p>
<p><strong>Extra Credit</strong></p>
<ul>
<li>I only showed plots for 2-4 players, but the trend continues.  I tested up to 12-player games.</li>
<li>The first peak, at 7 rounds, corresponds to Player 1 holding a perfect hand, going out at the earliest possible turn.  The secondary peak, at 11 rounds, corresponds to the same scenario but with Player 1 having been hit with a Draw 4 card.  This can be confirmed by simulating games using a deck without Draw 4 cards in it.
<p><div id="attachment_108" class="wp-caption alignnone" style="width: 510px"><a href="http://www.danallan.com/wp-content/uploads/2008/08/remove-d4.png" rel="shadowbox[post-102];player=img;" title="Remove Draw 4 Cards"><img class="size-medium wp-image-108" title="Remove Draw 4 Cards" src="http://www.danallan.com/wp-content/uploads/2008/08/remove-d4-500x325.png" alt="" width="500" height="325" /></a><p class="wp-caption-text">Red = standard deck; Blue = deck without Draw 4 or Wild Draw 4 cards</p></div></li>
<li>Varying the players&#8217; strategies has a low impact on game length.</li>
</ul>
<p>If you have ideas, I&#8217;d be happy to hear them.  I will share my Uno-playing code upon request.  (It&#8217;s written in neatly commented Java.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danallan.com/projects/2008/08/uno-games/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
