Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
rockpapesissor
<title>Rock Paper Scissors</title> <script src="rps.js"></script>welcome
Rock Paper Scissor
========================================================
css:
body {
min-height: 220vh;
display: grid;
place-items: center;
padding: 0;
margin: 0;
font-family: "Open Sans", sans-serif;
background-image: url(tall-trees-forest-mountains-covered-with-fog.jpg);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
.container {
border: 2px solid black;
padding: 20px;
padding-left: 70px;
padding-right: 70px;
background-color: rgba(43, 146, 155, 0.3);
}
h1,
h2 {
font-size: 45px;
text-align: center;
text-decoration: none;
}
.heading {
color: black;
text-shadow: 2px 2px 5px rgb(30, 34, 37);
}
h2 {
color: #171b2e;
font-size: 25px;
}
#rps-div {
display: flex;
flex-direction: row;
flex-wrap: wrap;
}
img {
height: 150px;
width: auto;
border: none;
margin: 20px;
margin-top: 30px;
}
img:hover{
box-shadow: 3px 3px 10px 10px rgb(84, 97, 108) ;
}
#arrow{
position: relative;
left: 100px;
}
js file:===================================================
function game(yourChoice) {
var player, computer;
}
function generateRandomNumber() {
return Math.floor(Math.random() * 3);
}
function computerChoice(number) {
return ['rock', 'paper', 'scissor'][number];
}
//cases for winning game
function decideWinner(yourChoice, computerChoice) {
var rpsDatabase = {
'rock': { 'rock': 0.5, 'paper': 0, 'scissor': 1 },
'paper': { 'rock': 1, 'paper': 0.5, 'scissor': 0 },
'scissor': { 'rock': 0, 'paper': 1, 'scissor': 0.5 }
}
//outpus is in format [0,1]
var yourScore = rpsDatabase[yourChoice][computerChoice];
var computerScore = rpsDatabase[computerChoice][yourChoice];
}
function findMessage([yourScore, computerScore]) {
if (yourScore === 1) {
return { 'text': 'You Win', 'color': '#40C4FF' };
}
else if (yourScore === 0) {
return { 'text': 'You Lose', 'color': '#FF5252' };
}
else {
return { 'text': 'Draw', 'color': 'white' };
}
}
function frontEnd(player, computer, message) {
var imageDatabase = {
'rock': document.getElementById('rock').src,
'paper': document.getElementById('paper').src,
'scissor': document.getElementById('scissor').src
};
}