Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

javascript go board

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 doc
Octocat-spinner-32 src
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 example.html
Octocat-spinner-32 goboard.js
Octocat-spinner-32 project.clj
Octocat-spinner-32 screenshot.png
README.md

goboard.js

A ClojureScript project which should generate a Go board in JavaScript using HTML canvas.

Usage

To try, just download the goboard.js file and include it in a script tag on your webpage. You can then call the goboard.draw function.

goboard.draw(element_id, stones, playing, last_x, last_y) attributes explained:

  • element_id - DOM element ID of the canvas element where the Go board will be drawn

  • stones - a javascript one-dimensional Array object of 19*19 integers indicating the stones on the board. Each of them can be: 0 - no stone, 1 - black stone, 2 - white stone.

  • playing (optional) - should be an integer: 1 - black, 2 - white which indicates the current player's color and that it is her turn to move.

  • make-move (optional) - a javascript function of two arguments X and Y which are the coordinates of an empty space on the board that the user just clicked on.

  • last_move_x (optional) - indicates the board X coordinate of the last move, must be an integer between 0 and 18 (left to right)

  • last_move_y (optional) - indicates the board Y coordinate of the last move, must be an integer between 0 and 18 (top to bottom)

You can also try downloading the example.html file which will show the example screenshot below.

Screenshot

License

Copyright © 2013 Ionuț Arțăriși

Distributed under the Eclipse Public License, the same as Clojure.

Something went wrong with that request. Please try again.