Feed the Fox game :)

Here is my game, based on what we’ve learned.
Oh, yeah, you can’t win the game, but you enjoy feeding the fox :slight_smile:
Anyways, please give it a go. Any thoughts are welcome!

var feed = true;
var foxEats = Math.floor(Math.random()*2);
var chickenPies = Math.floor(Math.random()*5+1);
var hunger = 7;

while (feed) {
    if (foxEats) {
        console.log("You fed the fox " + chickenPies + " chicken pies.");
        if (hunger<0) {
            console.log("The fox ate " + hunger + " pies too many. You've overfed your fox! It's fat, rolling in the garden.");
} else { 
   foxEats = Math.floor(Math.random()*2);}
        console.log("The fox loved your pies and it could eat another " + hunger);
         confirm ("Feed more?");
          foxEats = Math.floor(Math.random()*2);

1 Like

@petrushka how do i play the game ??


you could copy the code into dragon slayer and run it from there

ok this is going to sound stupid but, what is dragon slayer?

@destin5465 It’s a lesson in the JavaScript course :slight_smile:

@zystvan oooooooooooooohhhh havent got that far yet, only started and ya. lolz :sob::disappointed_relieved:

1 Like