How to use @sabaki/go-board - 1 common examples

To help you get started, we’ve selected a few @sabaki/go-board examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SabakiHQ / Sabaki / src / modules / fileformats / gib.js View on Github external
if (match) {
                        let komi = parseFloat(match[1]) / 10
                        draft.updateProperty(rootId, 'KM', [komi.toString()])
                    }
                }
            } else if (line.slice(0, 3) === 'INI') {
                let setup = line.split(' ')
                let handicap = 0

                let p = Math.floor(parseFloat(setup[3]))
                if (!isNaN(p)) handicap = p

                if (handicap >= 2 && handicap <= 9) {
                    draft.updateProperty(rootId, 'HA', [handicap.toString()])

                    let points = Board.fromDimensions(19, 19)
                        .getHandicapPlacement(handicap, {tygem: true})

                    for (let [x, y] of points) {
                        let s = sgf.stringifyVertex([x, y])
                        draft.addToProperty(rootId, 'AB', s)
                    }
                }
            } else if (line.slice(0, 3) === 'STO') {
                let elements = line.split(' ')
                if (elements.length < 6) continue

                let key = elements[3] === '1' ? 'B' : 'W'
                let x = Math.floor(parseFloat(elements[4]))
                let y = Math.floor(parseFloat(elements[5]))
                if (isNaN(x) || isNaN(y)) continue

@sabaki/go-board

A Go board data type

MIT
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis

Popular @sabaki/go-board functions