peterschussheim
10/14/2016 - 12:50 AM

declareWinner

declareWinner

export const Fighter = function Fighter(name, health, damagePerAttack) {
        this.name = name;
        this.health = health;
        this.damagePerAttack = damagePerAttack;
        this.toString = function() { return this.name; }
};
import {Fighter} from "./fighter.js";

new Fighter("Lew", 10, 2);
new Fighter("Harry", 5, 4);
new Fighter("Jerry", 30, 3);


function declareWinner(fighter1, fighter2, firstAttacker) {
// If fighter1.health <= 0 return fighter2 is winner
// If fighter2.health <= 0 return fighter1 is winner

// while !winner...fighter1 attack fighter2...
  return "Write your code here";
}

declareWinner

This Gist was automatically created by Carbide, a free online programming environment.

You can view a live, interactive version of this Gist here.