Go board game in Javascript
Under going a rewriteGo board game in Javascript.
var some_var = GoBoard(container_id, length, board_size);
container_id
: an element container with with a unique id
attribute
length
: render the element container into a square of length length
board_size
: render the go board of grid board_size
x board_size
. Must be an integer between 2
and 19
.
Place <script src="path/to/gojs.js"></script>
in the head
element, or right before the body
tag.
Place an empty div
container with a unique id
attribute. A div
element is preferred, but other elements such as p
may be used.
Example: <div id="go_board"></div>
Note: If the container is not empty, gojs will empty it!
Render the go board via
var go_board = GoBoard("go_board", 500, 19)
var goboard = GoBoard("canvas", 500, 19);
var goboard2 = GoBoard("canvas2", 200, 9);
var goboard3 = GoBoard("canvas3", 300, 13);
var goboard4 = GoBoard("canvas4", 400, 16);
All code excluding libraries are written in coffeescript which compiles into JavaScript.
Raphael JS is primarily used to render the Go board.
Utility libraries:
All JavaScript files are packaged together with RequireJS and its optimizer, and minified through UglifyJS2.