mirror of
https://github.com/tiennm99/ai-coding-workflow-labs.git
synced 2026-09-17 02:20:46 +00:00
Convert all 41 TypeScript source/config files in cc4e-course/quiz-project (Next.js), gstack (Astro), and superpowers (Vite/React/Phaser) to plain JavaScript with JSDoc type annotations, replacing tsconfig.json with jsconfig.json (strict + checkJs) in each subproject. No behavior changes: lint, typecheck, test, and build gates match their TypeScript baselines exactly in all three subprojects. Update stack references in the affected READMEs accordingly.
17 lines
489 B
JavaScript
17 lines
489 B
JavaScript
import { BASE_MATCH_SCORE, SPEED_BONUS_MAX, SPEED_BONUS_WINDOW_MS } from "./constants";
|
|
|
|
/**
|
|
* @param {number} msSinceLastMatch
|
|
* @param {number} combo
|
|
* @returns {number}
|
|
*/
|
|
export function calculateMatchScore(msSinceLastMatch, combo) {
|
|
let speedBonus = 0;
|
|
if (msSinceLastMatch < SPEED_BONUS_WINDOW_MS) {
|
|
const ratio = 1 - msSinceLastMatch / SPEED_BONUS_WINDOW_MS;
|
|
speedBonus = Math.round(SPEED_BONUS_MAX * ratio);
|
|
}
|
|
|
|
return (BASE_MATCH_SCORE + speedBonus) * combo;
|
|
}
|