https://github.com/albertllousas/tennis-kata-in-haskell
Tennis kata, haskell, TDD, state monad, 30 lines ...
https://github.com/albertllousas/tennis-kata-in-haskell
Last synced: about 2 months ago
JSON representation
Tennis kata, haskell, TDD, state monad, 30 lines ...
- Host: GitHub
- URL: https://github.com/albertllousas/tennis-kata-in-haskell
- Owner: albertllousas
- License: bsd-3-clause
- Created: 2022-07-23T04:57:26.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-13T10:18:29.000Z (about 1 year ago)
- Last Synced: 2025-01-30T22:48:25.225Z (3 months ago)
- Language: Haskell
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- License: LICENSE
Awesome Lists containing this project
README
# tennis-kata-using-state-monad
Cool [Tennis kata](https://codingdojo.org/kata/Tennis/) to use the State Monad and practice TDD.
## Description
This Kata is about implementing a simple tennis game. The scoring system is rather simple:1. Each player can have either of these points in one game “love” “15” “30” “40”
2. If you have 40 and you win the point you win the game, however there are special rules.
3. If both have 40 the players are “deuce”.
4. If the game is in deuce, the winner of a point will have advantage
5. If the player with advantage wins the ball he wins the game
6. If the player without advantage wins they are back at deuce.## Tests
```shell
> stack testTennis
acceptance
Play a full game
game rules
If a player wins a point, it's current score is increased
if a player have 40 and they win the point, then they win the game
If both have 40 the players are “deuce”
If the game is in deuce, the winner of a point will have advantage
If the player with advantage wins the ball they win the game
If the player without advantage wins they are back at deuce.Finished in 0.0017 seconds
```