Skip to content

Commit 970c493

Browse files
committed
ref: inline
1 parent 38827e6 commit 970c493

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

webzebra/src/game.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,3 @@ export type Circle = {
55
color: string
66
}
77

8-
export const scoreFromCircles = (circles: Circle[]) => {
9-
return {
10-
// todo this is slow, use something better when we use some more efficient board representation
11-
white: circles.reduce((count: number, circle: Circle) => circle.color === 'white' ? count + 1 : count, 0),
12-
black: circles.reduce((count: number, circle: Circle) => circle.color === 'black' ? count + 1 : count, 0)
13-
}
14-
}

webzebra/src/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './index.css'
22
import {EvaluatedMove, Message, MessageType, SkillSetting} from "./message";
33
import {createStopToken, stop} from "./stopToken";
4-
import {Circle, scoreFromCircles} from "./game";
4+
import {Circle} from "./game";
55

66
interface ZWorker extends Worker {
77
postMessage(message: Message): void
@@ -191,7 +191,11 @@ function render() {
191191
}
192192

193193
const circles = arr
194-
const score = scoreFromCircles(circles)
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+
}
195199

196200
const circlesHtml = circles.map(circle => {
197201
return `<circle r="${circle.r}" cx="${circle.cx}" cy="${circle.cy}" style="fill: ${circle.color}"></circle>`

0 commit comments

Comments
 (0)