It sounds like you've got it right in Case 1 to me, where the player moves a single collective move that is the sum of both dice values. However, I think you're misunderstanding the part about the doubles. Having two dice with the same value doesn't mean the roll was invalid. How I'm reading it, the instructions are saying that if both dice have the same value, then the player moves, following whatever snake or ladder that they might have landed on to a final square. Then, because the player rolled two dice that are the same value, they get an extra turn to roll both dice again and move again before the other player gets to move.
For example, in the first sample test case, Player 1 rolls a 1 and a 1, which is a "double" because both dice have a same value. Because 1+1=2, Player 1 moves to square 2, which has a ladder on it, so Player 1 takes the ladder and skips ahead to square 38. The "double" lets Player 1 roll both dice again to move again before Player 2 gets to make a move. This extra turn gets covered in the second sample test case where Player 1 rolls a 1 and a 5 and moves 6 more squares ahead to square 44. Only after all of this does Player 2 get a turn, which happens in the third sample test case.
Is the description phrase, "name has exactly 4 letters in it," supposed to imply that cases like "Name42" and "hi-hi" should be accepted as friends or not? They do contain exactly 4 letters, but the test cases don't really address strings that mix character types.
I'm getting this error in Python 3.4.3 when attempting this kata:
Traceback: in <module> NameError: name 'xrange' is not defined
I think it's because Python 3 uses range(), while Python 2 has xrange() for the same purpose. Perhaps some of the Python 3 tests are using xrange() and causing this?
raised as an issue here
It sounds like you've got it right in Case 1 to me, where the player moves a single collective move that is the sum of both dice values. However, I think you're misunderstanding the part about the doubles. Having two dice with the same value doesn't mean the roll was invalid. How I'm reading it, the instructions are saying that if both dice have the same value, then the player moves, following whatever snake or ladder that they might have landed on to a final square. Then, because the player rolled two dice that are the same value, they get an extra turn to roll both dice again and move again before the other player gets to move.
For example, in the first sample test case, Player 1 rolls a 1 and a 1, which is a "double" because both dice have a same value. Because 1+1=2, Player 1 moves to square 2, which has a ladder on it, so Player 1 takes the ladder and skips ahead to square 38. The "double" lets Player 1 roll both dice again to move again before Player 2 gets to make a move. This extra turn gets covered in the second sample test case where Player 1 rolls a 1 and a 5 and moves 6 more squares ahead to square 44. Only after all of this does Player 2 get a turn, which happens in the third sample test case.
Is the description phrase, "name has exactly 4 letters in it," supposed to imply that cases like "Name42" and "hi-hi" should be accepted as friends or not? They do contain exactly 4 letters, but the test cases don't really address strings that mix character types.
Sorry it took so long to get back. Busy at work.
Thanks for figuring it out. Works great.
Fixed
I'm getting this error in Python 3.4.3 when attempting this kata:
Traceback: in <module> NameError: name 'xrange' is not defined
I think it's because Python 3 uses range(), while Python 2 has xrange() for the same purpose. Perhaps some of the Python 3 tests are using xrange() and causing this?