var EHDI = EHDI || Object.create(null); EHDI.GAME = EHDI.GAME || Object.create(null); EHDI.GAME.Tree = function(move) { var node = new EHDI.GAME.Node(move); this.root = node; } EHDI.GAME.Node = function(move, score) { this.move = move; this.parent = null; this.children = []; this.score = score || 0; } EHDI.GAME.Node.prototype.addChild = function(child) { this.children.push(child); child.parent = this; }