function Game(whitePlayer, blackPlayer, options) { EventEmitter.call(this); options = options || {}; options.handicap = options.handicap || 0; this.options = options; this.whitePlayer = whitePlayer; this.blackPlayer = blackPlayer; whitePlayer.other = blackPlayer; blackPlayer.other = whitePlayer; }
/** * Go board class which has several helper methods to deal with common tasks such * as adjacent stones/liberties to a coordinate, or searching connected stones. * All changes to board contents need to go through the set(c,s) method! * * @param {int} width The width of the board * @param {int} height The height of the board - if not set, a square board is created */ function JGOBoard(width, height) { EventEmitter.call(this); this.markers = {}; // lookup table for markers with SGF coordinate as the key this.width = width; if (height !== undefined) this.height = height; else this.height = this.width; this.board = []; for (var i = 0; i < width; ++i) { var column = []; for (var j = 0; j < height; ++j) column.push(stones.CLEAR.valueOf()); this.board.push(column); } }