Exercism: Go version of the 'Secret Handshake' exercise.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.1 KiB

9 years ago
  1. # Secret Handshake
  2. Write a program that will take a decimal number, and convert it to the appropriate sequence of events for a secret handshake.
  3. > There are 10 types of people in the world: Those who understand
  4. > binary, and those who don't.
  5. You and your fellow cohort of those in the "know" when it comes to
  6. binary decide to come up with a secret "handshake".
  7. ```
  8. 1 = wink
  9. 10 = double blink
  10. 100 = close your eyes
  11. 1000 = jump
  12. 10000 = Reverse the order of the operations in the secret handshake.
  13. ```
  14. ```
  15. handshake = SecretHandshake.new 9
  16. handshake.commands # => ["wink","jump"]
  17. handshake = SecretHandshake.new "11001"
  18. handshake.commands # => ["jump","wink"]
  19. ```
  20. The program should consider strings specifying an invalid binary as the
  21. value 0.
  22. To run the tests simply run the command `go test` in the exercise directory.
  23. If the test suite contains benchmarks, you can run these with the `-bench`
  24. flag:
  25. go test -bench .
  26. For more detailed info about the Go track see the [help
  27. page](http://exercism.io/languages/go).
  28. ## Source
  29. Bert, in Mary Poppins [view source](http://www.imdb.com/character/ch0011238/quotes)