Skip to content

Bowling testcases #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: bowling-testcases
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions bowling/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.10)
project(BowlingTest)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(${PROJECT_NAME} catch_amalgamated.cpp catch_main.cpp testBowling.cpp)
# target_compile_features(${PROJECT_NAME} PRIVATE std_cxx_version)
84 changes: 5 additions & 79 deletions bowling/README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,5 @@
# Bowling

Wrzućcie scenariusze testowe do katalogu bowling. Będą ocenione manualnie.

Dobierzcie się w nowe grupy. W grupie mają być osoby, z którymi jeszcze nie współpracowaliście 🙂

* Zróbcie burzę mózgów i napiszcie scenariusze testowe w formacie GIVEN WHEN THEN do programu, którego zadaniem jest liczyć punkty w kręglach. Scenariusze mają być napisane we frameworku Catch2, ale nie muszą zawierać żadnego kodu. Nawet nie musicie implementować tego programu (jeszcze 😉). Chodzi o to, aby pokryć jak największą funkcjonalność testami. Opis zasad gry w kręgle poniżej.
* +10 XP za minimum 15 różnych kombinacji danych wejściowych
* +5 XP za minimum 20 różnych kombinacji danych wejściowych
* Starajcie się pokryć skrajne przypadki
* Scenariusze zgłoście jako PR na gałąź bowling-testcases w repo testing. Będą one oceniane manualnie.

## Zasady gry (EN)

```text
Each game, or "line" of bowling, includes ten turns,
or "frames" for the bowler.

In each frame, the bowler gets up to two tries to
knock down all ten pins.

If the first ball in a frame knocks down all ten pins,
this is called a "strike". The frame is over. The score
for the frame is ten plus the total of the pins knocked
down in the next two balls.

If the second ball in a frame knocks down all ten pins,
this is called a "spare". The frame is over. The score
for the frame is ten plus the number of pins knocked
down in the next ball.

If, after both balls, there is still at least one of the
ten pins standing the score for that frame is simply
the total number of pins knocked down in those two balls.

If you get a spare in the last (10th) frame you get one
more bonus ball. If you get a strike in the last (10th)
frame you get two more bonus balls.
These bonus throws are taken as part of the same turn.
If a bonus ball knocks down all the pins, the process
does not repeat. The bonus balls are only used to
calculate the score of the final frame.

The game score is the total of all frame scores.

Examples:

X indicates a strike
/ indicates a spare
- indicates a miss
| indicates a frame boundary
The characters after the || indicate bonus balls

X|X|X|X|X|X|X|X|X|X||XX
Ten strikes on the first ball of all ten frames.
Two bonus balls, both strikes.
Score for each frame == 10 + score for next two
balls == 10 + 10 + 10 == 30
Total score == 10 frames x 30 == 300

9-|9-|9-|9-|9-|9-|9-|9-|9-|9-||
Nine pins hit on the first ball of all ten frames.
Second ball of each frame misses last remaining pin.
No bonus balls.
Score for each frame == 9
Total score == 10 frames x 9 == 90

5/|5/|5/|5/|5/|5/|5/|5/|5/|5/||5
Five pins on the first ball of all ten frames.
Second ball of each frame hits all five remaining
pins, a spare.
One bonus ball, hits five pins.
Score for each frame == 10 + score for next one
ball == 10 + 5 == 15
Total score == 10 frames x 15 == 150

X|7/|9-|X|-8|8/|-6|X|X|X||81
Total score == 167
```
mkdir build
cd build
cmake ..
make -j
./BowlingTest
Loading