This file contains hidden or 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
/*----------------------------------------------------------------------------- | |
REQUIRE | |
-----------------------------------------------------------------------------*/ | |
var yo = require('yo-yo') | |
var minixhr = require('minixhr') | |
var csjs = require('csjs-inject') | |
/*----------------------------------------------------------------------------- | |
THEME | |
-----------------------------------------------------------------------------*/ | |
// coolors.co |
This file contains hidden or 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 yo = require('yo-yo') | |
var csjc = require('csjs-inject') | |
//var domElement = yo <html string> | |
var css= csjc` | |
body{ | |
background-color:hsla(164,95%,43%,1); | |
} | |
h1{ | |
color:hsla(30,100%,99%,1); |
This file contains hidden or 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
function summonHero (name, position) { | |
return { | |
say: function (sentence) { | |
alert(sentence); | |
}, | |
move: function (position) { | |
console.log('Moving to x=' + position.x + ' and y=' +position.y); | |
this.pos = position; | |
}, | |
name: name, |
This file contains hidden or 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
while (this.gold < 81) { | |
var coin = this.findNearest(this.findItems()); | |
this.move(coin.pos); | |
} | |
if (this.gold > this.costOf("soldier")) { | |
this.summon("soldier"); | |
} | |
for (var i=0; i < 4; i++) { |
This file contains hidden or 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
//FIND FARTHEST | |
var enemy; | |
loop { | |
var farthest = null; | |
var maxDistance = 0; | |
var enemyIndex = 0; | |
var enemies = this.findEnemies(); | |
while (enemyIndex < enemies.length) { | |
var target = enemies[enemyIndex]; |