Can You Beat a Computer At Rock-Paper-Scissors? 292
tekgoblin writes "The New York Times has created a game that uses artificial intelligence to outsmart you. It uses a simple game called Rock-Paper-Scissors which is pretty much known by everyone on the planet by now. The computer tries to mimic human reasoning by building on simple rules and statistical averages. So based on the rules of the game and your previous moves, the computer tries to make predictions on your next move. The game has 2 modes, the first being Novice, where the computer learns the game from scratch, and Veteran, where the computer has experience of over 200,000 rounds of previous experience."
#winning! (Score:2, Troll)
Re:#winning! (Score:4, Funny)
I wasted 10 minutes of my day playing this yesterday. I then looked at others who were playing Farmville, made it feel like they were doing something productive for a change.
Re: (Score:3)
You were wrong.
I can beat the computer... (Score:5, Funny)
... in the slightly modified version:
Rock-paper-scissors-control-alt-delete.
Re:I can beat the computer... (Score:5, Funny)
Rock-paper-scissors-control-alt-delete.
Typical human behavior... Always resorting to violence.
Re:I can beat the computer... (Score:5, Informative)
Re:I can beat the computer... (Score:5, Funny)
http://www.umop.com/rps101/rps101chart.html [umop.com]
I prefer dynamite tornado quicksand pit chain gun law whip sword rock death wall sun camera fire chainsaw school scissors poison cage axe peace computer castle snake blood porcupine vulture monkey king queen prince princess police woman baby man home train car noise bicycle tree turnip duck wolf cat bird fish spider cockroach brain community cross money vampire sponge church butter book paper cloud airplane moon grass film toilet air planet guitar bowl cup beer rain water tv rainbow ufo alien prayer mountain satan dragon diamond platinum gold devil fence video game math robot heart electricity lightning medusa power laser nuke sky tank helicopter myself.
Re: (Score:3)
My score is 12 wins, 11 ties, 5 losses so far, starting to get bored. If you select what the computer "incorrectly predicted you would throw" it often lets you win, and other times I just choose randomly to fuck with it.
Re: (Score:2)
Re: (Score:2)
Whether or not a human is capable of choosing randomly or not, atleast the computer isn't able to predict it.
For me more wins than losses too. Purely by chance these numbers should be the same.
Re: (Score:2)
Purely by chance these numbers should be the same.
That's probably the key -- although you might be close-to-random, the computer is using some kind of prediction algorithm which *isn't* random, so it's choices are going to be skewed based on previous experience.
Re: (Score:2)
To win, you have to observe your opponent's sequence for correlations and exploit any patterns you discover. Indeed, I've
Re: (Score:2)
Re: (Score:2)
Truly random play has the same expected results against every single strategy.Think about it this way: no matter what the computer thinks you will do, if you play truly randomly, its odds of winning, losing or tying are all 1/3. If it did any better, it would be able to predict randomness, which is by definition impossible, and if it did any worse, then by inverting its strategy it would do better, and the same reasoning holds.
That makes sense, but it supposes that someone is playing randomly. If the premise is that humans can't play randomly, then you don't have "random vs strategy," you have pseudo-random vs pseudo-random, and it's possible/probable that the computer's choices are skewed. Which is kind of what you said in the second paragraph (and what I said above, if maybe not as elegantly as you).
Re: (Score:3)
Re: (Score:3)
Re:I can beat the computer... (Score:4, Informative)
It does not matter whether the computer favors a choice more than the other. Imagine that there is maximal favoritism and the computer just always picks rock. If you play randomly, you will win 1/3 of the time (whenever you happen to randomly pick paper), you will lose 1/3 of the time (idem, scissors), and you will tie 1/3 of the time (idem, rock).
Imagine the computer picks rock X% of the time, paper Y% of the time, scissors in all other instances. Whenever it picks rock, you have 1/3 odds of picking paper and winning. Whenever it picks paper, you have 1/3 odds of picking scissors and winning. Whenever it picks scissors, you have 1/3 odds of picking rock and winning. X * 1/3 + Y * 1/3 + (1 - X - Y) * 1/3 = X/3 + Y/3 + 1/3 - X/3 - Y/3 = 1/3, for all X and for all Y. No strategy can expect to win or lose against a random strategy more than 1/3 of the time in the limit of the number of rounds played.
Re: (Score:2)
It isn't, that's why the computer can beat you, it learns how you pick "random" numbers
Humans are terrible at picking random numbers, computers can easily be trained to see the patterns in the pseudo random sequences, this has been done before many many times ...
If you use a proper random number generator to pick your choice then it's average score will go to chance (1/3 wins 1/3 draws 1/3 losses)
Re: (Score:2)
It's not ESP, it's just that the computer is adapted to common human selection traits based on the last few hands (seems it maybe only uses the last 4 hands as a reference for what you're going to do next according to the "see what the computer is thinking" tab). So if you act differently, then it will take thousands of games for it to catch up to your style. Maybe if I played against the "dumb" version it would do better as it may learn my "style" immediately. I'm not sure of my style exactly, but I was ki
Re: (Score:3)
The moment you reach for the keyboard, the computer cuts off your fingers with some scissors, and hits you on the head with a rock.
Then it prints a pic of you laying there, wasting a sheet of paper.
First paper, then scissors, then rock (Score:5, Funny)
Slap the paper over the intake fan, cut the Ethernet cable with the scissors, then bash it with the rock, easy.
--
Pass
Re: (Score:3)
Yes (Score:3, Funny)
Re: (Score:2)
This game is random , you can't outsmart someone (Score:2)
Just keep making purely random choices and the computer can only ever draw.
Re:This game is random , you can't outsmart someon (Score:4, Interesting)
Your choices aren't truly random though.
It's been argued many times, that people make choices in patterns.
Re: (Score:3)
The Princess Bride (Score:2)
it's much more like the battle of wits in The Princess Bride than random guessing.
Did you watch that movie? The game was entirely random, but Westley won by cheating, he poisoned both cups. You can't do that in RPS.
Re:The Princess Bride (Score:4, Insightful)
He wasn't cheating -- he never said only one was poisoned. He asked, "Where is the poison? The game ends when you choose and we both drink."
If Vencini wasn't so full of himself, he might have reasoned that there were four possibilities:
Once you realize that, you can reason about it. Poison in neither cup would be compeltely pointless -- we both drink, and then we're in the same position we were before. Poison in one of the cups? Very risky. Essentially random, with a 50% chance of him dying. At any rate, it's certainly only a game of chance, not a game of wits. Poison in both cups? Seems pretty crazy -- then we both die. Ah -- but do we both die? What if he has an immunity or an antidote? Then if I fall for his trick, it's 100% -- I die no matter what I pick, and he lives. No, you bastard -- the poison is in both cups; I'm not drinking. I win the battle of wits by not falling for your trick.
Re: (Score:2)
No, you bastard -- the No, you bastard -- the poison is in both cups; I'm not drinking. I win the battle of wits by not falling for your trick.poison is in both cups; I'm not drinking. I win the battle of wits by not falling for your trick.
"The battle of wits ends when you decide and we both drink" -- If Vencini hadn't drunk, the battle wouldn't have ended. By picking a poison to which he was immune, Westley cheated.
But, of course, in a battle of wits cheating is to be expected. Like Snake Plissken playing by Bangkok rules [youtube.com].
Re: (Score:3)
The other interesting thing about that scene is that Vizzini does his own clever trick. He switches the cups and waits to see if Wesley is comfortable drinking (what he thinks is) his cup. Since he is, and Vizzini has Wesley's original cup, he feels safe drinking it. Which is perfectly rational and a good way to beat the game if you assume there is poison in exactly one cup.
Re: (Score:2)
Sorrry, but it's bullshit, the winning strategy is randomness. (see Nash-equilibrium)
Re: (Score:2)
Untrue. Nash equilibria aren't 'winning strategies' (see prisoner's dilemma). Randomness is an unbeatable strategy, but the best strategy depends on what your opponent does.
If they play completely randomly, you can't do any better than also playing completely randomly. But if there is any non-randomness in their actions you can definitely do better. For example, if they always play scissors, the winning strategy is clearly not completely random.
Re: (Score:2)
Randomness won't lose but it won't win either. Overall it will draw against any non-cheating* strategy. Therefore it would be the best strategy under the following conditions
1: everyone had a true rng or a a csprng in their head.
2: noone was cheating* and/or the player had the ability to throw consistenly in a way that defeated cheats
3: everyone was rational
4: everyone assumed everyone else was rational.
However people are neither rational or good at coming up with random numbers....
*A "cheating" strategy wo
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
When I want to be 'random' I map successive digits of pi to whatever problem I am considering. (In this case, 1-3: rock, 4-6: paper, 7-9: scissors.)
Apparently memorising hundreds of those as a kid wasn't worthless after all!
Re: (Score:2)
Hold on while I write an algorithm to match RPS choices to strings of pi digits and I'll have you beaten.
Re: (Score:2)
In reality, I beat the first 7 rounds, then lost 10 in a row. Then later lost about 12-15 rounds in a row and ragequit immediately.
GET OUT OF MY HEAD!!!
Re: (Score:2)
Then it's not your choice.
Re: (Score:2)
Re: (Score:2)
I guess the point is that people tend to deviate from this strategy and the computer can take advantage of those deviations.
I would be very interested to know how the learning algorithm works. Given that the program is taking advantage of your deviations from the 1/3-1/3-1/3 strategy, it follows that the computer is itself deviating from that strategy. Therefore there should be some strategy that beats the computer on average.
I guess you could continue this reasoning ad infinitum, but I would say that the m
Re: (Score:2)
Except that you're not capable of making purely random choices. The human brain isn't wired for it.
Re: (Score:2)
Re: (Score:2)
I did this many years ago. No need for fancy AI, a simple Markov chain was enough to beat the people I tried with. Today I would make it adapt the chain length dynamically, trying with different lengths and keeping track of their performance. But even a 3-level chain (if I remember right) beat humans consitently in about 50 games, and the random number generator of that old machine in less than 10000 games. But it was probably not a good random number thing...
Re: (Score:2)
Re: (Score:2)
Once they figure it out and start playing by predicting my moves instead of trying to behave randomly, the score tends to even out. Also, it becomes quite an interesting game.
Re: (Score:2)
Try using a random number generator instead of what you think is you being random. It seems to use the last 4 moves you made as a predictor of your next move, though I was using its moves to influence my own.
Obligatory Simpsons (Score:2)
Ob. Simpsons: (Score:3)
Bart: Good ol' rock, nothing beats that!
RoShamBo (Score:2)
2000: Andreas Junghanns writes: "Check out the Second International RoShamBo Programming Competition for a completely different experience! If you think you know everything about Rock-Paper-Scissors -- here is your chance to prove it against some stiff international competition. At the Web site you can find rules, sample programs and a report of the first contest, complete with results and program descriptions." This looks pretty cool, and it might make a neat first project for someone, too. [slashdot.org]
Basically... (Score:2)
So, it is a computer version of Derren Brown [yahoo.com]?
Best strategy (Score:2)
The best strategy is:
a) You roll a dice (6 sides) that only you can see
b) 1-2 Rock, 3-4 Scissor, 5-6 Paper
No Watson can beat that one...
CU, Martin
Re: (Score:2)
On the other hand, using this method, you can only ever draw with any strategy - including rock-rock-rock-rock-....
With this in mind, is it really the best strategy?
Re: (Score:2)
Re:Best strategy (Score:4, Interesting)
Your theory about patterns is wrong. Even if they are incorrectly detecting a pattern it doesn't change the odds of your random choice winning/losing/drawing.
A good strategy would mix random choices with selectively picked moves. Effectively you would need to double-guess what the computer system thinks your pattern is. Very good systems would then track if they are being tracked etc. Two 'perfect' systems would trade increasingly rare attempts to score, as they realise that the best reliable result they can hope for is a draw. This is because any winnning strategy must be based on predicting your opponents choices, the more you act upon your predictions the more a good opponent can learn about how your algorithm works and how to defeat it.
Re: (Score:2)
Two 'perfect' systems would trade increasingly rare attempts to score, as they realise that the best reliable result they can hope for is a draw.
Reminds me of WOPR re: thermonuclear war: "the only winning move is not to play."
Re: (Score:2)
After exactly one hundred human-random games: 36/29/35. Not much intelligence going on on either side ;)
FWIW, the strategy the computer uses should be easier to manipulate than the "strategy" of a human player, since it is far more deterministic.
Re: (Score:2)
Choosing your move on random is mathematically proven to be the best strategy in this game. Since this game has no strategy to guarantee winning, the best strategy to play aims for not loosing.
This Rock-Paper-Scissor game is typically game No. 1 or 2 studied within game theory (part of Operations Research).
CU, Martin
Re: (Score:2)
Re: (Score:2)
I spent the last few years building up... (Score:2)
up an immunity to iocane powder.
Not very good (Score:2)
I'm not using a random generator to pick my moves, so the veteran algorithm should be able to predict what I'm thinking at least slightly. Instead, it gets it wrong more often than not, and after 20 rounds I led 6:4 with 10 ties. Maybe it'll get better after I play a while.
Re: (Score:2)
Re: (Score:2)
Even worse, I used an "algorithm" to play (which is to say, a pattern), and I had a 11:2:7 (win:lose:draw) record. This was also on 'veteran'.
computer RoShamBo competion (Score:2)
Beating a human player at rock-paper-scissor is easy. Computers playing against each other is much more fun. There used to be a computer RoShamBo (same game, different name) competition, see: http://webdocs.cs.ualberta.ca/~darse/rsbpc.html [ualberta.ca]
Re: (Score:2)
It's already obsolete (Score:2)
Us nerds have already moved on to Rock-Paper-Scissors-Spock-Lizard a long time ago.
Been there, done that, got the shirt [thinkgeek.com].
Help me statistician your my only hope ... (Score:2)
Re: (Score:2)
It only looks at the last 4. Any run longer than 4 with you both choosing the same should just continue like that until YOU choose something different.
Paper Rules (Score:2)
For an intro (and I mean intro) course in Computer Science at uni, we were assigned to write a Java client in a game called Paper Rules. Establish TCP connection, wait for the master server to find an opponent (another client) for you, and then repeatedly send either ROCK, PAPER or SCISSORS to the server and read the result of the match. To make it interesting, the rules were enhanced so winning a round yielded 1 point, losing -1 point, except when paper won, in which case 2 points were assigned to the winn
TL:DR; No. (Score:5, Funny)
If it's designed to outsmart me, I'm guessing unless I really learnt its algorithms, and there was a limit placed on its memory/analysis, that I couldn't.
Don't mean to brag, but I'm pretty fucking awesome when it comes to Paper-Rock-Scissors (it's like Rock-Paper-Scissors with ROT1). The reason I was good, was I was good at gauging the intelligence of my opponent, and emulating how they would emulate me, then moving to the next level.
The best experience of this was a competition at school, where you had to beat one person, advance to level 2, beat a level 2, advance to level 3, until I think it was level 6 or 7. If you lost, you got demoted, if you won, you advanced. It was the best of 3. This was done in quick succession, eg, the entire game took about 5 minutes for me, 30 minutes to an hour for others.
I won by beating level 1 (easy), people think you go rock, so they go paper, so I go scissors. Next they chase scissors, not sure why, but this round is in quick succession to the first, and maybe its being unable to come up with anything else, so I go rock. BAM! LEVEL UP!
Next level was relatively easy, they must have had a similar thought process to me, so I go rock (remembering the decision process for level 1). Next they go 2 moves ahead from rock, because that's their level of emulation. This means they go scissors again. So I go rock. BAM! LEVEL UP!
Next level was harder, first round they had the level 2 decision process, but the second round they've caught on, so I need to go scissors, which is 1 move ahead (or could also be seen as taking the level 2 decision process, but I modeled it in my mind as taking 1 move ahead). They go paper! BAM! LEVEL UP!
Next level was much harder, but by now I got a good idea of what I should be doing. Following on from before, I emulate them as my last turn, and BAM! LEVEL UP!
Did this a few times.
At the end had a collision, I went rock, they went rock. WHOAH! FIRST LOSS/DRAW! I realized that this person was doing exactly as I was doing, the hard problem then became, modelling my own process. I remember we did the count down 1..2.. and I said stop. Wait. Because I couldn't walk through the chain of previous decisions fast enough in my mind, to come at the one I want. Once I had it, I went, okay go. 1...2...3...BAM! I WIN! Next round, 1...2...3...BAM! I WIN! LEVEL UP!
I'm now crowned king of all students and get to go sit on the benches and wait for the idiots. When I talked to the people who finished next, and asked them what they did, they explained it exactly how I did. In the end, I was able to predict their capability one further though. A large part of why the decision processes above would have worked was also because I was the first to level up, and get out, if I messed up early on, and got stuck amongst the riffraff I'd likely be unable to apply the same reasoning, as each level would follow that process less, and be less refined. Also, give I sort of knew these people, I probably had a reasonable feeling on their ability to think like me, which probably helped quite a lot.
As you may be able garner by now, this was the greatest moment of my life. Now some might say, the law of large numbers applies here, and that what I achieved, was just randomness in action. Well fuck you! Given their explanations later, my ability to repeat this a few other times, and my ego, I come to the conclusion that this was not random.
Wait... what was I saying. Oh yeah.
Anyhow, because of this, I'd likely be unable to defeat the computer over and over again, as its ability to estimate my thought process (give it's simple like above), would be far greater as it can store a lot more of "if I go x he goes y after I went x and he went y and I went...", while also applying statistical analysis to it. Though, I do however think I'd be able to give it a good enough run for its money, that we'd diverge towards 50% win rate, as my thought process would devolve to random, in the long run.
Ergo, could you beat a computer at Paper-Rock-Scissors? No, no I fucking couldn't, that's a stupid question. Next you'll be fucking asking me "Could you beat a computer at calculating and verifying primes?".
Re:TL:DR; No. (Score:5, Funny)
As you may be able garner by now, this was the greatest moment of my life.
You know how sometimes you read things on the internet and you think "I'm almost certain that's a joke, but there is worrying shadow of doubt lurking at the back of my mind"?
Re: (Score:2)
LOL That worry is well founded. While said in jest, I am proud of it, and I do get quite a lot of mileage out of this story.
So, I know it isn't a worthwhile accomplishment, and thats why the story is written as if I was doing something absolutely intense, kind of to poke fun at how pleased I am with that accomplishment.
Further more, it was awesome, and you can't take that from me! You're not the boss of me, and you're not my real dad!
Re: (Score:2)
The moment I read your comment.
The second worst was when my uncle touched me, but I had repressed this until you posted your comment.
THANKS ARSEHOLE!
Re: (Score:2)
Ergo, could you beat a computer at Paper-Rock-Scissors? No, no I fucking couldn't, that's a stupid question. Next you'll be fucking asking me "Could you beat a computer at calculating and verifying primes?".
Beating "a computer" could be difficult. But beating a computer that plays based on statistics how human opponents play... Totally possible, if you can estimate on what level most people in that statistic play.
Re: (Score:2)
Given it learns, might have a greater weight on the most recent rounds, than older rounds, then this would be extremely hard.
Also, ever done statistics in your head?
I don't see that lasting long if we have to do it in our heads. If we can also do calculations on a computer, then its hardly us vs the computer, more 1 computer vs another computer.
Re: (Score:2)
This one is fairly simple. It keeps the last 200K rounds, and then to make a prediction is searches these for occurences where both human and computer has played the same 4 things in sequence. It then predicts the most common choice for the human, and responds based on that.
i.e. if last-4-rounds was human: RPSR and computer SPRR it searches the last 200K rounds to find that precise situation, yielding on the average 781 times before that that *precise* situation has occured. It then predicts what the human
Re: (Score:2)
Sometime the learning is quite straightforward (Score:2)
Although written in about 100 lines of Woz's Integer BASIC, the learning algorithm was simplicity itself: Each round, the computer kept track of its moves (and only its moves) in a table that was indexed by how many matches were left (a 22-
Reminds me of a Commodore program (Score:2)
in some mag about 25 years ago. "Hit this key or that key." Algorithm just will have significant predictive success because people just don't do random.
It allowed randomness to make your choices (Score:2)
As in, instead of following your natural inclination you use an outside random event decide your next move you could keep the computer from establishing a pattern in your behavior. Like, using dice or basing your choice on single pull from a deck of cards. Otherwise I am quite sure it can establish a pattern regardless of what you do
Re:It allowed randomness to make your choices (Score:4, Funny)
If your pattern is completely random, the opponent can easily win by favoring one.
For example, random against always rock, rock wins 2 out of 3 times.
Re: (Score:3)
Sounds like "New Math" to me. I suggest you run a simulation to verify just how wrong you are.
Rock paper scissors lizard spock? (Score:2)
I mean, seriously, who plays the plain rock paper scissors any more? Plus, for the augmented game, a winning strategy for the computer is much easier: if player's http referrer is slashdot, always choose lizard to poison Spock..
No Good (Score:2)
Tied over 20 games...seems about what I would expect from a human.
And thus... (Score:2)
And thus, Skynet was born.
Sure, you might be able to beat it now, but when it decides to change the rules to Rock, Paper, Scissors, Nukes... we are f*cked.
at 5-5-5 vs veteran (Score:2)
Spent too much time on it... (Score:2)
Veteran is easier, I think (Score:2)
If you think about it, Veteran mode is easier; all you have to do is try to think counter to what a 'normal person' would do.
13-7-6 on Veteran
8-9-9 on Novice
Hardly scientific, but yeah.
Ha! (Score:2)
Rock, Paper, Taser! I win!
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
The game is well known in Germany at least and I would be surprised when almost every culture had some analog to it, as it is based around a core concept of game design, names and items might differ, but the rules are likely the same.
Re: (Score:2)
And actually I still don't know how it is played.
Two people choose either rock, paper or scissors. Paper beats rock. Rock defeats scissors. Scissors defeat paper. The player who defeats the other player wins.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)