Giter VIP home page Giter VIP logo

bowling's Introduction

Bowling tech

The basic rules of bowling:

  • A bowling lane has 10 bowling pins
  • A bowling series consists of 10 rounds
  • Each round consists 2 throws (unless the player gets a strike).
  • A bowling round has 10 bowling pins
  • A spare is scoring all 10 pins on the 2nd throw
  • A strike is scoring all 10 pins on the 1st throw
  • If the player gets a strike, the round has 1 throw.

This repo acts as a starting point for implementing parts of bowling.

Setup

Installing dependenceis

yarn install

Run tests

yarn test

Start server

yarn dev

Open http://localhost:3000 with your browser to see the result.

bowling's People

Contributors

tomfa avatar

Watchers

 avatar  avatar

bowling's Issues

API 1: validate input

Look at lib/bowling.ts. The calculateScore method currently accepts a list of bowling throws.
We want to validate the input, so one one cheats!

  • Throws can not be larger than 10
  • Throws can not be lower than 0
  • A round is over when 2 throws are made, or if the 1st was a 10
  • We accept 0 or more throws, but not one that results in more than 10 rounds.
  • A round with total score > 10 is not allowed.

Web 2: playing with friends

We want the ability to play bowling with our friends.

  • Add an initial form where you can add multiple players (up to 5) and their names
  • After submitting the form, render one series and scores and input field per user.

Web 1: submit scored pins

We want to render an UI for users to input the number of bowling pins they scored.
Take a look at pages/index.tsx.

  • Add an input field in the UI, for inputting score of a single throw
  • Add a submit button that posts that input to /post
  • Render the response from the server above the input field.
  • When inputting a 2nd throw, pass along the previous throw as well, like this: [5, 3]

System 1: persisting results

If you refresh the browser window, your current series are lost.
We want to persist the current state, and be able to see previously played series.

How should we do this? (You do not have to solve it technically)

API 2: calculate score

We want to calculate the cumulative scores after each round. In the BowlingRound type, set the correct sum value.

  • 1 bowling pin scored = 1 point
  • A strike gets double points of two next throws. Example: the throws [10, 6, 3] results in the points 19 and 28.
  • A spare gets double points of the next throw. Example: the throws [6, 4, 5, 3] results in the points 15 and 23

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.