Skip to content

Commit

Permalink
An animal game made by ChatGPT as a child helped by Claude
Browse files Browse the repository at this point in the history
  • Loading branch information
ToonTalk committed Apr 23, 2024
1 parent d6a91c9 commit 040f1fd
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions apps/claude helps 10 year old ChatGPT animal game/game.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
let points = 0;
let animalsUnlocked = ["rabbit"];

function playRabbitGame() {
// Code for the rabbit game will go here
// If the player wins, give them points
points += 10;

// Check if they've earned enough points to unlock a new animal
if (points >= 20 && !animalsUnlocked.includes("bird")) {
animalsUnlocked.push("bird");
alert("Congratulations! You've unlocked the bird adventure!");
}
}
function updateAnimalButtons() {
let buttonHTML = "";
for (let animal of animalsUnlocked) {
buttonHTML += `<button onclick="showFact('${animal}')">${animal}</button>`;
}
document.getElementById("animalButtons").innerHTML = buttonHTML;
}
function showFact(animal) {
alert(animalFacts[animal]);
location.href = `${animal}.html`;
}
updateAnimalButtons();

let animalFacts = {
rabbit: "Rabbits are not rodents, they are lagomorphs!",
bird: "Some birds, like parrots, can learn to mimic human speech!",
lion: "Lions are the only cats that live in groups, called prides!"
};
18 changes: 18 additions & 0 deletions apps/claude helps 10 year old ChatGPT animal game/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>Emily's Animal Adventure Game</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Welcome to Animal Adventures!</h1>
<div id="animalButtons">
<!-- Animal buttons will be added here by JavaScript -->
</div>
<img src="rabbit.png" alt="Rabbit">
<img src="bird.png" alt="Bird">
<img src="lion.png" alt="Lion">

<script src="game.js"></script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions apps/claude helps 10 year old ChatGPT animal game/rabbit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html>
<head>
<title>Rabbit - Emily's Animal Adventure Game</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>Rabbit Adventure</h1>
<p>Rabbits are fluffy, jumping creatures that love to eat carrots!</p>
<button onclick="playRabbitGame()">Play Rabbit Game</button>
<div id="game">
<p id="gameText"></p>
<button id="option1"></button>
<button id="option2"></button>
</div>
<script src="rabbit.js"></script>
</body>
</html>
50 changes: 50 additions & 0 deletions apps/claude helps 10 year old ChatGPT animal game/rabbit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
let gameState = 0;

function startGame() {
gameState = 0;
showGameState();
}

function showGameState() {
let text = "";
let option1 = "";
let option2 = "";

if (gameState === 0) {
text = "You are a hungry rabbit. You see two paths ahead. One leads to a garden full of carrots, the other leads to a fox's den. Which path do you choose?";
option1 = "Path to the garden";
option2 = "Path to the fox's den";
} else if (gameState === 1) {
text = "Great choice! You safely reach the garden and feast on delicious carrots. You win!";
option1 = "Play again";
option2 = "Go back to animal selection";
} else if (gameState === 2) {
text = "Oh no! You ran into the fox and had to flee. Better luck next time!";
option1 = "Try again";
option2 = "Go back to animal selection";
}

document.getElementById("gameText").innerHTML = text;
document.getElementById("option1").innerHTML = option1;
document.getElementById("option2").innerHTML = option2;
}

document.getElementById("option1").addEventListener("click", function() {
if (gameState === 0) {
gameState = 1;
} else {
startGame();
}
showGameState();
});

document.getElementById("option2").addEventListener("click", function() {
if (gameState === 0) {
gameState = 2;
} else {
location.href = "index.html";
}
showGameState();
});

startGame();
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions apps/claude helps 10 year old ChatGPT animal game/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #d0f0c0; /* light green background */
}

h1 {
color: #2e8b57;
font-size: 48px;
text-shadow: 2px 2px white;
}

button {
font-size: 24px;
padding: 10px 20px;
margin: 10px;
border: none;
border-radius: 10px;
background-color: #4CAF50;
color: white;
cursor: pointer;
box-shadow: 2px 2px 2px rgba(0,0,0,0.2);
}

button:hover {
background-color: #3e8e41;
}

#game {
background-color: #f0e68c;
padding: 20px;
border-radius: 10px;
}

#gameText {
font-size: 24px;
}

0 comments on commit 040f1fd

Please sign in to comment.