A TypeScript Node.js application that accurately calculates the total score of a bowling game from a frame-based input.
The Bowling Score Calculator parses and evaluates a ten-frame bowling game, correctly scoring strikes, spares, and open frames, including special rules for the 10th frame. It supports a test suite for reliable development and maintains clean code with linting and formatting tools.
- Converts symbolic bowling input (
X
,/
,-
, etc.) to numerical scores. - Correctly identifies and scores strikes, spares, regular, and gutter frames.
- Handles bonus throws in the 10th frame.
- Modular design with a clear separation of logic.
- Includes unit tests for all key scoring logic.
- ESLint and Prettier for code quality and consistency.
- Clone the repository:
git clone <your-repo-url> cd bowling-score-calculator
- Install Node.js
Ensure you are using the correct Node.js version:
nvm use
- Install dependencies
npm install
- Build the project
npm run build
- Development mode (with hot reload)
npm run dev
- Production mode
npm start
- Run all tests
npm run test
- Watch tests for changes
npm run test:watch
- Generate coverage report
npm run test:cover
- Run only unit tests
npm run test:unit
- Lint the codebase
npm run lint
- Fix lint issues automatically
npm run lint:fix
- Check formatting
npm run format
- Format files
npm run format:fix
src
├── index.ts # Main application logic
└── test
└── unit # Unit tests
├── framesMapper.test.ts
├── getFrameType.test.ts
├── scoreBowlingGame.test.ts
├── scoreRegular.test.ts
├── scoreSpare.test.ts
└── scoreStrike.test.ts