File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -191,19 +191,18 @@ function render() {
191191 }
192192
193193 const circles = arr
194- const score = {
195- // todo this is slow, use something better when we use some more efficient board representation
196- white : circles . reduce ( ( count : number , circle : Circle ) => circle . color === 'white' ? count + 1 : count , 0 ) ,
197- black : circles . reduce ( ( count : number , circle : Circle ) => circle . color === 'black' ? count + 1 : count , 0 )
198- }
194+
195+ // todo this is slow, use something better when we use some more efficient board representation
196+ const score_white = circles . reduce ( ( count : number , circle : Circle ) => circle . color === 'white' ? count + 1 : count , 0 )
197+ const score_black = circles . reduce ( ( count : number , circle : Circle ) => circle . color === 'black' ? count + 1 : count , 0 )
199198
200199 const circlesHtml = circles . map ( circle => {
201200 return `<circle r="${ circle . r } " cx="${ circle . cx } " cy="${ circle . cy } " style="fill: ${ circle . color } "></circle>`
202201 } ) . join ( '' )
203202
204203 document . getElementById ( 'circles' ) ! . innerHTML = circlesHtml
205- document . getElementById ( 'score-black' ) ! . innerText = '' + score . black
206- document . getElementById ( 'score-white' ) ! . innerText = '' + score . white
204+ document . getElementById ( 'score-black' ) ! . innerText = '' + score_black
205+ document . getElementById ( 'score-white' ) ! . innerText = '' + score_white
207206
208207 const evalsHtml = evals_ . map ( eval_ => {
209208 return `<text x="${ eval_ . x } " y="${ eval_ . y } " style="fill: ${ eval_ . color } ; font-size: 50px">${ eval_ . text } </text>`
You can’t perform that action at this time.
0 commit comments