Welcome to Version 001 of Rock, Paper, Scissors, Lizard, Spock!

Description of this version of RPSLS

This is the most minimal version possible. There is no webinterface, no buttons, no pictures, only the basic function.

How to play

Since there is only the rudimentary function, that gives a random choice for your computer opponent and computes the winner, you have to play this game in the console.

  1. Open the console of your browser (if you do not know how to do this: right clicking on the page and choosing "inspect this element", brings up the developer tools and there will be a tab called "Console" or "JS" or something similar.), this will be your game interface.
  2. Type your move into the console like this: rpsls("Spock") Possible moves are:
    • rpsls("rock")
    • rpsls("paper")
    • rpsls("scissors")
    • rpsls("lizard")
    • rpsls("Spock")
  3. The console will show the full information on the game and the result:
    rpsls("Spock")
    undefined
    "You choose Spock."
    "Computer chooses lizard."
    "Computer wins!"
  4. Of course you can play again anytime.

About this version

There is not much original thought built into this version of the game. I had the idea to build this game while I was enrolled into the course An Introduction to Interactive Programming in Python (Part 1) on Cousera.org. The first real coding (very, very small) project is to built RPSLS in Python in just the same way as this game here is built in JavaScript. I was thinking about this excercise, when I talked to a friend about practice projects to learn how to build Websites and Webapps. So I got the Idea: why not built a RPSLS on a website, with graphics, maybe animations, with, in short, cool stuff.As you can see, this version has none of that, it is only the same function, that the Course lets you build in the first week, but converted to JavaScript. To do that was relatively easy. The most part of it was only switching simple Python statements and functions to JavaScript functions, like print to console.log(). The only small challange was how to compute the winner: the rpsls-function in Python uses the modulo operator and uses it to reduce the conditional branches (the ifs and elses) to a minimum of 3 with 5 conditions, but JavaScript does not have a modulo operator, so I had to recalculate the results and take into account the possible negative results of the division remainder operator that JavaScript uses instead. This nearly doubled the conditions.

What I like about this version

It works.

What I don't like about this version

Apart from the obvious, that it is not even attempting to be user friendly fun, I don't like that the results are so dull: A simple "You win!" or "The computer wins" is worse than for example "Lizard poisons Spock. The computer wins!". This is the result of reducing the conditionals from 25 to 3, which seems like a good idea, but the result is even more boring than a game played in the console needs to be.