Coding Games and Programming Challenges to Code Better
Send your feedback or ask for help here!
Couldn’t find anything similar with search. May be this though but then it needs a fix.
I am solving puzzle of the week (“CodinDice”). Issue is not specific to the task but I want to note this in case it’s a puzzle bug. The issue is my output (properly sent to stdout) is ignored.
Consider:
String s = solveit();
System.err.printf(“Answer: "%s"\n”, s);
System.out.println(s);
Output:
Answer: “0 LEFT”
0 LEFT
Failure
Found: Nothing
Expected: “0”
This doesn’t happen when the answer is “RIGHT”! Also, on sequence (0 LEFT, 0 RIGHT) I get:
Answer: “0 LEFT”
0 LEFT
Answer: “0 RIGHT”
0 RIGHT
Failure
Found: “0 R”
Expected: “0 D”
Note “0 LEFT” is ignored. One time I even got this:
Answer: “0 LEFT”
0 LEFTAnswer: "
0 RIGHT"
0 RIGHT
Given my code is not multi-threaded I am confused.
I also did this:
final byte[] utf8Bytes1 = s.getBytes(“UTF-8”);
final byte[] utf8Bytes2 = “0 LEFT”.getBytes(“UTF-8”);
System.err.printf(“%d and %d, %b\n”, utf8Bytes1.length, utf8Bytes2.length, Arrays.equals(utf8Bytes1, utf8Bytes2));
Result:
Answer: “0 LEFT”
6 and 6, true
0 LEFT
Failure
Found: Nothing
Expected: 0
Any ideas?
Reduced to the following:
This works:
String s = String.format("%d %s", 0, Movedir.LEFT); System.out.println(s);
This fails:
List<String> result = new ArrayList<>(); result.add(String.format("%d %s", 0, Movedir.LEFT)); for (String s : result) { System.err.printf("Answer: \"%s\"\n", s); System.out.println(s); }
Movedir is:
enum Movedir {LEFT, RIGHT, UP, DOWN}
Further reduced to:
List<String> result = new ArrayList<>(); result.add("0 LEFT"); for (String s : result) { System.out.println(s); }
Result:
Failure
Found: Nothing
Expected: “0”
This is test 2.
pinging contributor: @BlitzProg.
Sorted. Rolling dice in a direction only rolls it by one cell. Not super clear from the task, and the error message is misleading.
Hey! Sorry if you had trouble with it. Also didn’t notice the pinging, maybe there is some settings I need to adjust…
You can find the exact output required by a particular test case by clicking the icon on the top right of the test window box. The test case list will show up and you can click on whichever tests you’re interested in
I especially recommend to do that on this puzzle because it is a very difficult one and potentially very confusing.
Codingame proceeds to compare naively char-by-char your output with the test cases and immediately stop at the first error. I agree it’s a bit annoying to understand when you’re not used to it, but it is very accurate.
Hello,
I think there is some kind of bugs in the puzzle CodinDice ( Coding Games and Programming Challenges to Code Better )
For the test 6 “Iron Dice”, the initial position is:
T1 I0 … T2
… … … …
… … … …
… … … …
The suggestion solution is:
… I0 T1 T2
… … … …
… … … …
… … … …
with the moves:
1 DOWN
1 RIGHT
1 RIGHT
1 UP
Total number of moves = 4
I don’t see any reason why the following proposal is incorrect:
T1 I0 T2 …
… … … …
… … … …
… … … …
with the moves:
2 DOWN
2 LEFT
2 UP
Total number of moves = 3
after the three moves, the top face dice 2 is still on 6.
all the dices are together.
the number of moves is lower.
Any idea?
Because that violates the “moving around” rules.
Thank a lot