Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Open currency_converter.html",
"file": "/home/odoo/odoo/Javascript-training/Currency Converter/currency_converter.html"
}
]
}
96 changes: 96 additions & 0 deletions Rock Paper & Scissor Game/task1.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
*,
*:Before,
*:After{
Padding: 0;
Margin: 0;
Box-Sizing: Border-Box;
}
Body{
Height: 100vh;
Background: Linear-Gradient(
135deg,
#1bcaff,
#231bff
);
}
.Container{
Width: 45%;
Min-Width: 500px;
Background-Color: #Ffffff;
Padding: 40px 30px;
Position: Absolute;
Transform: Translate(-50%,-50%);
Top: 50%;
Left: 50%;
Border-Radius: 10px;
Box-Shadow: 0 15px 25px Rgba(0,0,0,0.15);
}
.Scores{
Margin-Bottom: 50px;
Text-Align: Right;
}
.Details{
Margin-Top: 30px;
Text-Align: Center;
}
.Scores,.Details{
Font-Family: 'Poppins',Sans-Serif;
Font-Weight: 400;
Font-Size: 15px;
}

#User_choice,
#Computer_choice{
Font-Weight: 400;
Margin-Bottom: 10px;
}
Span{
Font-Weight: 600;
}




.btn {
border: 2px solid black;
background-color: white;
color: black;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
}

.success {
border-color: #04AA6D;
color: green;
}

.success:hover {
background-color: #04AA6D;
color: white;
}
/* Orange */
.warning {
border-color: #ff9800;
color: orange;
}

.warning:hover {
background: #ff9800;
color: white;
}

/* Red */
.danger {
border-color: #f44336;
color: red;
}

.danger:hover {
background: #f44336;
color: white;
}
.center {
text-align: center;
padding: 10px;
}
32 changes: 32 additions & 0 deletions Rock Paper & Scissor Game/task1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<Html Lang="En">
<Head>
<Title>Rock Paper Scissor Game</Title>
<!--Stylesheet-->
<Link Rel="Stylesheet" Href="task1.css">
</Head>
<Body>
<Div Class="Container">
<h1 class="center">Rock Paper & Scissor Game</h1>
<Div Class="Scores">
<P>Computer :
<Span Id="computer_score">0</Span>
</P>
<P>
You :
<span Id="user_scores">0</Span>
</P>
</Div>
<div class="center">
<h2 id="status"></h2>
</div>
<Div Class="center">
<Button Onclick="playgame(0)" class="btn danger" id="Rock">Rock</Button>
<Button Onclick="playgame(0)" class="btn success" id="Paper">Paper</Button>
<Button Onclick="playgame(0)" class="btn warning" id="Scissor">Scissor</Button>
</Div>
</Div>
<!--Script-->
<Script Src="task1.js"></Script>
</Body>
</Html>
24 changes: 24 additions & 0 deletions Rock Paper & Scissor Game/task1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const choices = ['Rock','Paper','Scissor'];
var user_scores = 0,computer_score = 0;
function playgame(a)
{
const choices=['Rock','Paper','Scissor'];
let user_choice=choices[a];
let computer_choice=Math.floor(Math.random() * choices.length);
if(choices[computer_choice]=='Rock' && user_choice=="Rock" || choices[computer_choice]=='Paper' && user_choice=="Paper" || choices[computer_choice]=='Scissor' && user_choice=="Scissor" )
{
document.getElementById("status").textContent="Draw";
}
else if (choices[computer_choice]=='Paper' && user_choice=="Rock" || choices[computer_choice]=='Rock' && user_choice=="Scissor" || choices[computer_choice]=='Scissor' && user_choice=="Paper")
{
document.getElementById('status').textContent="Computer Wins";
computer_score += 1;
document.getElementById('computer_score').textContent=computer_score;
}
else
{
document.getElementById("status").textContent="You Win";
user_scores +=1;
document.getElementById('user_scores').textContent=user_scores;
}
}