// Dog Running in the Garden with Toys
// Initialize the dog's position in the garden
let dogPositionX = 0;
let dogPositionY = 0;
// Simulate the dog running
function runInGarden() {
// Move the dog randomly within the garden boundaries
dogPositionX = Math.random() * 100; // assuming the garden width is 100 units
dogPositionY = Math.random() * 100; // assuming the garden height is 100 units
// Display the dog's new position
console.log("Dog's current position: (" + dogPositionX + ", " + dogPositionY + ")");
}
// Simulate the dog playing with toys
function playWithToys() {
// Select a random toy for the dog to play with
let toys = ["ball", "frisbee", "rope"];
let randomToy = toys[Math.floor(Math.random() * toys.length)];
// Display the dog's selected toy
console.log("Dog is playing with a " + randomToy);
}
// Run the simulation
runInGarden();
playWithToys();
Comments
Post a Comment