https://github.com/holsee/beer_song
99 Bottles of beer OTP Style with Excheck
https://github.com/holsee/beer_song
Last synced: 2 months ago
JSON representation
99 Bottles of beer OTP Style with Excheck
- Host: GitHub
- URL: https://github.com/holsee/beer_song
- Owner: holsee
- Created: 2016-04-06T15:39:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2016-04-07T11:19:24.000Z (about 9 years ago)
- Last Synced: 2025-02-05T06:44:46.771Z (4 months ago)
- Language: Elixir
- Size: 10.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# BeerBottles Kata
http://www.99-bottles-of-beer.net/
OTP Style with excheck
"
99 bottles of beer on the wall, 99 bottles of beer.
Take one down and pass it around, 98 bottles of beer on the wall."...
1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall.
"Each explicit actor has been modeled as a process.
- Each **Beer** is a process
- The **Store** is a process, that sells Beer
- The **Wall** will hold the Beers
- Each **Person** who is drinking the beer is a processThe lyrics of the song are enacted by the processes communicating with each other.
Notes:
- Each beer holds it volume
- Each person holds the quantity of beer they each consumed
- This will run in a infinite loop unless you comment out the call which makes the recursive loop:beer_song.ex
```
24 :none ->
25 goto_the_store_get_some_more(people, store, wall, count) # comment out to prevent infinite binging
26 #:go_home # uncomment to do single run
```Compile:
```
mix do deps.get, compile
```Test:
```
mix test
```Run:
open iex session
```
iex -S mix
```let the drinking begin
``` elixir
num_beers_before_getting_more 99
BeerBottles.BeerSong.begin num_beers_before_getting_more
```