blob: 82b6b283d8ed78fb4eeac7f7023c4881f6dbcf8f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
export let board = {
element: document.getElementById("board"),
size: 9,
stones: {},
links: {},
}
export function prepareBoard() {
board.stones = [...Array(board.size)].map(_ => Array(board.size))
createBoard(board.size)
}
// ########### board engine #############
function createBoard(size) {
let table = document.createElement("table")
for (let r = 1; r < size; r++) {
let tr = document.createElement("tr")
for (let c = 1; c < size; c++) {
let td = document.createElement("td")
tr.appendChild(td)
}
table.appendChild(tr)
}
board.element.appendChild(table)
}
|