4 <title> Chess Board
</title>
9 <canvas id=
"myCanvas" width=
"560" height=
"560" style=
"border:2px solid #d3d3d3;">
10 Your browser does not support the HTML5 canvas tag.
11 TODO: describe chessboard ?
16 // TODO: draw hexagonal board, allow click and drag pieces
17 // ==
> work with coordinates and current board size as a parameter
19 var c=document.getElementById("myCanvas");
20 var ctx=c.getContext("
2d");
32 for(var a=
0;a
<8;a++) {
33 for(var b=
0; b
<8;b+=
2) {
35 if(a%
2==
0) startX = (b+
1) *
70;
36 ctx.fillRect(startX + left,(a*
70) ,
70,
70);
40 var img = new Image();
41 img.onload = function() {
42 ctx.drawImage(img,
0,
0,
60,
60);
44 img.src =
"public/images/pieces/wb.svg";