Skip to content

Commit f2b5017

Browse files
committed
Refactor core calculation.
1 parent 453cd96 commit f2b5017

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/nodes/Board.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,9 @@ export default class Board extends GameNode {
212212
this.drawLine(point, nbr, current.base);
213213
qubit.bounce();
214214
measuredQubits.push(nbr);
215-
this.pingScore(nbr, measuredQubits.length);
216-
scoreToAdd += measuredQubits.length;
215+
const score = measuredQubits.length * 100;
216+
this.pingScore(nbr, score);
217+
scoreToAdd += score;
217218
newQueue.push(nbr);
218219
} else {
219220
this.drawLine(point, nbr, current.ortho);
@@ -314,9 +315,9 @@ export default class Board extends GameNode {
314315
}
315316
const coords = getBlochCoords(this.current.base);
316317
const text = new HTMLText({
317-
text: `${score * 100}`,
318+
text: score,
318319
style: new TextStyle({
319-
fontSize: 24 + 2 * score,
320+
fontSize: 24 + (2 * score) / 100,
320321
fontFamily: TEXT_FONT,
321322
fontWeight: "bold",
322323
fill: getColor(coords),

src/nodes/Multiplayer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export default class Multiplayer extends GameNode {
5353
this.view.removeChild(player.view);
5454
player.destroy();
5555
const scores = new ScoreScreen(
56-
score * 100,
56+
score,
5757
inputs[index === 0 ? "player1" : "player2"]
5858
);
5959
this.scores.push(scores);

src/nodes/Player.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export default class Player extends GameNode {
146146

147147
set score(value: number) {
148148
this.#score = value;
149-
this.scoreboard.text = `${this.#score * 100}`;
149+
this.scoreboard.text = this.#score;
150150
pulse(this.scoreboard);
151151
}
152152

0 commit comments

Comments
 (0)