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
export default class Enum{ | |
constructor(){ | |
let args = Array.prototype.slice.call(arguments); | |
let i = 0; | |
args.forEach((val)=>{ | |
this[val] = i++; | |
}); | |
Object.freeze(this); | |
} | |
} |
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
/* | |
A Javascript port of the RDBMS-inspired Entity Component System found here: | |
https://github.com/adamgit/Entity-System-RDBMS-Inspired-Java/blob/master/EntitySystemJava/ | |
src/com/wikidot/entitysystems/rdbmswithcodeinsystems/EntityManager.java | |
*/ | |
export default class EntityManager { | |
constructor(){ | |
this.lowestUnassignedID = 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
-- Uses adjacency list | |
local Graph = {} | |
Graph.__index = Graph | |
function Graph:new () return setmetatable({edges={}}, self) end | |
function Graph:addvertex (v) | |
if not self.edges[v] then | |
self.edges[v] = {} |