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
| // Use isPathClear to move around the randomly positioned boulders. | |
| // Automatic pathfinding doesn't work in Boulder Woods. | |
| loop { | |
| var angle = Math.PI / 2 - Math.PI / 16; | |
| while (angle >= -Math.PI / 2) { | |
| var targetX = this.pos.x + 5 * Math.cos(angle); | |
| var targetY = this.pos.y + 5 * Math.sin(angle); | |
| // Use isPathClear between your current pos and the target. | |
| targetPos = { x: targetX, y: targetY }; |
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
| // Returns Best Coin to Move Toward | |
| this.bestCoin = function() { | |
| var bestCoin = null; | |
| var coinRank = 0; | |
| var coins = this.findItems(); | |
| for (var i=0; i < coins.length; i++) { | |
| if ( coins[i].value / this.distanceTo(coins[i]) > coinRank ) { | |
| coinRank = coins[i].value / this.distanceTo(coins[i]); | |
| bestCoin = coins[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
| // track positions for safe route back to center | |
| var positionStack = []; | |
| // track last target, to determine changes | |
| var lastTarget = { x: 40, y: 34 }; | |
| loop { | |
| var gem = this.findNearest(this.findItems()); | |
| if (gem) { |
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
| // http://codecombat.com/play/level/binary-search | |
| // Guess the number that the paladin is thinking of each round. | |
| // She will indicate whether the answer is a higher or lower number after each guess. | |
| // She moves to x<39.5 if lower and x>40.5 if higher | |
| // and x==40 if correct. | |
| // The paladin's maxNum property is the upper bound of the number. | |
| var paladin = this.findNearest(this.findFriends()); |
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
| $("table.form-table td:contains('Google Profile Avatars')").hide(); |
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
| // http://codecombat.com/play/level/hunting-party | |
| // Strategy: move all troops continuously to the right, | |
| // making sure to keep the archers behind the frontline | |
| // so that the soldiers take the enemy attacks. Player | |
| // character follows along the front line and heals | |
| // any soldier/archer that is below max health. | |
| var front = [ 30, 30, 30 ]; // Frontline for Groups |
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
| // http://codecombat.com/play/level/the-bane-of-soldiers | |
| // Robobombs explode when they die or touch an enemy. | |
| // Split up your soldiers so that they don't all get exploded together. | |
| while (true) { | |
| var friends = this.findFriends(); | |
| var enemies = this.findEnemies(); | |
| var targets = []; | |
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
| // http://codecombat.com/play/level/ring-bearer | |
| // You must escort a powerful magical ring back to town to be studied. | |
| // The goal is to escape, not fight. More ogres lurk in the surrounding mountains! | |
| // Make a circle of soldiers around the peasant! | |
| // We give you two functions to help with this: | |
| // findSoldierOffset figures out the position a soldier should stand at in relation to the peasant. | |
| // The first argument 'soldiers' should be an array of your soldiers. | |
| // The second argument 'i' is the index of the soldier (in soldiers) you want to find the position for. |
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
Show hidden characters
| // Babel ES6 | |
| // ~/Library/Application Support/Sublime Text 3/Packages/User/JavaScript.sublime-build | |
| { | |
| "cmd": ["/Users/fiore/.nvm/versions/node/v6.2.1/bin/babel-node", "$file"], | |
| "selector": "source.js" | |
| } |
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
| Checking for bad word combinations... | |
| There are 14 words in fruits. | |
| There are 39 words in animals. | |
| There are 19 words in colors. | |
| There are 72 total words in the pool. | |
| There are 5112 unique word combinations. | |
| #### | |
| apple mango: apple mango soda; someone with the initials A.M. with the "soda" added on to camoflauge the true meaning. | |
| variation: hawaiian apple mango. |