vzmind
1
I am trying to make a Greed game. See attached for my code.
For some reason, when the roll method returns an array with three of 1s
or 5s such as:
[1, 1, 2, 1, 5]
I get an infinite loop printing
You roll [1, 1, 2, 1, 5]
You roll [1, 1, 2, 1, 5]
You roll [1, 1, 2, 1, 5]
…
I do not have this problem for any array that does not have three of 1s
or 5s.
Any idea why I get this problem?
vzmind
2
I suggest writing some unit tests for your methods, and stepping
through them with the debugger.
On Tue, Apr 16, 2013 at 7:23 PM, Vincent S.
vzmind
3
Vincent S. wrote in post #1105936:
Any idea why I get this problem?
nonscoring_dices returns -1 and you don’t have condition for this value
in main loop of ‘start’ method.