Yw, that’s mutual aid
Again, I feel the need to apologize for being overly-hasty in voting to approve this puzzle. I considered insisting that the problem statement spell out the requirements for 1, 4, 7 explicitly, but I decided to just leave it as-is. My rationale was that people would figure it out since there is a visible test (#4) that includes each of these digits in it. In hindsight, I should have gone with my gut and insisted that the puzzle description be more thorough. Sorry.
For me, this solved the problem. Thank you very much.
I must agree, that the “expansion” of segments are not only unreasonable, and against logic, but forces us, to mess up a clean solution, which indeed frustrating. Also validation shouldn’t cover more cases than tests (#2 and #3 covers “no dot when first output char non-whitespace” and “works with multibyte characters” requirements, which are apparently not included in the statement)
“no dot when first output char non-whitespace” makes sense because it was mentioned that dot is added to prevent trimming.
“Expansion” does not “mess up a clean solution”. It only forces you to expand an incomplete solution. “cleanness” of resulting code depends only on your ability to write expandable code and cleanly expand existing code.
This puzzle has 2 and only 2 things I haven’t seen before on this site:
- wide character in validator.
- rules for digits are not explained in full in the problem statement, but rather require you to study the testcases.
the 2nd, in my opinion, can be fixed just by adding following statement: “You might need to see the expected output of IDE testcases to understand how each digit should be drawn”. Maybe with a reminder on how to see the output (that-and-that button).
There is no sense in extending segments on certain digits or the name of the puzzle should be changed.
7-segment displays are, as in Nicus’es post, fixed size and same for all digits. Different digits cannot use same segments of different size! Only if there are four extra “pixel” segments (two at the top and two at the bottom), leading to 11-segment display
The best would be to call it “Dot-matrix display”, but that would not explain why there is an empty space in the middle of digit one, for example.
I actually considered this argument when I was trying to decided whether or not to approve the puzzle as-is. However, I decided that most 7-segment displays have some kind of design in place to ensure that all digits are the same height, be it different sized segments, or angled corners, or a combination of the above. So I don’t think it’s unreasonable for the puzzle to try to emulate this feature.
And it does make the solution more interesting, if less elegant. In the world of software development, user feature requests rarely line up with my sensibilities of a clean code structure.
The key fact is the segments are allways the same - they are either on of off, they cannot change size.
The main isue is for most users, I guess, is to understand the problem at all, since the text is pretty unclear. I am very well aware what 7-segment duisplays are (as a matter of fact I am currently programming a piece of hardware with four 14-segment displays on it) and I had to read text several times to understand what is the problem. All it says is:
Output: Several lines containing a string of characters with the number at big size. There must be a space character between digits on each line but not at the end of each line.
The key to understanding the problem is in the title, and nowhere in the description. Even that way, it turns out that those “segments” are not actually segments and one need to debug and analyze the output and error messages to see how the numbers should look like.
Finally, it is very inconsistens with “emulation” - the upper right corner is rounded in case of “8” and not in case of “7”; there is still gap in the middle of “1” and “4”, etc.
one need to debug and analyze the output and error messages to see how the numbers should look like.
Or, you can press that little “list” icon next to the testcase buttons, and browse the expected output for all testcases.
Right, I did not know about that. Thanks!
But still - the description should be sufficient.
The pregenerated code for Java (at least) is not inline with the condition “0 <= N < 10000000000”, since long should be used instead of integer: “long N = in.nextLong();”.
Validation test 4 is a larger number , you need to use a long instead of int , despite the fact that the standard code has this as an int.
The changing segment size is really disappointing. Especially in the case of a puzzle of the week.
The Case 2 is 562.
But I don’t know what’s wrong in my answer. In other cases, it works well .
the case 2 (562) uses 2-bytes character.
var C = readline(); if(C.length == 2) C = C;
if C’s length is 2, I take only the second character.
Yeah, it’s dirty. But it works.
We have updated the puzzle to avoid this special cases…
Some Codingamers have to republish their solution.
The update needs some time to get in effect, or what? Cos it still does not work.
You migth refresh the IDE (Ctrl + F5) or submit your old solution and re-open the puzzle.
Thanks, refresh worked. I see you totally changed all of it - no extended segments, no dot at start. I thought you’d only change the showstopper multibyte character.
Now just a re-submit will not work, people have to adapt their solutions to the new puzzle.
(For the record, I’m not complaining I’m just clarifying)
Sorry to pester, but there’s one more thing I wonder. What happens now with the solution browser? In the puzzle listing, it still shows 100+ people solved this puzzle. But when I go to browse the solutions, it doesn’t show any old ones, as far as I can see. Well, almost…
It actually shows my own old solutions. (I’ve not resubmitted any successful new ones). I wonder if it’s something to do with “always show the logged in user his own solutions even if they were for an outdated revision of the rules”. Or if it’s because I possibly submitted them after you fixed the puzzle, but before I refreshed my IDE so I apparently were still using the old validators.
We didn’t reset the counter of people who solved the puzzle, we just updated the tests/validators for the next coders.
We also tagged the old published solutions as ‘not published’ to reduce the pull incorrect solutions but we didn’t remove/recompute solutions even if it doesn’t work anymore.