Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <!-- 4 

{"PROBLEM"}

For this project, you will create a game similar to rock, paper, scissors called "glass, pudding, cat"

Write a function called glassPuddingCat that takes two parameters: 

  1. a string representing an input("string") from player1 
  2. an input("string") from player2. 
  *The method for retrieving input from a user will be provided in the JS code

Depending on each player's input, the function should output to the page or console the winner of the first set of inputs, a tie if both players had the same input, 
or invalid input if the string was not recognized.

The rules for the game of Glass, Pudding, Cat is as follows:

 - Each player chooses one of three inputs: "glass", "pudding", or "cat"

    - An input of "glass" wins over an input of "pudding"
    - An input of "pudding" wins over an input of "cat"
    - An input of "cat" wins over an input of "glass"

 - If two players use the same input, the result is a tie
  
 - For example, a call of glassPuddingCat("cat", "glass") would result in console output of "Player 1 wins!". 
  - A call of glassPaperCat("pudding", "glass") would result in console output of "Player 2 wins!". 
  - A call of glassPaperCat("glass", "glass") would result in console output of "TIE!". 
  - If one player gives an input other than "rock", "paper", or "scissors", the console output should be "Invalid input of [player's invalid input]!", where you should replace [player's invalid input] with the exact 
value passed by that player. 
  - If both players pass invalid inputs, the console output should be "Invalid inputs of [player 1's invalid input] and [player 2's invalid input]!".

-->

<!-- To play the game, run the program and enter the first input, then close your eyes and have the second player enter their input.
The program will automatically tell you who won. -->
              
            
!

CSS

              
                
              
            
!

JS

              
                // Main Project: Rock Paper Scissors Replica

// For this project, you will create a game similar to rock, paper, scissors called "glass, pudding, cat"

// To retrieve input from a user, use the prompt method to ask for input, like the following code:
// let player1Input = prompt("Player1 Choose: Glass, Pudding, or Cat"); // the user's input will be saved to the variable player1Input
// console.log(player1Input); //this line prints whatever the user typed into the prompt to the console

// Write a function called glassPuddingCat that takes two parameters: a string representing an input("string") from player1 a input("string") from player2.

// Within the function, use conditional statements to determine the winner of glass, pudding cat.

// Read the game's rules in the HTML division of this pen to know which inputs are greater than others. This will determine your conditional statements.

// Depending on each player's input, the function should print to the page or console the winner of the first set of inputs, a tie if both players had the same input, or invalid input if the string was not recognized.
// Hint: Use document.write('putting text into html'); to print the winner onto the web page

              
            
!
999px

Console