Exercise: Solve this problem in Go. Write code and test cases too.A game of Pig exercise
Time to complete: 1-2 days
What will you learn: math/rand, for loops, conditionals, accepting input from cli, declaring struct and its methods, fmt package, using flag or cobra for building CLIs
How to evaluate your solution:
I haven’t yet evaluated the solution to this program written by many developers. If you have solved this problem and want your code reviewed, please ping me on Twitter or LinkedIn with your repo link. Ensure your repo has a good readme, makefile and working implementation of all three stories. This problem is difficult to test drive and write test cases for (due to the side effect of rolling a die).
- Don’t look at the solution unless you have you. Otherwise, you’re not getting much value from the bootcamp.
I know what I am doing; stop patronising me.
- If you say so 🤷, here’s the sample implementation - https://github.com/one2nc/gameofpig