Rock-Paper-Scissors
March 6, 2011 4:46 PM   Subscribe

Rock-Paper-Scissors: You vs. the Computer. "Computers mimic human reasoning by building on simple rules and statistical averages. Test your strategy against the computer in this rock-paper-scissors game illustrating basic artificial intelligence. Choose from two different modes: novice, where the computer learns to play from scratch, and veteran, where the computer pits over 200,000 rounds of previous experience against you."
posted by bwg (71 comments total) 11 users marked this as a favorite
 
I was thinking about posting this. I played the veteran one several times. When I tried to anticipate its guessing process, it beat me badly. When I tried to pick my throws randomly, it also beat me badly (so badly I thought it might be cheating; at one point I started with paper 6 times and then chose scissors and ended 0 - 7). When I actually selected randomly (drawing slips of paper out of a hat), I did significantly better than chance would predict. It's interesting.
posted by penduluum at 4:54 PM on March 6, 2011 [7 favorites]


Me vs. Expert: I won three, it won three. We tied for four. Basically, I tried to do the opposite of what I figured other folks would do. The position of the buttons and the order in which it gets recited when you play aloud matter, I think.

I remember reading an article about Rock-Paper-Scissors tournaments several years ago.
posted by aniola at 4:55 PM on March 6, 2011


It's easy to predict what it thinks you'll do on novice. Expert was more difficult; I got six ties, 5 wins for the computer and one win for me (yay!)
posted by biochemist at 4:59 PM on March 6, 2011


I played it once on novice and lost and got pissed off and quit. So eat it, computer.
posted by kbanas at 5:00 PM on March 6, 2011 [1 favorite]


50 rounds vs the Veteran version, and I was down 14-13-23. Pretty neat. I remember typing in a tiny, tiny, miniature program in BASIC many years ago that played the Match game (we both choose '0' or '1', I get a point if the choices differ, the computer gets a point) very well. It was really intriguing - at the time I didn't really understand how the program worked (it was very cryptic in addition to being small, as I remember) and I've often wished I could find it again.
posted by Wolfdog at 5:02 PM on March 6, 2011


(I mean, I get a point if the choices differ; the computer gets a point if they match, obviously.)
posted by Wolfdog at 5:03 PM on March 6, 2011


Iocaine Powder is a heuristically designed compilation of strategies and meta-strategies which took first place in Darse Billings' excellent First International RoShamBo Programming Competition.
posted by finite at 5:03 PM on March 6, 2011 [5 favorites]


I had an initial winning streak by playing the opposite of whatever my first gut instinct was. Then I got kind of muddles between what my actual gut was saying and what the opposite was and started winngin some, losing some.
posted by signal at 5:06 PM on March 6, 2011


And, after 100 rounds, down 27-31-42.
posted by Wolfdog at 5:09 PM on March 6, 2011


Vs. expert, I won 5 times, we tied 4 times, I never lost. I guess I'm a super-genius. But I knew that already.
posted by mrnutty at 5:10 PM on March 6, 2011


penduluum: I played the veteran one several times. When I tried to anticipate its guessing process, it beat me badly. When I tried to pick my throws randomly, it also beat me badly (so badly I thought it might be cheating; at one point I started with paper 6 times and then chose scissors and ended 0 - 7). When I actually selected randomly (drawing slips of paper out of a hat), I did significantly better than chance would predict. It's interesting.
Tangentially related: I've long argued that an enterprising major league baseball team would hire some compsci types to build an engine like this, attempting to 'guess' the next pitch that's coming. Given the wealth of data from PitchFX over the past several years, plus the real-time data, I hypothesize that a computer would detect patterns a hitter couldn't, and the pitcher/catcher battery didn't realize they had- just as with penduluum, we can't really emulate randomness well at all.

Given how much better a hitter is if he knows what's coming, and given that most pitchers don't have more than 3 pitches in their repertoire, a slight signal from the dugout aided by this technology could easily provide a 1 or 2 percentage point bump in batting averages for the team. And that .010 increase in average would likely translate into 7-8 extra wins over the season, a WAR that would make the computer the MVP of the league...
posted by hincandenza at 5:10 PM on March 6, 2011 [7 favorites]


One excellent way of beating the computer (based on a sample size of one...) is to break its expectations. I tried playing a game vs the Expert computer where I only ever chose scissors or paper - a human would notice this and adjust their strategy, but the computer stayed with its assumption that I was always going to pick whichever of the three choices was best, and over 20 games I won 11-3-6. Admittedly, this may be because it's much easier to generate a seemingly random stream (the optimal strategy) with only 2 possible outcomes than with three.
posted by ZsigE at 5:10 PM on March 6, 2011


Me vs. veteran: 30-35-35. Come and get me, Watson!
posted by ainliff at 5:12 PM on March 6, 2011


I wonder if those 200,000 rounds of experience gets skewed if you turn on the "see what the computer is thinking" and proceed to use that to whup it's butt, or if it just throws those results out.
posted by juv3nal at 5:13 PM on March 6, 2011


10-5-5 vs. veteran. Although one time I looked inside it's mind.
posted by Vectorcon Systems at 5:13 PM on March 6, 2011


22 / 13 / 15 on expert and a run of 50. You can lead the computer on moderately easy.
posted by edgeways at 5:16 PM on March 6, 2011


I'm kicking expert's ass, 6-2-2, ten games in. Stay tuned to see if my streak of awesome computer-defeating awesomeness continues!
posted by entropone at 5:16 PM on March 6, 2011


It's up to 11-7-11. Hmmm.
posted by entropone at 5:18 PM on March 6, 2011


The computer went on a winning streak, so I told it that its robotic hand would never feel the gentle touch of someone that it truly loved, and from that point on it was pretty easy.
posted by dudekiller at 5:19 PM on March 6, 2011 [9 favorites]


18-14-17 and I'm going to quit while I'm ahead, declare everlasting victory over machines, and go back to my cave.
posted by entropone at 5:21 PM on March 6, 2011 [2 favorites]


There was a type-in computer program about this phenomenon in an old issue of, of all things, COMPUTE'S Gazette. The program asked the player to choose one of two boxes fifty times, and tried to predict what he'd pick based on past selections. It was supposed to be very good. I should look for that issue online (I lost my physical copy in the Great Closet Clean-Out years back.)

It worked on the principle that human beings, for all their vaunted unpredictability, are actually pretty bad at picking things randomly from a limited range of choices. Try writing down a string of random integers from 1 to 10 as fast as you can. Before long you'll notice that you're settling into patterns. And although you can break out of the pattern easily, it's hard to avoid settling down into a new pattern. I know that there are certain numbers I tend to gravitate towards when I try to pick random digits: odd numbers, prime numbers, and numbers that are far from ones just picked. Trying to fight against those biases helps a bit, but of course that's just a different kind of bias.

Using an outside source of randomness is one way to defeat these programs, in that it can't do better than average at them in the long run. I would say that penduluum's observation of doing better than chance is a freak occurrence. But importantly, trying to predict what the computer will pick is itself a pattern, and one the computer can detect in itself, especially after a number of trials.
posted by JHarris at 5:26 PM on March 6, 2011


12-8-11 against the veteran. I'll now retire from the game and let my legend live forever.
posted by vidur at 5:26 PM on March 6, 2011


Veteran match out of 100: 39-44-17

The trick? Don't think like a person, or rather don't think like one person. Instead teach it to lose.
posted by Blasdelb at 5:28 PM on March 6, 2011 [2 favorites]


I was beating it yesterday, until I decided to see what would happen if I kept throwing scissors.
posted by inedible at 5:35 PM on March 6, 2011


Wrote a random RPS picker in perl, beat veteran by 9-8-8. Calling it victory. Probably isn't.
posted by jenkinsEar at 5:36 PM on March 6, 2011


Yeah, when something is based on predicting human behaviour, the best tactic is to remove the human. I tried three 20-round veteran games with numbers picked from random.org: 5-5-10, then 9-4-7, then 8-4-8.
posted by Paragon at 5:38 PM on March 6, 2011


The trick is to pysche out your opponent. One method is to light your head on fire.
posted by justkevin at 5:39 PM on March 6, 2011


I based my strategy on the digits of Pi, because nobody else would think of that. I lost badly, which shows that the digits of Pi are in fact not random.
posted by Joe in Australia at 5:39 PM on March 6, 2011


57-50-43 from a 150 vet round, no peeking. I think it is best to have three or four strategies and switch them out
posted by edgeways at 5:42 PM on March 6, 2011


Hmm, if I understand the "see what the computer is thinking" correctly, the computer's decisions are based only on the choices of the last four rounds. It might be possible to create a table of what the computer decides every possible combination of the last four rounds and win every time. Of course, that table would have to have 8^3 entries...
posted by Wemmick at 5:42 PM on March 6, 2011


err, 3^8 rather.
posted by Wemmick at 5:46 PM on March 6, 2011


This was a very interesting way to look at randomness, in that, you're not as random as you think you are.
posted by Cool Papa Bell at 5:50 PM on March 6, 2011


Cool Papa Bell: "This was a very interesting way to look at randomness, in that, you're not as random as you think you are"

I knew you were going to say that.
posted by bwg at 5:56 PM on March 6, 2011 [4 favorites]


I seemed to do better against the veteran than against the novice.
posted by Night_owl at 5:59 PM on March 6, 2011


> "I've long argued that an enterprising major league baseball team would hire some compsci types to build an engine like this, attempting to 'guess' the next pitch that's coming."

If no teams appear to already be using this technology then all teams are already using this technology.
posted by komara at 6:09 PM on March 6, 2011 [1 favorite]


I beat it 7-6-4 by trying to predict what it would throw and doing the opposite of that. Since I doubt that is a sustainable strategy, I decided to quit while ahead.
posted by T.D. Strange at 6:09 PM on March 6, 2011


100 rounds, 44 wins, only 30 losses. My strategy was to use the hundredths digit on a digital timer, 1-3 = rock, 4-6 = paper, 7-9 = scissors and on zeroes I'd try to anticipate and go against the grain. Seemed to work pretty well, but I didn't keep track of my record on my 0's.
posted by skewed at 6:12 PM on March 6, 2011


I am not going to help Skynet get smarter.
posted by Brandon Blatcher at 6:19 PM on March 6, 2011 [5 favorites]


On veteran mode, I lost.

But then we played a game of rock / paper / kill -9, and I won that.
posted by qxntpqbbbqxl at 6:19 PM on March 6, 2011 [8 favorites]


Good ol' rock. Nothing beats that. Except robot hand. 0-1-19.
posted by snofoam at 6:30 PM on March 6, 2011 [1 favorite]


I used random.org. I was up 20-7-7 and then decided to quit. When I tried on my own I got smacked.
posted by Hactar at 6:31 PM on March 6, 2011


I...mostly got ties. A freakish number of ties. Am I...human?
posted by majonesing at 6:32 PM on March 6, 2011 [2 favorites]


I remember running across the World RPS Society years ago when it was just a message board about international RPS tournaments and strategies. I was pretty sure it was just a joke, but it was hard to be 100% sure, because the more you think about RPS, the more strategy there is.
posted by rikschell at 6:41 PM on March 6, 2011


2019:

You selected PAPER.
COMPUTER selected SCISSORS.
Report to BAY 331 for carbonization.
NEXT CITIZEN

posted by obiwanwasabi at 6:44 PM on March 6, 2011 [13 favorites]


I tied novice, but it was tough (ended up with something like 19-24-19, after it was way ahead at one point. Expert is MUCH easier for me so far, I'm at 6-1-0.
posted by rottytooth at 6:56 PM on March 6, 2011


Okay, I've been playing expert longer and now it's starting to pretty consistently beat me -- trying to keep it random but it seems to have figured me out.
posted by rottytooth at 7:01 PM on March 6, 2011


I used excel to pick 100 random numbers for me, and played it out. We tied, 36-28-36. I feel like I have made a fundamental flaw, somewhere in my life, that I am relaying one computer's moves in a game to another computer. Is this what the future will be like?
posted by agentofselection at 7:03 PM on March 6, 2011 [4 favorites]


I was up 12-10-5 on veteran then lost four in a row so I cut my losses and quit while I was still ahead. Final tally 12-11-9. It is interesting, though: my strategy, which worked well for the first few throws, was to do exactly the opposite of what it seemed like a smart player would throw next -- on every tie, throw the sign that would lose to the computer's last sign, for instance. But then it picked up on my strategy, I guess, and I had to switch to another: keep throwing the same sign an unreasonable number of times. That worked OK. Until it didn't.
posted by BitterOldPunk at 7:12 PM on March 6, 2011


my 100 game record 40-24-36.

I'm ahead by a slight margin. I guess that means it's learned from playing chumps! Or my success is statistically insignificant.
posted by aubilenon at 7:12 PM on March 6, 2011


38-36-26 in veteran mode. Since it predicts your behaviour based on your previous throws, you need to build-in some patterns, and then beat it over the head with them. For example, throw 3-4 scissors in a row and then the next few times you throw scissors 2 times it will assume that the 3rd time will also be scissors. By intentionally building patterns, you can capitalize on its predictable reaction.
posted by Simon Barclay at 7:37 PM on March 6, 2011


Paper Paper Rock = The Executive
posted by furtive at 8:11 PM on March 6, 2011 [2 favorites]


8-13-4 after 25 in veteran mode. It likes the tie.
posted by not_on_display at 8:12 PM on March 6, 2011


38-25-37 against a random sequence of 100 throws (thanks, /dev/random!). I'd be willing to bet that random choices result in a "push" result over any longish sequence of throws.
posted by axiom at 8:14 PM on March 6, 2011


50 throws in Expert and I beat it 21-16-13.

Since it predicts your behaviour based on your previous throws, you need to build-in some patterns, and then beat it over the head with them. For example, throw 3-4 scissors in a row and then the next few times you throw scissors 2 times it will assume that the 3rd time will also be scissors. By intentionally building patterns, you can capitalize on its predictable reaction.

This is basically what I did. Built three sets of patterns and kept alternating them in random (to me) order, putting in a different variation each time.

So yeah, bring it, Skynet.
posted by greenland at 9:03 PM on March 6, 2011


I lost badly, which shows that the digits of Pi are in fact not random.

Of course not— they're related to a property of circles. They're also heavily biased unless you discard all the 9s.
posted by ryanrs at 9:05 PM on March 6, 2011


Clock seconds, mod 3. Poor computer doesn't know what to do.
posted by nzero at 10:06 PM on March 6, 2011


10-6-4 on Veteran. Take that, technology!
posted by elder18 at 10:07 PM on March 6, 2011


Darse Billings' excellent First International RoShamBo Programming Competition.

Yes! Which is a lot of fun to read about. I thought maybe I had made a post about it a while back, but it turns out it was just a vague-memory comment last year.
posted by cortex at 10:24 PM on March 6, 2011


5-23-8

I'm just about as good as a robot!
posted by klangklangston at 10:33 PM on March 6, 2011


This should be lesson four in Emerging Artificial Technologies.

4. If you shrink the purview enough, the machine can beat the man every time.

Turing could have written a textbook about this.
posted by Sphinx at 10:33 PM on March 6, 2011


I played this morning and can't remember the exact score, but I was beating the veteran *soundly* over about 50 games- something like 30-13-7. It's as much about being random as thinking a few steps out. If the computer throws a few rocks in a row, he's goading me into throwing paper so he can throw scissors, so instead I go with... scissors, because 1) he throws scissors and we tie, or 2) he plays paper to try and beat the rock he thinks is coming his way, and I win.

Instead of trying to win the most matches by winning, win by tying instead of losing. If that makes sense.
posted by BuddhaInABucket at 10:48 PM on March 6, 2011


I think there was a Star Trek episode like that, BuddhaInABucket.
posted by ryanrs at 11:09 PM on March 6, 2011


I found the COMPUTE'S Gazette article I referenced above. The program was "Predictor," by John Krutch, in the June 1986 issue (Vol 4, Issue 6).
posted by JHarris at 11:40 PM on March 6, 2011 [1 favorite]


HOLDEN: You're in a desert, walking along in the sand, when all of a sudden you look down...
LEON: What one?
HOLDEN: What?
LEON: What desert?
HOLDEN: It doesn't make any difference what desert, it's completely hypothetical.
LEON: But, how come I'd be there?
HOLDEN: Maybe you're fed up. Maybe you want to be by yourself. Who knows? You look down and see a rock, Leon. It's sitting there ...
LEON: Rock? What's that?
HOLDEN: You know what a stone is?
LEON: Of course!
HOLDEN: Same thing.
LEON: I've never seen a rock ... But I understand what you mean.
HOLDEN: You reach down and you throw Paper, Leon.
LEON: Do you make up these questions, Mr. Holden? Or do they write 'em down for you?
HOLDEN: The rock lays there, covered by the paper, trying to escape from the smothering, but it can't. Not without your help. But you're not helping.
LEON: What do you mean, I'm not helping?
HOLDEN: Describe in single words only the good things that come into your mind about ... scissors.
LEON: Scissors?
HOLDEN: Yeah.
LEON: Let me tell you about scissors.
[LEON suddenly pulls his hand out from under the table and throws Rock.]
posted by No-sword at 1:24 AM on March 7, 2011 [8 favorites]


10-5-5 vs. veteran. Although one time I looked inside it's mind.

Very not cool, bitfucker. We don't do that.
posted by Meatbomb at 4:05 AM on March 7, 2011 [1 favorite]


I wrote a historical analysis RPS program back on my Vic20. Mind, you, there's wasn't THAT much history, but it sure did wow the rubes.
posted by Samizdata at 4:36 AM on March 7, 2011


The way this game works is funny.

If you, in fact, go random in an RPS tournament -- you will not win the tournament. You won't come in last, but you won't win.

Your only hope is to have a pattern, such that you are figuring out the patterns of others. Which means any interesting opponent has a pattern, that if you can find it, you yourself have a chance of winning.

It's really fascinating -- to win, you must play a potentially losing strategy, for to play it safe is to lose by default.
posted by effugas at 6:04 AM on March 7, 2011


I beat it 9-6-5 on veteran. It kept thinking I'd get bored of throwing rocks all in a row and that I would switch to paper, but I stuck with trusty old rock.
posted by yeti at 6:22 AM on March 7, 2011


I played 15 rounds on veteran, won 8 and tied 7. The computer won zero. I think I'm gonna quit while I'm undefeated.
posted by rusty at 9:35 AM on March 7, 2011


The trick, by the way, is that in veteran mode it's not predicting your behavior based on your previous behavior. It's predicting your behavior based on everyone else's previous behavior. You're playing against a statistical average of what some random person would throw next. It's pretty easy (I find, anyway) to guess what that's going to be, and then use the thing that beats it.

And what that all boils down to is throwing the same thing three or four times in a row a lot. The third time in a row is unlikely (because people are bad at generating randomness, but good at generating change), the fourth time in a row is really unlikely.
posted by rusty at 9:40 AM on March 7, 2011 [1 favorite]


Yeah, the veteran mode was surprisingly easy to beat. Score one for humans.

Humans: More unpredictable than randomness
posted by vacapinta at 5:54 AM on March 8, 2011


« Older A Cautionary Song   |   ACCEPT ALL CHALLENGES! Newer »


This thread has been archived and is closed to new comments