Roshambo Code Challenge

Here's the CSS, HTML and JavaScriptassignment.

If you want to pass the AWS Certification exams, you need to know a little bit of code. Not a lot, but you do need to know your way around web pages, Java files and modern data exchange formats like YAML and JSON.

  1. Drag from the left to the right to sort the scrambled Rock-Paper-Scissors code.
  2. The code will fall into one of three files: index.html, style.css and script.js.
  3. Save all three files on your desktop.
  4. Open your index.html file in Chrome and view your page in a web browser!
  5. You should always lint your code when you get it to work.
  6. Right-click and choose 'Inspect' in your browser to see your source code and view any console output.
JavaScript, CSS and HTML for AWS Exam
Here's what the styled and scripted HTML example looks like.

The RAW WebPage

Here's what the latest edition of the number guesser game looks like, with JavaScript, styles and HTML all mixed into one file.

It is an anti-pattern to combine style, structure and script all in one file.

Style, structure and JavaScript should be separated out into .css, .html and .js files for easier management.

<html>

  <head>
    <title>The Number Guesser Game</title>
	<style>
	body {padding:50; font-family:sans-serif;}
	button {background: linear-gradient(45deg, #6831e3, #f528cb);}
	h3 {color:navy}
	.display {
         background: silver;
		 color:white;
         text-align: center;
		 margin-top: 10px;
		 font-size: 1.5em; 
         }
	</style>
  </head>

  <body>
    <h3>Want to play a game?</h3>
    <p>Pick a number between <b>1</b> and <b>5</b>? </p>
    <button onclick="playTheGame('1')"> 1 </button> &nbsp;
    <button onclick="playTheGame('2')"> 2 </button> &nbsp;
    <button onclick="playTheGame('3')"> 3 </button> &nbsp;
    <button onclick="playTheGame('4')"> 4 </button> &nbsp;
    <button onclick="playTheGame('5')"> 5 </button> &nbsp;
    <div id="results" class="display">Results will appear here.</div>
    <script>
      var magicNumber = Math.floor(Math.random() * 5);
      playTheGame = function(guess) {
        var response = "Nope. It's not " + guess;
        if (guess > magicNumber) {
          response = response + ". Guess Lower!";
        } // close guess lower if
        if (guess < magicNumber) {
          response = response + ". Guess Higher!"
        } // close guess higher if
        if (guess == magicNumber) {
          response = "You got it correct!"
          response += " The number was " + magicNumber + ".";
          magicNumber = Math.floor(Math.random() * 5);
        } // end the if
        document.getElementById('results').innerHTML = response;
      } // end the method
    </script>
  </body>

</html>

WARNING: The dragging and dropping function doesn't work great on handhelds.

  • index.html
  • </body>
  • <button onclick="playTheGame('2')"> 2 </button> &nbsp;
  • <body>
  • <button onclick="playTheGame('5')"> 5 </button> &nbsp;
  • <h3>Want to play a game?</h3>
  • </html>
  • <title>The Number Guesser Game</title>
  • <script src="script.js"></script>
  • <button onclick="playTheGame('4')"> 4 </button> &nbsp;
  • <link rel=stylesheet href="style.css">
  • <html>
  • <p>Pick a number between <b>1</b> and <b>5</b>? </p>
  • <button onclick="playTheGame('1')"> 1 </button> &nbsp;
  • </head>
  • <button onclick="playTheGame('3')"> 3 </button> &nbsp;
  • <head>
  • <div id="results" class="display">Results appear here.</div>

  • style.css
  • button {background: linear-gradient(45deg, #6831e3, #f528cb);}
  • color:white;
  • body {padding:50; font-family:sans-serif;}
  • background: silver;
  • font-size: 1.5em;
  • .display {
  • }
  • margin-top: 10px;
  • h3 {color:navy}
  • text-align: center;
  • script.js
  • response = response + ". Guess Lower!"
  • document.getElementById('results').innerHTML = response;
  • }
  • if (guess == magicNumber) {
  • } // end the method
  • playTheGame = function(guess) {
  • response = response + ". Guess Higher!"
  • if (guess > magicNumber)
  • response = " Correct. The number was " + magicNumber + "."
  • if (guess < magicNumber)
  • magicNumber = Math.floor(Math.random() * 5);
  • var magicNumber = Math.floor(Math.random() * 5);
  • var response = "Nope. It's not " + guess;
  • index.html
  • Start me up!
  • Put something here
  • SEO Optimized Page title
  • Script or stylesheet?
  • Put something here
  • Start the body
  • Put something here
  • Put something here
  • Button
  • Put something here
  • Put something here
  • Put something here
  • Put something here
  • Put something here
  • Script or stylesheet?
  • Put something here
  • Put something here

  • style.css
  • Pad the page
  • Make buttons purple
  • Head out to sea
  • A class style
  • Not gold
  • Put something here
  • Put something here
  • Put something here
  • Increase font by 50%
  • End class style
  • script.js
  • Create magic number
  • Define the method
  • Create a default response
  • Guessed too low
  • Put something here
  • Guessed to high
  • Put something here
  • The porridge is just right
  • Put something here
  • Put something here
  • Put something here
  • Update the HTML
  • End the method

All Answers Answered

Answers Remain

Practice Exam
AWS Practitioner Mock Exam Five

Here are some morepractice exam questions for the AWS Practitioner Cert. Want to get AWS Practitioner certified? Start here..

Practice Exam
AWS TCO and Design Principles Exam

This AWS practice exam will test you on Practitioner Exam objectives 1.2 and 1.3 on Cloud economics, TCO and architecture design patterns.

Practice Exam
AWS Cloud Concepts and Benefits Practice Exam

Here are 10 sample AWS Cloud Practitioner exam questions on objective 1.1, dealing with Cloud Concepts, AWS business value and the benefits of cloud computing.

Practice Exam
AWS Practitioner Mock Exam Two

AWS Practice Exam Two for people who want to pass the Amazon Practitioner Certification on the first try.

Practice Exam
AWS Practitioner Mock Exam Three

Here are some practice, AWS exam questions. Want to get AWS Practitioner certified? Start here.

Practice Exam
AWS Practitioner Mock Exam One

Want a challenge? Try out this mock AWS Exam practice test!

Practice Exam
AWS Practitioner Mock Exam Four

Here are some practice, AWS exam questions. Want to get AWS Practitioner certified? Start here..

Practice Exam
Some Mock AWS Exam Questions

I'm just testing out my ReactJS application. Want to give it a try? Then take this short mock exam.

Flashcards
The AWS Responsibility Model

These AWS practitioner exam flashcards test you on your knowledge of the AWS responsibility model. Whose responsibilty is cloud infrastructure, anyways?

Flashcards
AWS Cloud Responsibility Model Part II

This is the second drag-and-drop exercise that tests you on your understanding of Amazon's responsibility model for cloud computing.

Flashcards
OpEx versus CapEx Explained

A fun way to learn the difference between OpEx and CapEx for the AWS practioner exam.

Flashcards
TCO, Economics & Cloud Design Principles

Learn sections 1.2 & 1.3 of the AWS Practitioner Exam with these AWS Flashcards on cloud economics, AWS design principles.

Flashcards
The Benefits of Cloud Computing

These AWS flashcards test you on section 1.1 of the AWS practitioner exam, namely the AWS Cloud and its value proposition.