Feed the Fox game :)


#1

Here is my game, based on what we've learned.
Oh, yeah, you can't win the game, but you enjoy feeding the fox :slightly_smiling:
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.");
      
       
        hunger-=chickenPies;
        
        if (hunger<0) {
            console.log("The fox ate " + hunger + " pies too many. You've overfed your fox! It's fat, rolling in the garden.");
         feed=false;  
   
} else { 
    
   foxEats = Math.floor(Math.random()*2);}
   
    }else{
        
        console.log("The fox loved your pies and it could eat another " + hunger);
         confirm ("Feed more?");
          foxEats = Math.floor(Math.random()*2);

}
}

#2

@petrushka how do i play the game ??

:neutral_face:


#3

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


#4

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


#5

@destin5465 It's a lesson in the JavaScript course :slightly_smiling:


#6

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