Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
AI Games

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."
This discussion has been archived. No new comments can be posted.

Can You Beat a Computer At Rock-Paper-Scissors?

Comments Filter:
  • #winning! (Score:2, Troll)

    by alphatel ( 1450715 ) *
    I for one, welcome our new rock-paper-scissors overlords.
  • by bobdotorg ( 598873 ) on Wednesday March 09, 2011 @06:42AM (#35428108)

    ... in the slightly modified version:
    Rock-paper-scissors-control-alt-delete.

    • by Mortiss ( 812218 ) on Wednesday March 09, 2011 @06:46AM (#35428130)

      Rock-paper-scissors-control-alt-delete.

      Typical human behavior... Always resorting to violence.

    • by bmorency ( 1221186 ) on Wednesday March 09, 2011 @06:53AM (#35428172)
      I prefer rock paper scissors lizard spock myself.
      • by daid303 ( 843777 ) on Wednesday March 09, 2011 @07:30AM (#35428360)

        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.

    • 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.

      • Strictly speaking, I'm not sure it's possible for a human to "choose randomly," but maybe I'm over-thinking the phrase... And it's probably insignificant in practical terms, since "random" and "based on sufficiently-unknown processes" are probably close enough for most purposes.
        • by mwvdlee ( 775178 )

          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.

          • 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.

            • Right, so in this particular zero-sum game, the only way to be certain not to lose is to use a true-random (or as close as makes no difference) generator to select your moves, e.g. roll a die, 1 or 6 is rock, 2 or 5 is paper, 3 or 4 is scissors (first order correction for the weight of the pip cutouts). No matter what your opponent's strategy, this leads to a draw in the long run.

              To win, you have to observe your opponent's sequence for correlations and exploit any patterns you discover. Indeed, I've
            • What if the human used a random number generator to guide their moves? What would the outcome be? You would expect that it would be 50/50, over enough trials, but maybe being truly random would throw the computer off it's game, and cause it to lose more than 50% of the time.
        • 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)

    • by gatkinso ( 15975 )

      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.

  • by presspass ( 1770650 ) on Wednesday March 09, 2011 @06:46AM (#35428122)

    Slap the paper over the intake fan, cut the Ethernet cable with the scissors, then bash it with the rock, easy.

    --
    Pass

  • Yes (Score:3, Funny)

    by TimmyRt ( 1354547 ) on Wednesday March 09, 2011 @06:46AM (#35428124)
    At 10-3-2 I feel like I can say yes. Now do my dishes computer!
  • Just keep making purely random choices and the computer can only ever draw.

    • by Tukz ( 664339 ) on Wednesday March 09, 2011 @06:52AM (#35428156) Journal

      Your choices aren't truly random though.
      It's been argued many times, that people make choices in patterns.

      • Exactly. They aren't random at all. Laugh if you want but there is actually a RPS strategy guide. Its mostly determining what kind of person your opponent is and knowing what that person is likely to pick from what they know of you. it's much more like the battle of wits in The Princess Bride than random guessing.
        • 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.

          • by martyros ( 588782 ) on Wednesday March 09, 2011 @08:30AM (#35428652)

            The game was entirely random, but Westley won by cheating, he poisoned both cups.

            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:

            • Poison in the cup in front of me
            • Poison in the cup in front of the masked man
            • Poison in neither cup
            • Poison in both.

            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.

            • by mangu ( 126918 )

              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].

            • 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.

        • Sorrry, but it's bullshit, the winning strategy is randomness. (see Nash-equilibrium)

          • by Timmmm ( 636430 )

            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.

          • 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

        • I can consistently beat my girlfriend in RPS, maybe 70% of the time. The trick it to focus on what she thinks I am thinking and be one step ahead. The reason I win is that my girlfriend has a research masters degree in a humanities subject and the game requires both logic and empathy; the humanities focus precludes logic and postgraduate education precludes empathy. It is like beating Steven Hawking in an arm wrestling match.
      • by Olix ( 812847 )

        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!

        • 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.)

          Hold on while I write an algorithm to match RPS choices to strings of pi digits and I'll have you beaten.
      • Yeah, if you guess purely random, you will probably win only 50% of the time. The real trick is to outguess the computer by figuring out what it thinks that you think.

        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!!!
    • 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

    • Except that you're not capable of making purely random choices. The human brain isn't wired for it.

    • 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...

    • by N1AK ( 864906 )
      I can let the fact your naive enough to think humans are good at making genuinely random (or even pseudo-random) decisions go. What I don't understand is why did you bother posting, you're evidently not informed on the subject or experienced in a related field. Your post, at best, wastes other peoples time and, at worst, misleads others.
    • by bcmm ( 768152 )
      I can fairly reliably beat some people. You see, a human's idea of "random" can be pretty predictable. People's reactions can be quite amusing; especially if they "know" it's a random game.

      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.
  • Good ol' rock, nothing beats it.
  • by david@ecsd.com ( 45841 ) on Wednesday March 09, 2011 @06:52AM (#35428158) Homepage
    Lisa: Poor predictable Bart, always chooses rock.

    Bart: Good ol' rock, nothing beats that!

  • So, it is a computer version of Derren Brown [yahoo.com]?

  • 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

    • 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?

      • Yes! I just ran a random number generator in the background, and played depending the result. I beat the machine, because the machine is not random, it do what people do. So if I was playing against someone who is not random, i will beat him using this method because this person will see patterns where there is none.
        • Re:Best strategy (Score:4, Interesting)

          by N1AK ( 864906 ) on Wednesday March 09, 2011 @07:52AM (#35428442) Homepage
          You may have won in a specific case, that doesn't mean it is a winning strategy. Mathematically, a strategy based on pure randomness can't be more or less likely to win on average. Why? Because you can effectively ignore what the non-random player selects. There is a 1/3 chance you will randomly pick the same, 1/3 that you will randomly pick the one that beats them and 1/3 that you will pick the one that loses.

          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.
          • by Thing 1 ( 178996 )

            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."

      • by mseeger ( 40923 )

        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

        • by dingen ( 958134 )
          That only works when the opponent does the same. If the opponent displays certain patterns in play however, it is better to analyze these patterns and use a strategy to counter the other player.
    • Make sure they are casino dice, most common dice aren't "perfect"
  • up an immunity to iocane powder.

  • 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.

    • After a short number of rounds in any game involving chance, a player at a disadvantage can be ahead. The more rounds you play, the lower the chance that the player at a disadvantage is ahead. Understanding this [wikipedia.org] is critical to understanding how Las Vegas makes money, or how scientific experiments are performed.
    • 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'.

  • 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]

  • 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].

  • Playing in veteran mode when I loose, and then stubbornly refuse to change my choice, I'll constantly loose as the computer then 'correctly predicts I would play scissors' or whatever losing choice I've made repeatedly. Surely at some point it should think I won't be that dumb any more and I'll change my choice so shouldn't it change it's choice at some point too? Why does it always stick with it's winning choice? How many of the previous 200,000 rounds would have over twenty consecutive choices of scissors
    • 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.

  • 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)

    by definate ( 876684 ) on Wednesday March 09, 2011 @07:22AM (#35428330)

    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?".

    • by WombatDeath ( 681651 ) on Wednesday March 09, 2011 @07:43AM (#35428404)

      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"?

      • 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!

    • 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.

      • 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.

        • by Eivind ( 15695 )

          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

    • Reply at your signature: Look at Somalia. The lack of government and law enforcement has created a chaos. People are being murdered for looking at other people the wrong way. Preventing that is the good government does.
  • Back in my youth, programming in BASIC and 6502 assembler on the Apple ][, I wrote a "learning" game of "23 matches". The object of this 2-person game (in this case, human v. computer) is to avoid taking the last match. Each round, the player can take 1, 2 or 3 matches.

    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-
  • 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.

  • 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

  • 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..

  • Tied over 20 games...seems about what I would expect from a human.

  • 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.

  • I feel that no matter how well the prediction based on previous algorithms, if chosen randomly with no thought to what you will be picking, this should be the outcome every time. It assumes you will pick something based upon your previous choice. Obviously, this is an easy system to beat once you figured it out, but I was just clicking randomly. Against random, you'll see nice, even numbers. Or odds, depending on when you want to show your score.
  • ...but I figured out that if I just randomly pick moves while talking to someone or thinking about another task I was much more successful. If, however, I thought hard about my choice and tried to use strategy then I lost big time.
  • 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.

  • Rock, Paper, Taser! I win!

Technology is dominated by those who manage what they do not understand.

Working...