45 lines
1.1 KiB
Markdown
45 lines
1.1 KiB
Markdown
|
# Secret Handshake
|
||
|
|
||
|
Write a program that will take a decimal number, and convert it to the appropriate sequence of events for a secret handshake.
|
||
|
|
||
|
> There are 10 types of people in the world: Those who understand
|
||
|
> binary, and those who don't.
|
||
|
|
||
|
You and your fellow cohort of those in the "know" when it comes to
|
||
|
binary decide to come up with a secret "handshake".
|
||
|
|
||
|
```
|
||
|
1 = wink
|
||
|
10 = double blink
|
||
|
100 = close your eyes
|
||
|
1000 = jump
|
||
|
|
||
|
|
||
|
10000 = Reverse the order of the operations in the secret handshake.
|
||
|
```
|
||
|
|
||
|
```
|
||
|
handshake = SecretHandshake.new 9
|
||
|
handshake.commands # => ["wink","jump"]
|
||
|
|
||
|
handshake = SecretHandshake.new "11001"
|
||
|
handshake.commands # => ["jump","wink"]
|
||
|
```
|
||
|
|
||
|
The program should consider strings specifying an invalid binary as the
|
||
|
value 0.
|
||
|
|
||
|
To run the tests simply run the command `go test` in the exercise directory.
|
||
|
|
||
|
If the test suite contains benchmarks, you can run these with the `-bench`
|
||
|
flag:
|
||
|
|
||
|
go test -bench .
|
||
|
|
||
|
For more detailed info about the Go track see the [help
|
||
|
page](http://help.exercism.io/getting-started-with-go.html).
|
||
|
|
||
|
## Source
|
||
|
|
||
|
Bert, in Mary Poppins [view source](http://www.imdb.com/character/ch0011238/quotes)
|