This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var slaying = true; | |
// A bit of new math magic to calculate the odds | |
// of hitting the dragon. We'll cover this soon! | |
var youHit = Math.floor(Math.random() * 2); | |
var damageThisRound = Math.floor(Math.random() * 5 + 1); | |
var totalDamage = 0; | |
while (slaying) { | |
if (youHit) { | |
console.log("You hit the dragon and did " + damageThisRound + " damage!"); |