Backgammon-JS

This JavaScript library makes it easy to draw Backgammon boards.

For example, the diagram below is drawn with just the following code:


  <script src="board.js"></script>
  ...
  <canvas id="diagram1">
    <p>Figure 1</p>
  </canvas>

  <script>
    const diagram = new Diagram(document.querySelector('#diagram1'));
    diagram.draw();
  </script>
  

The sizes and colors are all the default. By default, the checkers are put in their starting positions. However, you can enter a custom XGID to draw a board (checker positions only).

Figure 1