Skip to content

Instantly share code, notes, and snippets.

@dlangh
dlangh / jswarrior-5.js
Created March 18, 2014 21:01
JSWarrior Level 5
jsWarrior.turn = function(warrior) {
if (!warrior.previousHealth) { warrior.previousHealth = 20 };
if(warrior.check() == "enemy") {
warrior.attack();
}
else if (warrior.check() == 'diamond') {
warrior.collect();
}
else {