    <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/">
     <channel>
        <title>ACCU  :: A Commonerâ€™s Response</title>
        <link>https://members.accu.org/index.php/journals/2308</link>
        <description>Professionalism in Programming</description>
        <dc:language>en-us</dc:language> 
        <dc:creator>Administrator</dc:creator> 
        <admin:generatorAgent rdf:resource="http://www.xaraya.org" /> 
        <admin:errorReportsTo rdf:resource="mailto:webeditor@accu.org" />
       <sy:updatePeriod>hourly</sy:updatePeriod>
       <sy:updateFrequency>1</sy:updateFrequency>
       <docs>http://backend.userland.com/rss</docs>


        <h2>Journal Articles</h2>


<div class="xar-mod-head"><span class="xar-mod-title">CVu Journal Vol 28, #5 - November 2016 + Programming Topics</span></div>

<table border="0" cellpadding="1" cellspacing="0">
    <tbody>
    <tr>
        <td valign="top">
            Browse in :
       </td>
       <td valign="top">

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c76/">Journals</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c77/">CVu</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c367/">285</a>
                    (9)
<br />

                                            <a href="https://members.accu.org/index.php/journals/">All</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c13/">Topics</a>

                     &gt;                         <a href="https://members.accu.org/index.php/journals/c65/">Programming</a>
                    (877)
<br />

                                            <a href="https://members.accu.org/index.php/journals/c367-65/">Any of these categories</a>

                    -                        <a href="https://members.accu.org/index.php/journals/c367+65/">All of these categories</a>
<br />
</td>
   </tr>
   </tbody>
</table>




<div class="xar-error">
   <p>
 <strong>Note:</strong> when you create a new publication type,
the articles module will automatically use the templates
<em>user-display-[publicationtype].xt</em>
and <em>user-summary-[publicationtype].xt</em>.
If those templates do not exist when you try to preview or display a new article,
you'll get this warning :-)  Please place your own templates in themes/<em>yourtheme</em>/modules/articles . The templates will get the extension .xt there. </p>
</div>
<div class="xar-norm xar-standard-box-padding">
   <h1><strong>Title:</strong>&nbsp;A Commonerâ€™s Response</h1>
<p><strong>Author:</strong>&nbsp;Martin Moene</p>
<p>
<strong>Date:</strong> 04 November 2016 17:04:20 +00:00 or Fri, 04 November 2016 17:04:20 +00:00</p>
<p><strong>Summary:</strong>&nbsp;Roger Orr offers an analysis of the Baronâ€™s last game.</p>
<p><strong>Body:</strong>&nbsp;<p>I was intrigued by the description of the game Baron M and Sir R were playing in the last <em>CVu</em>.</p>

<p>The strategy for each player is obviously to try and maximise their own score. But the problem is working out how each player should best approach this â€“ it is more subtle than it seems at first sight!</p>

<p>Letâ€™s start with player one and their first roll of the die.</p>

<p>Since half the numbers are 0â€“4 and half are 5â€“9 it seems clear that when throwing a number from 0 to 4 first it would be best for them to put this die in the units field and hope that lady luck treats them better on the second throw!</p>

<p>If the first throw is from 6 to 9 the chances are that the second throw will be lower, so it is better to place the first die in the tens.</p>

<p>The hard choice comes if they throw a 5 first. Half the time the next number will be lower, which is bad, but half the time it will be the same or greater. So whatâ€™s the best strategy to employ here? Itâ€™s not easy to decide, as deferring the choice might improve our chances, so letâ€™s come back to that later.</p>

<p>Player two then faces two different positions depending on whether player one put his first die in the tens spot or the units spot.</p>

<p>In the tens case, it seems simple: play your coin in the tens if it is bigger, and in the units if it is less.</p>

<p>But again the harder decision is what is the best strategy if it is the same â€“ what then? </p>

<p>If the score is from 6 to 9 theyâ€™re unlikely to do as well on the second roll, and should play the tens spot, but if they roll a 5 theyâ€™re likely to do no worse next time â€“ and might do better. So should they match player one on a 5, or play a 5 in the units and hope to get a higher roll next time? Letâ€™s come back to that question later as well.</p>

<p>If player one has placed his die in the units spot then player two faces the same question as player one did, <em>mutatis mutandis</em>.</p>

<p>Again, if they throw from 0 to 4 they should place it in the units spot, hoping to get a higher score on their second roll, and if they throw from 6 to 9 they should place the die in the tens spot.</p>

<p>Once again, rolling 5 presents them with a more difficult problem.</p>

<p>So we have three questions to answer to decide the best strategy to play this game.</p>

<p>The juxtaposition in <em>CVu</em> of the Baronâ€™s game with the article on â€˜Random confusionâ€™ led me to run a simulation to try and see by experiment what happens, assuming a set of <em>fair</em> 20-sided dice (creating these would be no mean feat, I surmise, and would require excellent engineering skills!)</p>

<p>I anticipate it will take experienced players something like 30 seconds to play a single game, counting the coins probably being the slowest part. The gentry may have it differently, but those who work for their living must restrain their dicing habits to the evening or risk ruin. So assuming the two players can manage dice playing continuously from 8pm to midnight we should see what happens after each nightâ€™s games, by when about 480 games will have been completed. (Although what with pouring more wine and answering any calls of nature that might occur they might not <em>quite</em> achieve that many games each evening.)</p>

<p>There are three binary choices for strategy options so there are eight possible combinations to try out.</p>

<ul>
	<li>Option 1: player one puts a 5 in the tens spot, rather than in the units.</li>
	<li>Option 2: player two puts a matching die in the tens spot if it matches a 5 in player oneâ€™s tens spot, rather than in the units.</li>
	<li>Option 3: player two puts a 5 in the tens spot if player one has played in the units spot, rather than in the units.</li>
</ul>

<p>(Although theyâ€™re not actually independent choices â€“ if player one always puts a 5 in the units spot then player two never has the opportunity to invoke option 2.)</p>

<p>I ran a simulation of eight nights, running through one set of options on each night.</p>

<table class="journaltable">
	<tr>
		<th>Option 1</th>
		<th>Option 2</th>
		<th>Option 3</th>
		<th>Player one's winnings (losses)</th>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>0</td>
		<td>(822)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>0</td>
		<td>476</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>0</td>
		<td>889</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>0</td>
		<td>181</td>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>1</td>
		<td>(232)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>1</td>
		<td>(173)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>1</td>
		<td>(114)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>(232</td>
	</tr>
</table>

<p>But one simulation is hardly enough, let us see what a second eight nights produces.</p>

<table class="journaltable">
	<tr>
		<th>Option 1</th>
		<th>Option 2</th>
		<th>Option 3</th>
		<th>Player one's winnings (losses)</th>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>0</td>
		<td>(114)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>0</td>
		<td>(232)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>0</td>
		<td>358</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>0</td>
		<td>299</td>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>1</td>
		<td>(173)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>1</td>
		<td>476</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>1</td>
		<td>(645)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>63</td>
	</tr>
</table>

<p>Oh dear â€“ it doesnâ€™t look very consistent, does it? Perhaps a simulation of a single nightâ€™s playing for each option isnâ€™t long enough to be certain of our strategy, dice being the unruly objects that they are.</p>

<p>Letâ€™s see what happens at the end of a whole <strong>year</strong> of playing:</p>

<table class="journaltable">
	<tr>
		<th>Option 1</th>
		<th>Option 2</th>
		<th>Option 3</th>
		<th>Player one's winnings (losses)</th>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>0</td>
		<td>12,865</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>0</td>
		<td>2,481</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>0</td>
		<td>9,207</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>0</td>
		<td>3,543</td>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>1</td>
		<td>17,231</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>1</td>
		<td>(115)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>1</td>
		<td>4,782</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>(232)</td>
	</tr>
</table>

<p>This is looking quite hopeful for player one, but if we run the results for a second year we again see quite a few changes in the results:</p>

<table class="journaltable">
	<tr>
		<th>Option 1</th>
		<th>Option 2</th>
		<th>Option 3</th>
		<th>Player one's winnings (losses)</th>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>0</td>
		<td>4,841</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>0</td>
		<td>3,897</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>0</td>
		<td>(2,652)</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>0</td>
		<td>(1,944)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>1</td>
		<td>8,027</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>1</td>
		<td>(3,773)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>1</td>
		<td>9,797</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>1,714</td>
	</tr>
</table>

<p>Letâ€™s assume playing this game does amazing things to the playersâ€™ life expectancy and they manage to keep playing for one <strong>hundred</strong> years. (Theyâ€™d better also have a very high boredom threshold, and a very large supply of coins....)</p>

<table class="journaltable">
	<tr>
		<th>Option 1</th>
		<th>Option 2</th>
		<th>Option 3</th>
		<th>Player one's winnings (losses)</th>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>0</td>
		<td>10,411,745</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>0</td>
		<td>1,316,482</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>0</td>
		<td>10,105,948</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>0</td>
		<td>1,114,761</td>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>1</td>
		<td>7,711,315</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>1</td>
		<td>(163,061)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>1</td>
		<td>8,102,898</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>(290,737)</td>
	</tr>
</table>

<p>Letâ€™s stretch our imagination a bit further and imagine they play for <em>another</em> century (itâ€™s only a simulation, no actual players were harmed getting these results....):</p>

<table class="journaltable">
	<tr>
		<th>Option 1</th>
		<th>Option 2</th>
		<th>Option 3</th>
		<th>Player one's winnings (losses)</th>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>0</td>
		<td>10,052,022</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>0</td>
		<td>1,558,441</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>0</td>
		<td>10,105,830</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>0</td>
		<td>1,407,755</td>
	</tr>
	<tr>
		<td>0</td>
		<td>0</td>
		<td>1</td>
		<td>7,739,426</td>
	</tr>
	<tr>
		<td>1</td>
		<td>0</td>
		<td>1</td>
		<td>(293,923)</td>
	</tr>
	<tr>
		<td>0</td>
		<td>1</td>
		<td>1</td>
		<td>7,865,541</td>
	</tr>
	<tr>
		<td>1</td>
		<td>1</td>
		<td>1</td>
		<td>(158,282)</td>
	</tr>
</table>

<p>Now weâ€™re getting somewhere that looks a bit more consistent. Weâ€™re still getting a fair bit of variation, but the picture is becoming clearer.</p>

<p>Player one should <em>not</em> take option 1; if they throw a five first they should place it in the <strong>units</strong> spot and hope for a higher roll the second time round.</p>

<p>Given this, player twoâ€™s best strategy on option 2 is irrelevant but they <em>should</em> take option 3 as, although in the long term they still lose money, their loss is slightly less.</p>

<h2>Conclusion</h2>

<p>Using a Monte Carlo method to analyse this sort of puzzle is possible, but you have to run a lot of simulations to get consistent results. However, this is like real gambling where as this simulation showed, even a year of nightly gaming doesnâ€™t produce consistent results!</p>

<p>A quick search of the web on random walks will give some idea of the likely variation after a given number of rounds, and so an indication of the number of rounds you might need to run to get the desired consistency in the results.</p>
</p>
<p><strong>Notes:</strong>&nbsp;</p>
<p><em>More fields may be available via dynamicdata ..</em></p>
</div>
</channel>
</rss>
