Git Product home page Git Product logo

bgboard's Introduction

bgboard

Javascript Backgammon Board

Inserts a simple and clear backgammon board using plain Javascript (no dependencies).

bgboard - example checker play position


Features

  • Multiple boards per web page are possible.
  • All types of decisions are supported:
    • Checker move
    • Roll or double
    • Take or drop
  • Match information can also be drawn (match length, match score, crawford game or not).
  • Easy board scaling via a single scale parameter.
  • Position description is expected in the standard GNU Backgammon format (example: AMAAmLkFSEgBAA:UQmyAAAAAAAE).

Please note that bgboard does not support playing backgammon. Its purpose is simply to display positions for discussion and demonstration. The position description is expected in GNU Backgammon format.

Here is a minimal example:

<!doctype html>
<html>
	<head>
		<link rel=stylesheet href=/css/bgboard.css>
		<script src=/js/bgboard.js></script>
		<meta charset=utf-8></meta>
	</head>
	<body>
		Here is the board:
		<div id=board1></div>
	</body>
	<script>
		var bgBoard1 = new BgBoard({
			/* Base URL of the bgboard installation. */
			filesRoot : '/',
			/* CSS selector for the containing div element. */
			containerSelector : '#board1',
			/* Scale the board size, for example 0.5 is half size. */
			scale : 0.8,
			/* Position to draw, format is p:m,
			 * where p is the GNU Backgammon Position ID
			 * and m is the GNU Backgammon Match ID.
			*/
			gnuid :	'AMAAmLkFSEgBAA:UQmyAAAAAAAE'
		});
	</script>
</html>

Installation

Make the directories img, js and css accessible on your website. For example http://www.example.com/static/bgboard/img. That's it! Now you can use http://www.example.com/static/bgboard in the filesRoot option to the BgBoard constructor.

Tests

There are tests that cover over 90% of the bgboard code. To run them open the file /tests/test.html in the desired browser. You can also run run_server.sh which launches a simple single-threaded web server on http://localhost:8000.

bgboard's People

Contributors

gtzampanakis avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

bgboard's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.