Confusing `Grains` instructions

Currently the grains instructions indicate a student’s solution should return in part the total number of grains on the chessboard. However, that’s misleading because the Batch Script test suite only tests the number of grains on a given square. batch/exercises/practice/grains/.docs/instructions.append.md at main · exercism/batch · GitHub should be updated to make that clear since at the moment, the instructions are contradicting the test suite.

The most glaring issue with the append file is that changes the exercise. This is a classic mathematical problem focused on calculating the total number of grains on a chessboard. While the grains on each square are part of the story, the main focus is on the total. Given the structure of this problem, any deviation could lead to an exercise that doesn’t quite align with the original challenge.

Another, and in my opinion, better option would be to use a modified board, perhaps one with a 5x5 size. This way, you can still ask for the grains on each square, calculate the total, and remain largely aligned with the tale and the specs.

The append file would clarify the track-specific implementation which opted out of some of the upstream tests. Those test cases are considered optional, and a track can choose to implement or not implement specific ones.

That’s in the append already because the king runs out of grains after 31 squares (because Batch is 32-bit).

The issue is that the test runner checks stdout from invoking the student’s Batch file for each test case. There isn’t currently a mechanism for it to check two different files so the track had to pick between testing calculating the grains on indvidual squares or the total grains on the chessboard. Adding something like that to the testing setup would probably be a good idea if possible, but it’s out of scope for what I’m discussing here.

1 Like

Bummer, I wasn’t aware of all those restrictions. Seems like it’s too late to make any changes now. A bit unfortunate that the Batch script focused on the squares, though. The crux of the exercise/tale is the total number of grains, as this naturally leads most people to calculate the squares as well. That should have been made clearer in the specs.

Removing the part of the instructions about calculating the total and the squares seems reasonable, but it will probably cause issues across multiple tracks. It’s probably also too late for that kind of change.