Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

scissors_papers_stone

9 views
Skip to first unread message

Scissors Paper

unread,
Oct 29, 2007, 7:06:34 AM10/29/07
to
making a game for uni in ruby for the first time, called scissors papers
stone and wanted to know if you can find out what method your oppenents
are using before they use and and counter them.
--
Posted via http://www.ruby-forum.com/.

Alex Young

unread,
Oct 29, 2007, 7:57:00 AM10/29/07
to
Scissors Paper wrote:
> making a game for uni in ruby for the first time, called scissors papers
> stone and wanted to know if you can find out what method your oppenents
> are using before they use and and counter them.
That depends on the implementation - are you playing against other
people on the network, at the same machine, against the CPU, or some
other manifestation?

--
Alex

James Edward Gray II

unread,
Oct 29, 2007, 8:14:23 AM10/29/07
to
On Oct 29, 2007, at 6:06 AM, Scissors Paper wrote:

> making a game for uni in ruby for the first time, called scissors
> papers
> stone and wanted to know if you can find out what method your
> oppenents
> are using before they use and and counter them.

This was a Ruby Quiz some time ago:

http://www.rubyquiz.com/quiz16.html

James Edward Gray II

M. Edward (Ed) Borasky

unread,
Oct 29, 2007, 8:53:43 PM10/29/07
to

Hmmm ... reminds me of the old Claude Shannon penny matching machine.
Isn't rock/paper/scissors the base-three equivalent of that? Anyhow, if
you can find the Shannon paper, it will give you some clues on how to do
rock/paper/scissors against a human opponent.

John Joyce

unread,
Oct 30, 2007, 9:08:01 AM10/30/07
to

Oh but it is so much more than a number game.
It is about timing and has the x-factor of personality like in Poker.
Doesn't make a good computer game.
As "janken" in Japan it is frequently used to settle minor disputes
and make decisions by people of all ages.
Yet, I've never seen a video game version of it in Japan...

M. Edward (Ed) Borasky

unread,
Oct 30, 2007, 8:27:23 PM10/30/07
to
There's a similar Italian game (I've forgotten the name) that involves
one, two or three fingers. That one I'm pretty sure is in "The Compleat
Strategist".

AEt...@gmx.de

unread,
Nov 1, 2007, 12:34:35 PM11/1/07
to

-------- Original-Nachricht --------
> Datum: Tue, 30 Oct 2007 22:08:01 +0900
> Von: John Joyce <dangerwillro...@gmail.com>
> An: ruby...@ruby-lang.org
> Betreff: Re: scissors_papers_stone

There is a discussion of this game in the book "The Compleat Strategyst",
by J.D. Williams, pp. 98 and following in my (Dover) edition.
From the "payoff matrix" of this game, one finds that there is no
dominant strategy and that players should play each strategy on a 1:1:1
basis, i.e. choose each of the three symbols with equal probability.

But things change if you give different payoffs for different encounters
(e.g.
three dollars to a player if she or he wins in a stone/scissors encounter,
two dollars to a player if she or he wins in a paper/stone encounter,
and one dollar to a player if she or he wins in a scissor/paper encounter,
( that situation is discussed in the book "The mathematics of games" by John D. Beasley, Oxford University Press.)

If you always chose the same object, your
opponent can adapt to that and win over you. So you must mix your
choices with some probabilities p_sci,p_sto,p_pap, so that

p_sci+p_sto+p_pap=1.

Your average gain will be
(3*p_sto-p_pap) whenever your opponent shows scissors,
(p_sci-2*p_sto) whenever your opponent shows paper,
(2*p_pap-3*p_sci) whenever your opponent shows stone.


Now, you can't make all these gains positive by choosing the values
for p_pap,p_sci,p_sto, as this requires (3*p_sto>p_pap), (p_sci>2*p_sto),
(2*p_pap>3p_sto), and thus 6p_sto>2p_pap>3p_sci>6p_sto, that's impossible.

But you can achieve that none of the gains is negative, by setting

p_sci=1/3,
p_pap=1/2,
p_sto=1/6.

If you vary this strategy, at least one of your gains is negative,
and your opponent wins. So it doesn't matter what your opponent does,
as long as you play your optimal strategy.
On the other hand, your opponent can play it the same way.
Thus, nobody wins (on average).

How to implement such a game for more general payoffs?
Maybe you just use some external
linear programming tool like glpk that has Ruby bindings
http://groups.google.de/group/ruby-talk-google/browse_thread/thread/11f0a2029ad2bfd3

Best regards,

Axel
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger

0 new messages