blob: 8af22e7270f59d91ba1bb55b18b40dc465d118b1 (
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
28
29
30
31
32
33
34
|
import { board, prepareBoard } from "./board.js"
import { Vector2 } from "./engine/visual.js"
import { Stone } from "./stones.js"
let turn = ""
function start() {
prepareBoard()
nextTurn()
}
function nextTurn() {
placeLinks()
}
function placeLinks() {
turn = turn != "black" ? turn = "black" : turn = "white"
for (let row = 0; row < board.size; row++) {
for (let col = 0; col < board.size; col++) {
tryLink(new Vector2(row, col))
}
}
}
function tryLink(position) {
console.log("link to", position.x, position.y)
new Stone({
position: position,
team: (position.x + position.y) % 2 ? "white" : "black"
})
}
start()
|