TODO finish RPS
This commit is contained in:
38
24_09_13/kopapirollo.html
Normal file
38
24_09_13/kopapirollo.html
Normal file
@@ -0,0 +1,38 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
<p id="USER"></p>
|
||||
<p id="COMPUTER"></p>
|
||||
<script>
|
||||
let weapon;
|
||||
let weapons = ["kő", "papír", "olló"];
|
||||
let computer_choice = weapons[((Math.random() * 10) % 3).toFixed(0)];
|
||||
do{
|
||||
weapon = prompt("Kő - papír - olló").toLowerCase();
|
||||
}while(!weapons.includes(weapon));
|
||||
|
||||
|
||||
|
||||
|
||||
document.getElementById("USER").innerHTML = weapon;
|
||||
document.getElementById("COMPUTER").innerHTML = computer_choice;
|
||||
|
||||
|
||||
|
||||
switch (weapon) {
|
||||
case value:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user