An app to calculate the statistics of tennis matches
Prerequisite : yarn
is available on your local machine.
To run the app, follow the instructions below:
- run
yarn install
- run
yarn start
- (optional) If you want to provide your own input file, run
yarn start [FULL PATH TO INPUT FILE]
.
See animated demo above for an example.
To run the tests
- run
yarn test
Implementation details:
- summarising the progression of points in the input file into games with statistics - points won, and the winner of each game
- summarising the progression of games into sets with statistics - games won, and the winner of each set
- lastly, summarising the progression of sets into matches with statistics - sets won, and the winner of each match
These were the high level design thoughts to guide implementation
- Require to structured data in a way to query statistics
- Small functions to abstract tennis concept with regarding criterias to win a game, set and match
- To ensure data sets receive is cleansed (ie: blank spaces)
- To create functions to summarise games in to sets
- To create functions to summarise sets into match
- Used a spike to get a feel how the data structure may look like
- Used TDD/BDD to guide implementation base on knowledge from spike
- All rows are delimited by a new line and a return carriage (ie: \r\n)
- Match description (ie: Match: 01) and players match up description (ie: Person A vs Person B) are spelt correctly and case sensitivity is expected in input data.
- Assumes the file exist in the filepath supplied when running the app. The app does not test for file existance at this stage.
- Supplied input points file is assumed to contained fully complated matches (ie: points reflect a fully completed match)