<!DOCTYPE html>
<html>
<head>
<title>悪い女スパイの尋問ゲーム</title>
</head>
<body>
<script>
// アスキーアートを作成
let asciiArt = " .|.' '.|.\n ||| ||| \n <|> ||| ||| <|> \n \\./ .|\'. .|.'. \\.// \n ||| ||| \n \\ '|'. .'| ' / \n \\ '-'-' / \n \\._|||_. / \n \\\`-'\`/ \n \`~~~\`";
// ランダムな数字を生成
function generateRandomNumber() {
return Math.floor(Math.random() * 5) + 1;
}
// ゲーム開始時に女の子の数字を生成
let girlNumber1 = generateRandomNumber();
let girlNumber2 = generateRandomNumber();
while (girlNumber2 === girlNumber1) {
girlNumber2 = generateRandomNumber();
}
// ゲームの進行に必要な変数を初期化
let playerScore = 0;
let questioningDone = false;
// ラジオボタンの選択肢を生成
let radioButtons = "";
for (let i = 1; i <= 5; i++) {
radioButtons += `<label><input type="radio" name="location" value="${i}">Body Location ${i}</label><br>`;
}
// ゲームのメッセージを表示
document.write("<pre>" + asciiArt + "</pre>");
document.write("<p>The spy girl is denying that she knows the whereabouts of the microfilm or the secret password. She is lying!</p>");
document.write("<p>The girl has two random non-repeating numbers between 1 and 5. But she will not tell you where she is hiding them!</p>");
// プレイヤーの入力に応じてゲームの進行を決定
while (!questioningDone && playerScore < 3) {
let playerChoice = prompt(`Where do you want to search? Choose a number between 1 and 5\n\n${radioButtons}`);
if (playerChoice && (playerChoice === girlNumber1 || playerChoice === girlNumber2)) {
document.write("<pre>" + " ,#####,\n #_ _#\n |a` `a|\n | u |\n \\ = /\n |\___/|\n ___`\\7/`___\n /` \\/^\\/ `\\\n / , |--| \\\ \n /_/\\_._|__|_._/\\_\\\n `\"\"\"\"\"\"\"\"\"\"\"`" + "</pre>");
document.write("<p>You found a number with the girl's body language. She is giving up!</p>");
girlNumber1 = 0;
girlNumber2 = 0;
playerScore++;
if (playerScore < 3) {
document.write("<p>Let's call the next spy girl for questioning.</p>");
setTimeout(function(){showToast("再読み込みしてください");}, 4000);
} else {
document.write("<p>Congratulations! You won! The spy girl surrenders.</p>");
document.write("<pre>" + " _.-^^---....,,-- \n _-- --_ \n < >)\n \\._ _./ \n ```--. . , ; .--''' \n | | | \n .-=|| | |=-. \n `-=#$%&%$#=-' \n | ; :| \n .-'~~\"~\"~~\"~-.`\\ \n /` `\\." + "</pre>");
}
questioningDone = true;
} else if (playerChoice) {
document.write("<pre>" + " ,#####,\n #_ _#\n |a` `a|\n | u |\n \\ = /\n |\___/|\n ___`\\7/`___\n /` \\/^\\/ `\\\n / , |--| \\\ \n /_/\\_._|__|_._/\\_\\\n `\"\"\"\"\"\"\"\"\"\"\"`" + "</pre>");
document.write("<p>The spy girl is enjoying your failure. You got the wrong number!</p>");
let retry = confirm("Do you want to try again?");
if (!retry) {
document.write("<p>Sorry, you lose! The spy girl wins.</p>");
questioningDone = true;
}
}
}
</script>
</body>
</html>