Skip to content

Instantly share code, notes, and snippets.

View Jingram17's full-sized avatar

Jesse Ingram Jingram17

View GitHub Profile
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!");