Skip to content

VikramMenon09/BoxScore-APCSP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

Box Score Keeper (Simple Web App)

A lightweight, browser-based box score tracker for a basketball game.
Track points and fouls for players on Home and Away teams using quick buttons.
When you’re done, click Print Box Score to display stats on the page.


Features

  • Track Home and Away team stats separately
  • Add +1 / +2 / +3 points to a player (prompts for player number)
  • Add Foul to a player (prompts for player number)
  • Automatically creates a player the first time you enter their number
  • Prints a simple box score to the webpage

How It Works (High-Level)

  • Player stats are stored in two JavaScript objects:
    • playerStatsHome
    • playerStatsAway
  • Each player is stored by their player number as the key:
    • Example: playerStatsHome["12"] = { points: 8, fouls: 2 }
  • When you click a scoring/foul button:
    1. A prompt asks for the player number
    2. If the player already exists, it updates their points/fouls
    3. If not, it creates them with setupPlayerHome() or setupPlayerAway()

Getting Started

Option 1: Run Locally (Recommended)

  1. Copy the code into a file named something like:
    • index.html
  2. Open the file in your browser:
    • Double click it, or
    • Right click → “Open With” → Chrome

That’s it.

Option 2: Use a Local Server (Optional)

If you want a local dev server:

VS Code Live Server

  1. Install the Live Server extension in VS Code
  2. Right-click index.html
  3. Click Open with Live Server

How to Use

Home team

  • Click +1 / +2 / +3 and enter the player number when prompted.
  • Click Foul to add a foul to a Home player.

Away team

  • Same idea using the Away buttons.

Print results

  • Click Print Box Score to display current stats under the buttons.

Output Format

When you click Print Box Score, the app prints something like:

  • Home Team Stats
    • Number 12 | Points: 8 | Fouls: 2
  • Away Team Stats
    • Number 5 | Points: 6 | Fouls: 1

(The display uses <br> line breaks for formatting.)


File Structure

This project is a single HTML file:

  • index.html
    • Buttons + UI
    • <script> section with all JavaScript logic

Notes / Limitations

  • Player numbers are collected using prompt()
  • There is no input validation (typing a blank value may create weird keys)
  • Stats are stored in memory only (refreshing the page resets everything)
  • Stats order may not be sorted numerically when printed (object key order)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages