Part 1: Setting up the Layout
Game Flowโ
The game flow should be:
- Web page loads with a form for the user to enter their name.
- input is required, users cannot proceed without providing their name.
- After the user submits their name, a new form appears with an input for Rock, Paper, or Scissors.
- You can use:
- select/dropdown
- OR buttons
- clickable text (but why would you do that!)
- You can use:
- User submits the form with their selection (
- input is required, they cannot submit it without a selection
- CPU Player (Behind the scenes), would:
- generate a (random) response to play against the user.
- Compare the selections to determine the winner.
- Keep a log of selections and winners for each round.
- Web page would display the winner.
- Show the game log
- Reset the form after each round
- User should be able to start a new game.
Layout Setupโ
Structure summaryโ
This tree diagram summarizes the body
part of the HTML page structure and nesting. Below it, you'll find more details about the different elements.
body
โโโ div .container
โโโ h1
โโโ div #welcome-screen
โ โโโ form #name-form
โ โ โโโ div
โ โ โ โโโ label [for="username"]
โ โ โ โโโ input #username [name="username"]
โ โ โโโ button #start-game-button
โโโ div #game-screen
โโโ div #score-tally
โ โโโ p #score
โโโ form #game-form
โโโ div
โ โโโ label [for="user-selection"]
โ โโโ select #user-selection [name="user-selection"]
โ โ โโโ option "Rock"
โ โ โโโ option "Paper"
โ โ โโโ option "Scissors"
โโโ button #go-button
โโโ p #game-history
Change the web page HTML title to Rock Paper Scissors
Inside the
<div class="container">
, create the following elements nested as follows:<h1>
- with a title of Rock Paper Scissors.2
<div>
s with IDs ofwelcome-screen
&game-screen
.- Tip: try typing the emmet abbreviation/shorthand
#welcome-screen+#game-screen
and hit enter. ๐
- Tip: try typing the emmet abbreviation/shorthand
Inside
<div id="welcome-screen">
, create the following elements nested as follows:<form>
- with an id ofname-form
<div>
<label>
- with:- text of Your Name.
- for attribute of
username
<input>
- with:- placeholder text of Enter Name Here....
- id of
username
- name property of
username
<button>
- with:- the text of Start Game!.
- id of
start-game-button
Inside
<div id="game-screen">
, create the following elements nested as follows:<div>
- with an id ofscore-tally
.<p>
- with id ofscore
and text ofUser: 0 v CPU: 0
- Tip: Emmet abbreviation for a div with an id of
score-tally
and a paragraph with id ofscore
is#score-tally>p#score
.
- Tip: Emmet abbreviation for a div with an id of
<form>
- with an id ofgame-form
<div>
<label>
- with:- a text of Select your choice
- for attribute of
user-selection
<select>
- with:- id of
user-selection
- name of
user-selection
- 3
<option>
s for Rock, Paper, & Scissors - Tip: use the Emmet abbreviation:
select#user-selection>option*3
- id of
<button>
- with:- the text of
Go!
. - id of
go-button
- the text of
<p>
- with an id ofgame-history
Checkpointโ
It should now look like this.
I think We can do a little better.