Oh no! I dropped my laptop on the ground and the Roshambo course code spilled out all over the floor! (Fortunately, the number guesser is fine.)

I threw all the lines of code back into a text file, but none of the lines are in order.

Plus, a bunch of end brackets fell down a sewer grate, so I need your help finding a few.

Instructions

Use editpad or notepad and rearrange the code so that it will run a little rock-paper-scissors application in your web browser.

Here are some tips:

  • Use each line of code once and only once.
  • Do not write any of your own code.
  • Group similar looking pieces of code together as you are starting out.
  • Do not write any of your own code.
  • Group HTML tag elements together and elements that look like code together
  • Do not write any of your own code.
  • When you think your done, save the file as rps.html and open it in a web browser and see if it works!!!

rock paper scissors

Here’s a GitHub page with the code in raw, unformatted text:

Roshambo Code Scramble

It’s better to copy from the raw, unformatted text. Copying the text below might give you some unwanted HTML characters. YMMV.


} // end if

} // end if

} // end if

} // end method

if (clientGesture=='scissors') {

<title>Rock Paper Roshambo in JavaScript </title>

<div id="results"></div>

result = "tie";

<br/>

<script>

<a href="#" onclick="playRoshambo('paper')">paper</a>

</body>

<p>Which one will it be?</p>

</script>

result = "win";

<html>

result = "lose";

<a href="#" onclick="playRoshambo('rock')">rock</a>

if (clientGesture=='rock') {

<head>

if (clientGesture=='paper') { 

</html>

playRoshambo = function(clientGesture){

</head>

document.getElementById('results').innerHTML = result;

<body>

<a href="#" onclick="playRoshambo('scissors')">scissors</a>

Part II: The Java App

Here is the second scramble. I’m not putting the code on this page as people will confuse it with the code above:

https://github.com/jheguevara/java101/blob/master/shared_stuff/03%20second%20scramble.txt

Can you create a standalone Java application from this code? Can you compile it and run it on the command line? In Eclipse?

Could you turn it into a Spring Boot app???