Skip to content
{{ message }}

Instantly share code, notes, and snippets.

# James Wilson JamWils

Last active Aug 29, 2015
reddit base
View _.md
Created Feb 6, 2015
reddit base
View _.md
Last active Aug 29, 2015
reddit base
View _.md
Created Feb 8, 2015
reddit base
View _.md
Last active Aug 29, 2015
reddit table
View _.md
Created Apr 23, 2017
Level Sum Heuristic
View gist:3d88d82ad66371139c9765f24200f5e0
This file contains 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
 def h_levelsum(self) -> int: '''The sum of the level costs of the individual goals (admissible if goals independent) :return: int ''' level_sum = 0 # TODO implement # for each goal in the problem, determine the level cost, then add them together for goal in self.problem.goal: levels = [level for level in range(len(self.s_levels)) for state in self.s_levels[level] if goal == state.literal]
Last active Jun 8, 2017
Small Chance Sample
View chanceSample.js
This file contains 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
 const item = {} item.uid = chance.guid(); item.email = chance.email(); item.profileImageUrl = chance.avatar(); item.username = chance.name();
Created Jun 8, 2017
View randomChance.js
This file contains 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 randomIntInc(low, high) { return Math.floor(Math.random() * (high - low + 1) + low); } function createUsers(low, high) { let items = {}; const generatedItems = randomIntInc(low, high); for (let i = 0; i < generatedItems; i++) { const item = {}
Created Jun 8, 2017
View exportChance.js
This file contains 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
 exports.schema = function () { let parent = {} parent.users = createUsers(3, 7); return parent; }
Created Jun 8, 2017
View generatingJSON.js
This file contains 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
 const json = mockDataSchema.schema(); const jsonFormatted = JSON.stringify(json); fs.writeFile("./mockData/db.json", jsonFormatted, (err) => { if (err) { return console.log(chalk.red(err)); } else { console.log(chalk.green("Mock data generated.")); } });