8000 GitHub - hjacque/bowling-score-calculator
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

hjacque/bowling-score-calculator

Repository files navigation

🎳 Bowling Score Calculator

A TypeScript Node.js application that accurately calculates the total score of a bowling game from a frame-based input.


📑 Table of Contents


📌 Overview

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.


✨ Features

  • 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.

🛠 Installation

  1. Clone the repository:
    git clone <your-repo-url>
    cd bowling-score-calculator
  2. Install Node.js Ensure you are using the correct Node.js version:
    nvm use
  3. Install dependencies
    npm install
  4. Build the project
    npm run build

Usage

Running the Application

  • Development mode (with hot reload)
npm run dev
  • Production mode
npm start

Running Tests

  • 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

Linting and Formatting

  • 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

Directory Structure

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0