Skip to content

Commit

Permalink
Gaming Efficiency Calculator added
Browse files Browse the repository at this point in the history
  • Loading branch information
R2-STAR committed Feb 7, 2025
1 parent 18e5317 commit 809903f
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Calculators/Gaming-Efficiency-Calculator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# <p align="center">Gaming Efficiency Calculator</p>

## Description :-

This calculator will help you calculate your gaming efficiency using kills, deaths, assists, headshots and time played.

## Tech Stacks :-

- HTML
- CSS
- JavaScript


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions Calculators/Gaming-Efficiency-Calculator/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Advanced Gaming Efficiency Calculator</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h2>Advanced Gaming Efficiency Calculator</h2>
<label>Kills:</label>
<input type="number" id="kills" placeholder="Enter kills">
<label>Deaths:</label>
<input type="number" id="deaths" placeholder="Enter deaths">
<label>Assists:</label>
<input type="number" id="assists" placeholder="Enter assists">
<label>Headshots:</label>
<input type="number" id="headshots" placeholder="Enter headshots">
<label>Time Played (minutes):</label>
<input type="number" id="time" placeholder="Enter time in minutes">
<button onclick="calculateEfficiency()">Calculate Efficiency</button>
<p id="result"></p>
</div>
<script src="script.js"></script>
</body>
</html>
17 changes: 17 additions & 0 deletions Calculators/Gaming-Efficiency-Calculator/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function calculateEfficiency() {
let kills = parseFloat(document.getElementById("kills").value);
let deaths = parseFloat(document.getElementById("deaths").value);
let assists = parseFloat(document.getElementById("assists").value);
let headshots = parseFloat(document.getElementById("headshots").value);
let time = parseFloat(document.getElementById("time").value);

if (isNaN(kills) || isNaN(deaths) || isNaN(assists) || isNaN(headshots) || isNaN(time) || time <= 0) {
document.getElementById("result").innerText = "Please enter valid numbers.";
return;
}

let efficiency = ((kills + (assists * 0.5) + (headshots * 0.3)) - deaths) / time;

document.getElementById("result").innerText = `Your advanced gaming efficiency is: ${efficiency.toFixed(2)}`;
}

34 changes: 34 additions & 0 deletions Calculators/Gaming-Efficiency-Calculator/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
background: url('./assets/bg-image.jpg') no-repeat center center fixed;
background-size: cover;
}
.container {
max-width: 400px;
margin: auto;
background: rgba(244, 244, 244, 0.9);
padding: 20px;
border-radius: 10px;
}
input {
width: 100%;
padding: 2px;
margin: 5px 0;
}
button {
padding: 10px;
background: #28a745;
color: white;
border: none;
cursor: pointer;
}
button:hover {
background: #218838;
}
#result {
font-weight: bold;
margin-top: 10px;
}
6 changes: 6 additions & 0 deletions calculators.json
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,12 @@
"link": "./Calculators/Gamified-Calculator/index.html",
"source": "https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Gamified-Calculator"
},
{
"title": "Gaming Efficiency Calculator",
"description": "Calculator that calculates your gaming efficiency using kills, deaths, assists, headshots and time played.",
"link": "./Calculators/Gaming-Efficiency-Calculator/index.html",
"source": "https://github.com/Rakesh9100/CalcDiverse/tree/main/Calculators/Gaming-Efficiency-Calculator"
},
{
"title": "Garden Planning Calculator",
"description": "Calculator that helps you plan your garden.",
Expand Down

0 comments on commit 809903f

Please sign in to comment.