Bad Girl Spy Interrogation Game
Bad Girl Spy claims she doesn't know where the microfilm is or what the secret password is. However, she's lying and we have 5 different patterns of lies to throw at you.
Bad Girl Spy has 2 random non-repeating numbers between 1 and 5. Your job is to guess which part of her body holds the corresponding number.
<!DOCTYPE html>
<html>
<head>
<title>Bad Girl Spy Interrogation Game</title>
<style>
body {
font-family: sans-serif;
background-color: #f5f5f5;
text-align: center;
}
h1 {
font-size: 3rem;
margin-top: 50px;
}
img {
margin-top: 20px;
margin-bottom: 20px;
}
label {
display: block;
margin: 10px auto;
font-size: 1.5rem;
}
input[type="radio"] {
margin-right: 10px;
}
button {
padding: 10px 20px;
font-size: 1.5rem;
border: none;
border-radius: 5px;
color: white;
background-color: #008CBA;
cursor: pointer;
margin-top: 20px;
}
</style>
</head>
<body>
<h1>Bad Girl Spy Interrogation Game</h1>
<img src="https://www.asciiart.eu/people/female-art" alt="Bad Girl Spy">
<p>Bad Girl Spy claims she doesn't know where the microfilm is or what the secret password is. However, she's lying and we have 5 different patterns of lies to throw at you.</p>
<p>Bad Girl Spy has 2 random non-repeating numbers between 1 and 5. Your job is to guess which part of her body holds the corresponding number.</p>
<form id="game-form">
<label>
<input type="radio" name="guess" value="1">
Head
</label>
<label>
<input type="radio" name="guess" value="2">
Chest
</label>
<label>
<input type="radio" name="guess" value="3">
Right Arm
</label>
<label>
<input type="radio" name="guess" value="4">
Left Arm
</label>
<label>
<input type="radio" name="guess" value="5">
Legs
</label>
<button type="button" onclick="checkGuess()">Make Guess</button>
</form>
<script>
let badGirlSpy = {
lies: [
"She swears she's never even heard of the microfilm or any secret password!",
"She's telling us that the microfilm is in the middle of the ocean and the password is a string of binary code! Ha!",
"She insists the microfilm is hidden in a doghouse and the password is the sound a cat makes when it's scared!",
"She claims the microfilm is now in North Korea and the password is the name of a spice!",
"Bad Girl Spy is refusing to cooperate and says we can never make her talk!"
],
place1: Math.floor(Math.random() * 5) + 1, //generating random numbers
place2: Math.floor(Math.random() * 5) + 1 //between 1 and 5
};
function checkGuess() {
let guess = document.querySelector('input[name="guess"]:checked');
if(guess) {
if (guess.value == badGirlSpy.place1 || guess.value == badGirlSpy.place2) {
alert("Bad Girl Spy screams in defeat, \"You found it!\" Her secret numbers were in her " + (guess.value == badGirlSpy.place1 ? "head" : "chest") + ". You get 1 point!");
//increment the score of the player by 1
let playerScore = parseInt(localStorage.getItem("playerScore"));
if (isNaN(playerScore)) {
playerScore = 1;
} else {
playerScore++;
}
localStorage.setItem("playerScore", playerScore);
if (playerScore >= 3) {
//if the player has reached 3 points, show game over message
alert("You won! Bad Girl Spy accepts her defeat and spills all the secrets. She's still fuming though. You got some nerve, huh?");
//reset the score and reload the page
localStorage.setItem("playerScore", 0);
showToast("再読み込みしてください");
} else {
//if the player score is less than 3, show next round
alert("Bad Girl Spy has finally given up for this round. Let's bring out another one!");
//reset the guess form
document.getElementById("game-form").reset();
//generate new random numbers and lies for the new spy
badGirlSpy.place1 = Math.floor(Math.random() * 5) + 1;
do {
badGirlSpy.place2 = Math.floor(Math.random() * 5) + 1;
} while (badGirlSpy.place2 == badGirlSpy.place1);
if (badGirlSpy.lies.length == 0) {
alert("Wow, you've gone through all the lies we have! Bad Girl Spy must be impressed. Care to play again?");
localStorage.setItem("playerScore", 0);
showToast("再読み込みしてください");
} else {
alert("New bad girl spy is here! " + badGirlSpy.lies.pop());
}
}
} else {
//if the guess is incorrect, show the taunt message and ask if the player wants to continue playing
let continuePlaying = confirm("Oops, your guess was incorrect! Bad Girl Spy snickers, \"Too bad, honey!\" Do you want to continue playing?");
if (!continuePlaying) {
alert("Bad Girl Spy cackles in victory, \"Haha, looks like I won!\" Game over!");
localStorage.setItem("playerScore", 0);
showToast("再読み込みしてください");
}
}
} else {
//if the player has not selected any guess and clicked on the submit button, show the error message
alert("Please select one of the options to make a guess!");
}
}
window.onload = function() {
//when the page loads, generate the first bad girl spy lies and display it on screen
alert("We have brought in Bad Girl Spy for interrogation! " + badGirlSpy.lies.pop());
if (!localStorage.getItem("playerScore")) {
localStorage.setItem("playerScore", 0);
}
}
</script>
</body>
</html>