<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Code Question: Rock, Paper, Scissors]]></title><description><![CDATA[<p dir="auto">So I brought up using OWoD LARP mechanics in a MU in another thread, and I had a question for the code savvy folks out there:</p>
<p dir="auto">How would you go about coding RPS into a MU?</p>
<p dir="auto">For an example, I want to play RPS with Mary.</p>
<p dir="auto">I should be able to do “RPS Mary” or “+RPS Mary” and get some output that looks like:</p>
<pre><code>You throw rock, paper, scissors with Mary. 
You throw PAPER!
Mary throws SCISSORS!
You lose!
</code></pre>
<p dir="auto">Under the hood, in an effort to streamline the process, the game chooses an RPS value for both me and Mary at random, then figures out which one wins. If they are randomly the same, it’s declared a draw.</p>
]]></description><link>https://brandmu.day/topic/196/code-question-rock-paper-scissors</link><generator>RSS for Node</generator><lastBuildDate>Sat, 04 Apr 2026 11:32:03 GMT</lastBuildDate><atom:link href="https://brandmu.day/topic/196.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 03 Aug 2022 21:37:27 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Thu, 04 Aug 2022 17:21:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://brandmu.day/uid/60">@MisterBoring</a> said in <a href="/post/6881">Code Question: Rock, Paper, Scissors</a>:</p>
<blockquote>
<p dir="auto">You do have a point about RPS strategy that I hadn’t considered, so perhaps having the command be a bit more interactive so that each player inputs their choice.</p>
</blockquote>
<p dir="auto">If it only ever runs one game at a time, you can run it so you <code>rps &lt;choice&gt;</code> and it creates a data attribute on an object.  If you’re the first player, it stores your data and emits something about “waiting for 2nd player…”</p>
<p dir="auto">If it already has one DATA-* attribute, then it knows you’re the second player, and it resolves the match, emits the resolution, and wipes the data.</p>
<p dir="auto">If it already has two DATA-* attributes, then it is broken. <img src="https://brandmu.day/assets/plugins/nodebb-plugin-emoji/emoji/android/1f604.png?v=ad502f21e27" class="not-responsive emoji emoji-android emoji--smile" style="height:23px;width:auto;vertical-align:middle" title=":D" alt="😄" /></p>
]]></description><link>https://brandmu.day/post/6893</link><guid isPermaLink="true">https://brandmu.day/post/6893</guid><dc:creator><![CDATA[KarmaBum]]></dc:creator><pubDate>Thu, 04 Aug 2022 17:21:01 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Thu, 04 Aug 2022 16:02:24 GMT]]></title><description><![CDATA[<p dir="auto">Well, I’m most familiar with TinyMUX, with PennMUSH a close second, so those would be the ones I’d understand the quickest.</p>
<p dir="auto">To <a class="plugin-mentions-user plugin-mentions-a" href="https://brandmu.day/uid/71">@Faraday</a> <a class="plugin-mentions-user plugin-mentions-a" href="https://brandmu.day/uid/160">@Warma-Sheen</a> : You do have a point about RPS strategy that I hadn’t considered, so perhaps having the command be a bit more interactive so that each player inputs their choice.</p>
<p dir="auto">Also, <a class="plugin-mentions-user plugin-mentions-a" href="https://brandmu.day/uid/31">@Jennkryst</a> : That’s right, we don’t want your funny signs here. <img src="https://brandmu.day/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61b.png?v=ad502f21e27" class="not-responsive emoji emoji-android emoji--stuck_out_tongue" style="height:23px;width:auto;vertical-align:middle" title=":P" alt="😛" /></p>
]]></description><link>https://brandmu.day/post/6881</link><guid isPermaLink="true">https://brandmu.day/post/6881</guid><dc:creator><![CDATA[MisterBoring]]></dc:creator><pubDate>Thu, 04 Aug 2022 16:02:24 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Thu, 04 Aug 2022 00:57:37 GMT]]></title><description><![CDATA[<p dir="auto">Definitely don’t take the player option of of RPS, otherwise there’s no reason to use RPS.  That would turn people away.</p>
]]></description><link>https://brandmu.day/post/6818</link><guid isPermaLink="true">https://brandmu.day/post/6818</guid><dc:creator><![CDATA[Warma Sheen]]></dc:creator><pubDate>Thu, 04 Aug 2022 00:57:37 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Thu, 04 Aug 2022 01:59:29 GMT]]></title><description><![CDATA[<p dir="auto">If you remove the strategy from RPS by just picking randomly (which, as stated previously, I wouldn’t recommend), there’s an equivalent chance of win, loss, or tie. So just <code>rand(1,6)</code> (or whatever the equivalent is in your codebase) and emit “You play rock paper scissors with Mary and &lt;result&gt;!” Win on 1-2, Lose on 3-4, and Tie on 5-6.</p>
<p dir="auto">If you want strategy, then you need each player to enter the commands as a multi-part sequence:</p>
<ul>
<li>I do <code>rps Mary=scissors</code> and the system stores “scissors” for Faraday v Mary.</li>
<li>Mary does <code>rps Faraday=rock</code> and the system recognizes that this is the second piece of the Faraday v Mary game.</li>
<li>The system compares rock vs scissors and says Mary wins. There are only 9 possible scenarios so it’s not too involved to figure out the outcome.</li>
</ul>
<p dir="auto">How precisely you do this will of course vary by codebase.</p>
]]></description><link>https://brandmu.day/post/6815</link><guid isPermaLink="true">https://brandmu.day/post/6815</guid><dc:creator><![CDATA[Faraday]]></dc:creator><pubDate>Thu, 04 Aug 2022 01:59:29 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Wed, 03 Aug 2022 23:49:10 GMT]]></title><description><![CDATA[<p dir="auto">I started typing it in pseudo code and got very tired because I am not a real coder.</p>
<p dir="auto">But yes. Store some variables and compare the results, or 1d3.</p>
]]></description><link>https://brandmu.day/post/6804</link><guid isPermaLink="true">https://brandmu.day/post/6804</guid><dc:creator><![CDATA[Solstice]]></dc:creator><pubDate>Wed, 03 Aug 2022 23:49:10 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Wed, 03 Aug 2022 23:40:58 GMT]]></title><description><![CDATA[<p dir="auto">You could have it be determined completely randomly, or, you could have it be that the controller has to set what they are going to throw before hand.</p>
]]></description><link>https://brandmu.day/post/6802</link><guid isPermaLink="true">https://brandmu.day/post/6802</guid><dc:creator><![CDATA[Mourne]]></dc:creator><pubDate>Wed, 03 Aug 2022 23:40:58 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Wed, 03 Aug 2022 22:35:14 GMT]]></title><description><![CDATA[<p dir="auto">I’m confused.  If you’re just going to draw straws at random, why not just do a coin flip or roll a die? A big part of RPS is the strategy of “oh they picked rock last time so I’ll pick scissors” or whatever.</p>
<p dir="auto">That would be more complicated because you’d need a command that would store state until both characters had entered their thing.</p>
]]></description><link>https://brandmu.day/post/6794</link><guid isPermaLink="true">https://brandmu.day/post/6794</guid><dc:creator><![CDATA[Faraday]]></dc:creator><pubDate>Wed, 03 Aug 2022 22:35:14 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Wed, 03 Aug 2022 22:20:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://brandmu.day/uid/60">@MisterBoring</a> It might help to include what codebase/language you’re looking for!</p>
]]></description><link>https://brandmu.day/post/6791</link><guid isPermaLink="true">https://brandmu.day/post/6791</guid><dc:creator><![CDATA[Roz]]></dc:creator><pubDate>Wed, 03 Aug 2022 22:20:27 GMT</pubDate></item><item><title><![CDATA[Reply to Code Question: Rock, Paper, Scissors on Wed, 03 Aug 2022 22:17:14 GMT]]></title><description><![CDATA[<p dir="auto">This is Lizard Spock erasure.</p>
]]></description><link>https://brandmu.day/post/6790</link><guid isPermaLink="true">https://brandmu.day/post/6790</guid><dc:creator><![CDATA[Jennkryst]]></dc:creator><pubDate>Wed, 03 Aug 2022 22:17:14 GMT</pubDate></item></channel></rss>