acbellini/juzzle — pull request #2 by jamesshapiro (2013-09-17 12:03:11+00:00)
Title: Update JuzzleBoard.java

Similar to my comment on the AlphabetJuzzleBoard.

Changed line 27 from "int k = i * j + j;" to "int k = i * c + j;"

In this case we have a 4x4 grid. Consider what happens on the second iteration of the loop on line 25. In this case we want the outcome on line 28 to be:

board[1][0] = LOWERCASE.getIndex(letters[4]);

But under the equation on line 27, we get int k = i * j + j = (1 * 0) + 0 = 0. This leaves us with:

board[1][0] = LOWERCASE.getIndex(letters[0]);

Other values are similarly miscalculated. The new equation, "int k = i * c + j;" fixes this problem. I'm assuming it's what the author originally intended.