<!
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rock Paper Scissors</title>
<script>
function playGame(playerChoice) {
const choices = ["keo", "bua", "bao"];
const computerChoice = choices[Math.floor(Math.random() *
choices.length)];
let result = "";
if (playerChoice === computerChoice) {
result = "It's a tie!";
} else if (
(playerChoice === "keo" && computerChoice === "bao") ||
(playerChoice === "bua" && computerChoice === "keo") ||
(playerChoice === "bao" && computerChoice === "bua")
) {
result = "You win!";
} else {
result = "You lose!";
}
document.getElementById("result").innerText = `Computer chose: $
{computerChoice}. ${result}`;
}
</script>
</head>
<body>
<h2>Rock Paper Scissors</h2>
<button onclick="playGame('keo')">✂️ Kéo</button>
<button onclick="playGame('bua')">🪨 Búa</button>
<button onclick="playGame('bao')">📄 Bao</button>
<p id="result"></p>
</body>
</html>