Skip to content

Commit 221546e

Browse files
committed
allow values to be zero
1 parent 64c8e75 commit 221546e

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/modules/gametree.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,18 @@ export function getBoard(tree, id) {
358358
type = 'good'
359359
}
360360

361-
const visits = node.data.VISITS || null
362-
const winrate =
363-
(node.data.WINRATE && (0.5 + sign * (node.data.WINRATE - 0.5)) * 100) ||
364-
null
365-
const scoreLead =
366-
(node.data.SCORELEAD && node.data.SCORELEAD * sign) || null
361+
let visits = null
362+
let winrate = null
363+
let scoreLead = null
364+
if (isFinite(node.data.VISITS)) {
365+
visits = +node.data.VISITS
366+
}
367+
if (isFinite(node.data.WINRATE)) {
368+
winrate = (0.5 + sign * (node.data.WINRATE - 0.5)) * 100
369+
}
370+
if (isFinite(node.data.SCORELEAD)) {
371+
scoreLead = node.data.SCORELEAD * sign
372+
}
367373

368374
list[v] = {sign, type, visits, winrate, scoreLead}
369375
}

0 commit comments

Comments
 (0)