As Sheldon Cooper explains, the rules of RPSLS are the following : Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, and as it always has, rock crushes scissors.
For the Artificial Intelligence (AI) of our RPSLS Game, we are going to use a Markov Chain. It will let us to predict the next move that should be played by the user. Like that, we could react consequently and choosing an item against which the predicted item will lose.
In the above figure, you can see a diagram representing a two-state Markov process, with the states labelled E and A. Each number represents the probability of the Markov process changing from one state to another state, with the direction indicated by the arrow.
In our RPSLS Game, each state will be represented by an Item. During the game, we will store in a Matrix the number of events passing from an item to an other item. Thus, if the user has played ROCK at the previous throw and then, he plays PAPER, we will increment the ROCK to PAPER counter in the matrix.
To choose the next move to play for our AI, we will use the Matrix presented previously. We need to know the previous throw made by the user. With that, we choose in the matrix the corresponding line. We iterate on the elements of that line and we choose the item for which the column has the maximum number of events. This is the predicted item for next move of the user.
Now, we can create the core of our RPSLS Game. First, we initialize the matrix for our Markov Chain. Then, we use aScannerto get the user input. We update our matrix by calling theupdateMarkovChainmethod.
In the same time, we call thenextMovemethod to get the throw choosen by the computer. We check who is the winner of this throwing between user and computer. We display the result of this throwing on the console.
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
One really needs to be smart to understand the jokes cracked in The Big Bang Theory. If not smart, at least have an interest in the geeky world outside. Sheldon, Leonard, Raj, Howard, and Penny represent a perfect example of four geeks and one blonde.
Without any doubt, Dr. Sheldon Cooper is the show stopper, stealer, and the star of The Big Bang Theory. Its like he has evolved 100 years ahead but has returned in a time machine that is now stuck in the 21st century.
Rock, Paper, Scissors, Lizard, Spock -Sheldon Cooper'stypically quirky take on the traditional hand game - is the perfect expression of Sheldon himself. But how does the infamousThe Big Bang Theory game work?Known for his odd behavior and unusual quirks, the socially-inept genius never missed an opportunity to brag about his intelligence.That ranged from just being brutally honest about it to coming up with new ways to complicate simple activities like the popular game.
Not that hewas only doing this to showoff; Sheldon (Jim Parsons) is really smart, but instead of being humble about it, he liked to rub it in even to his other highly intelligent friends, annoying them in the process. Naturally, whenever the rest of the Pasadena gang gets an opportunity to make fun of him overThe Big Bang Theory's 12 seasons, or at least give him the idea that they are smarter than him, they almost always take advantage. Complicating Rock, Paper, Scissors didn't seem like it was just another way for him to establish his intelligence because he may simply have found the original game to be too simple for him.
That is presumably why he introduced his friends to his very own version of Rock, Paper, Scissors modified with the addition of two new hand options: Lizard and Spock. It's uncertain why he decided to use a reptile in his iteration, but given his undying love for Spock and Star Trek with a string of actor cameoson the sitcom over the years, not to mention his similarities to the character, it makes sense why he wanted to incorporate the famous half-Vulcan. Sheldon first talked about Rock, Paper, Scissors, Lizard, Spock in The Big Bang Theory season 2, episode 18 aptly-titled "The Lizard-Spock Expansion" as a way for him and Raj (Kunal Nayyar) to settle a dispute about what they want to watch on TV.
As Sheldon explained to Raj and Leonard (Johnny Galecki), who was listening to their conversation, Rock, Paper, Scissors, Lizard, Spock adapts the rules of the original game, with Lizard and Spock giving players more options. In the game, Scissors cuts Paper; Paper covers Rock; Rock crushes Lizard; Lizard poisons Spock; Spock smashes Scissors; Scissors decapitates Lizard, Lizard eats Paper; Paper disproves Spock; Spock vaporizes Rocks and finally, Rock crushes Scissors.For the most part, these scenarios do make sense, but in the service of The Big Bang Theory's humor, there are also a couple that's mind baffling. That includes Paper potentially disproving Spock. In any case, Raj was interested, resulting in him agreeing to play the game.
While he's the one to introduce it to his friends, it appears as if Sheldon didn't create the game himself. Blogger Sam Kass came up with the variation of the game with Karen Bryla, with the former claiming that the show producerdidn't ask permission to use it in The Big Bang Theory. The show rectified this behind-the-scenes resulting in Sheldon finally giving Kass the credit he deserved for it in season 5, episode 17 titled "The Rothman Disintegration."
Accidental movie fan who is perpetually curious, Ana rekindled her love for writing several years back and married it with everything pop culture. The result is a passionate young writer who could ramble (and of course, pen) about films and series multiple hours a day. She has a soft spot for The Lion King, old songs, and home design; is currently obsessed with old sitcoms (The Golden Girls!); and won't dare watch any horror films although shes (ironically) dying to see one. Though a bit late to the party and was an actual Force non-believer, she now finds the Star Wars franchise quite fascinating (fun fact: it was a crazy Jar Jar Binks/Sith theory that drew her in).
As Sheldon explains, "Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitates lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock, and as it always has, rock crushes scissors."
When Sheldon and Raj can't agree about what to watch on TV, with Sheldon favoring Saturn 3 and Raj wanting to watch Deep Space Nine, Raj suggests they settle it with a game of Rock Paper Scissors. Sheldon thinks they should play Rock Paper Scissors Lizard Spock instead, as there is a lower chance that the game will end in a tie.
As Sheldon and Barry Kripke argue over who should get Professor Rothman's vacated office, Raj suggests they settle it with a game of Rock Paper Scissors Lizard Spock. Barry Kripke has never heard of it so Sheldon explains the rules to him. To torment him, Kripke asks Sheldon to explain the rules again and again.
Stack Exchange network consists of 177 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
"Scissors cuts paper, paper covers rock, rock crushes lizard, lizard poisons Spock, Spock smashes scissors, scissors decapitate lizard, lizard eats paper, paper disproves Spock, Spock vaporizes rock. And as it always has, rock crushes scissors."
The first thing I thought was "I need a way to compare the possible selections" - this sounded like IComparable
Then I needed a way to get user input. I knew I was going to make a simple console app, but just so I could run unit tests I decided to create an IUserInputProvider interface - the first pass had all 3 methods in the interface, but since I wasn't using them all, I only kept one; I don't think getting rid of GetUserInput(string) would hurt:
If Sheldon decides to add a new item to the game then you have to go to n classes to adjust the comparisons and winning verbs. I usually try to avoid such designs because whenever you require a developer to change stuff in n places when something new is added then he/she is bound to forget one place.
One thing to improve with my version is that rules just effectively define winning rules and all other cases are implicitly ties which in the context of this game makes sense but could be made more explicit.
If A.CompareTo(B) returns a value x that is not equal to zero, and B.CompareTo(C) returns a value y of the same sign as x, then A.CompareTo(C) is required to return a value of the same sign as x and y.
EDIT 14-Jul-2014: in response to Malachi's comment, I've rewritten the Play method to return an object rather than two out parameters. The code is the same length and it's arguable whether it's any clearer. Here's the updated version:
Sheldon battles Kripke for a coveted office at the university. Penny receives a very unusual gift from Amy.Sheldon battles Kripke for a coveted office at the university. Penny receives a very unusual gift from Amy.Sheldon battles Kripke for a coveted office at the university. Penny receives a very unusual gift from Amy.
Sheldon Cooper: Oh, it's very simple. Scissors cuts paper, paper covers rock, rock crushes Lizard, Lizard poisons Spock, Spock smashes scissors, scissors decapitates Lizard, Lizard eats paper, paper disproves Spock, Spock vaperizes rock, and as it always has, rock crushes scissors.
Sheldon Cooper: Oh, of course. Scissors cuts paper, paper covers rock, rock crushes Lizard, Lizard poisons Spock, Spock smashes scissors, scissors decapitates Lizard, Lizard eats paper, paper disproves Spock, Spock vaperizes rock, and as it always has, rock crushes scissors.
Sheldon Cooper: Is he? Well, then, seems we have reached an impasse. I see no other option than to challenge you to a duel. I'd smack you with a glove, but just last week, I packed away my winter things.
Sheldon Lee Cooper Ph.D., Sc.D., is a fictional character in the CBS television series The Big Bang Theory and its spinoff series Young Sheldon, portrayed by actors Jim Parsons in The Big Bang Theory and Iain Armitage in Young Sheldon (with Parsons as the latter series narrator). For his portrayal, Parsons has won four Primetime Emmy Awards, a Golden Globe Award, a TCA Award, and two Critics Choice Television Awards. Sheldon Cooper quotes about life, change, being smart, science, friendship and love will inspire you in life.Get in Touch with Mechanic