[Community Puzzle] 7-segment display

O_o thank you so much.
“An integer for the size of the segment on each number’s digit.” so if you’ve got “14” it means (to me) all segments = S but not some = S+1. I do S + 1 only when it’s required E.g : 148, so of course I could search for a bug for a while.
Anyway many thanks.

Yw, that’s mutual aid :smiley:

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.

  • danBhentschel

For me, this solved the problem. Thank you very much. :smiley:

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:

  1. wide character in validator.
  2. 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 :slight_smile:

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.

3 Likes

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.

  • danBhentschel

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.

3 Likes

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.

1 Like

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();”.

4 Likes

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.

1 Like

Test case 4 (14790) of the 7-segment display community puzzle is wrong: the expected size of the vertical segments of 1 and 4 is 4 chars instead of the specified 3.

Getting the expected display would require extra LED segments in the corners, and then it wouldn’t be a 7-segment display. Also, vertical segments of digits without the central segment (1, 4, 7, 0) would need to be extended in the middle as well for consistency.

So the fourth test case (and maybe validators) need to be fixed accordingly so that segment size is truly the specified one in all cases.

Thanks :slight_smile:

1 Like

1,4, and 7 do indeed have line segments extended. There’s been a lot of talking about this already.

I think Bob is right.
Here is the correct output of Test case 4:

.              ####   ####   ####
     # #    #      # #    # #    #
     # #    #      # #    # #    #
     # #    #      # #    # #    #
     # #    #      # #    # #    #
        ####          ####
     #      #      #      # #    #
     #      #      #      # #    #
     #      #      #      # #    #
     #      #      #      # #    #
                      ####   ####

Nope.
Read magaiti’s answer.

Just because they do have extended segments does not mean it is right.
The specifications require segment length 3, the expected result shows some segments with 3 and some with 4. I can’t see how this can possibly be considered right.

The segments have LEDs sometimes on their ends.

To me, the point of a 7-segment LED display is, precisely, that it has 7 fixed-length LEDs that are either entirely on or entirely off, they cannot be extended :slight_smile: The Wikipedia picture is rather clear that way. Some types of display do have extra LEDs on extremities so they look nicer, but they are not, strictly speaking, what I would call 7-segment.

I’m not going to war on this, but if the test case stays that way, then the description is, at the very best, inaccurate and incomplete, as it does not specify the way segments need to be extended.

I think that they are extended because he wants that each 7-segment has the same height.