编码高尔夫:堆叠 LCD 字符以制作其他字符
最大的七段、十四段或十六段 LCD 符号集是多少,这样
- 所有符号都可以立即被识别为可以在标准 US-ASCII 键盘上键入的字符;
- 如果您采用符号集的任何子集并叠加其所有元素,那么这也是一个可立即识别和可输入的字符;
- 所有基本符号和所有可能的叠加组都会产生不同字符。
我能用七段字母做到的最好的就是三个:
不公平地使用以下字符脱离上下文毫无意义,例如 Harvey Twyman 的七段字体 中的 M 和 W 不好。
(你为什么要这样做?想象一种情况,你可以叠加你选择的符号,其中一些符号将是不可见的,但你不知道哪些。通过使用像这样的集合中的符号,并让某人查看结果,您可以推断出哪些基本符号是不可见的。)
What is the largest set of seven-, fourteen-, or sixteen-segment LCD symbols such that
- all of the symbols are instantly recognizable as characters that can be typed on a standard US-ASCII keyboard;
- if you take any subset of the symbol set and superimpose all its elements, that is also an instantly recognizable and typeable character;
- all of the base symbols and all of the possible superimposition groups produce distinct characters.
The best I've been able to do with a seven-segment alphabet is three:
No fair using characters that are meaningless out of context, e.g. the M and W from Harvey Twyman's seven segment font are no good.
(Why would you want to do this? Imagine a situation where you can superimpose symbols of your choice, and some of them are going to be invisible but you don't know which. By using symbols from a set like this, and getting someone to look at the result, you can deduce which base symbols were invisible.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一个观察结果是,关于不同字符的规则意味着集合中任何符号可以占用的最大段数等于 N_segments - N_symbols + 1。(并且您可以递归地将其应用于它不占用的段,并且其他符号。)
第一个推论是,如果您有一个最大尺寸的符号,那么当您添加任何单个额外段时,它必须产生一个清晰的符号。
第二个推论是,如果您有一个最大尺寸的符号,那么当您添加额外段的任意组合时,它也必须产生清晰的符号。
因此,要在 7 段显示中击败 3 种最佳表现,您不能使用任何占据超过 4 段的符号。我可以看到的可能性是(1段)-和'在多个地方,(2段)=,r,1,(3段)n,u,c各在两个地方,L,J无钩子,7无钩,(4 段)h、4、[、]、o 位于两处,F、J 和 L 带钩,7 带钩,t。
其中几个四段符合第一个推论 - 4(如果允许添加下段算作 Y)、F、带钩的 L 和 t。当你制作颠倒的 A 时,除了 F 之外的所有其他推论都失败了,并且 F 失败了,因为 P 和 P-with-hook(添加下段)并不不同。
因此,一组四个符号的最大符号大小必须为 3 个段。那么,第三个推论:如果两个符号组合起来为一组较少的符号形成最大尺寸的符号,则该组合必须符合第一个和第二个推论的条件。这适用于所有五个段对,并排除六个段对。
从另一端攻击,无法将单段集和两段集组合起来形成三个工作集(- 和 ' 只能生成 r,因此排除了 r,并且单独地它们不能与 = 一起使用或 1; ' 不适用于 r 或 1; 并且 r 和 1 不能一起使用)。因此,要获得一组四个符号,我们必须包含几个三段符号。
大写 n 和大写 u 或大写 c 中的任意两个构成大写 o。上面的 u 和下面的 n 组成 H,然后将 A 颠倒过来。上面的 u 或上面的 c 与 7 结合,形成 q,由此得到 A 和 g。上面的 u 还与没有钩子的 J 结合,使 y 再次颠倒。上面的 c 和下面的 n 组成 h-with-hook,然后组成 A 和 b-with-hook。上面的 c 与 L 结合,形成 E,然后形成 b 和 P,并带有钩子。低位 n 和低位 u 或低位 c 中的任意两个构成 o。将 n 与 L 一起降低得到 b,或与 J 一起得到 d,然后得到颠倒的 A。将 c 与 J 一起降低得到 d,同样的问题。 L 和 J 组成 U,再次颠倒 A。J 和 7 组成 ]。
因此:
那里没有任何三人组。 7和L只出现在一行,去掉它们,J就只出现在一行,将所有下或所有上组合起来可以有多种方式,并且只有一种上下组合。
因此,我们需要向其中添加单个或对。考虑到哪些符号单独有效,我们有(为了简单起见,不记录位置):
只有其中一个符号有两个较小的符号组合在一起 - 倒数第二个符号。这是一个上面的 r,以及一个右侧的 1。 u + c = o, u + r = G, u + 1 = J 带钩,c + r = E, c + 1 = d, r + 1 = 7 带hook, u + c + r = 6, u + c + 1 = d, c + r + 1 = 8 - 它失败了,因为这与所有这些的集合没有区别。
因此,我认为这是一个详尽的证明,证明您的七段数字集是最大集。
编辑:仅当初始集完整时,证明才是正确的。我遗漏了“。它不会产生三元组,不适用于全下或全上三段对,也不适用于 J 或 1,因此它不会影响结果。
此外,如果
-
和_
被认为是不同的,但不是很多,那么事情会变得更有趣;它们不会与任何其他单段和两段符号组合在一起,并且作为一对,它们不与任何上或下三段符号组合,也不与 J 或 7 组合。同样'
和,
——它们同样不组合三重奏与其他单段和两段符号,并且作为一对不与任何三段对组合编辑2:我还错过了上u或上c和7 。 9. 同样,这不会去任何地方;即使 u 和 c 也一起去,这三个组合也不会用较小的符号去任何地方。
One observation is that your rule about distinct characters means that the maximum number of segments that any symbol in your set can occupy is equal to N_segments - N_symbols + 1. (And you can apply that recursively to the segments it doesn't occupy and the other symbols.)
The first corrolary of this is that, if you have a symbol of this maximum size, it must produce a legible symbol when you add any single extra segment.
The second corrolary of this is that, if you have a symbol of this maximum size, it also must produce a legible symbole when you add any combination of extra segments.
So, to beat your best of 3 for a 7-segment display, you can't use any symbols that occupy more than 4 segments. The possiblities there that I can see are (1 segment) - and ' in multiple places, (2 segments) =, r, 1, (3 segments) n, u, c in two places each, L, J sans hook, 7 sans hook, (4 segments) h, 4, [, ], o in two places, F, J and L with hook, 7 with hook, and t.
Several of the four-segment ones fit the first corrolary -- 4 (if you allow adding the lower segment to count as a Y), F, L with hook, and t. All but F fail the second corrolary when you make an upside-down A, and F fails because P and P-with-hook (add lower segment) are not distinct.
Thus, a set of four has to have a maximum symbol size of 3 segments. A third corrolary, then: If two symbols combine to make a symbol of maximum size for a set of one fewer symbols, then that combination must fit the conditions of the first and second corrolaries. That applies to all pairs of five segments, and rules out pairs of six segments.
Attacking from the other end, there's no way to combine the one- and two-segment sets to make a working set of three (- and ' can only make r, so that rules out r, and individually they don't work with = or 1; ' doesn't work with r or 1; and r and 1 don't work together). So, to get a set of four symbols, we have to include a couple of three-segment ones.
Any two of upper n and upper u or upper c make an upper o. Upper u and lower n make H and thence upside-down A and out. Upper u or upper c combine with 7, making q, from whence we get A and g. Upper u also combines with J sans hook, making y and thence upside-down again. Upper c and lower n make h-with-hook, and thence A and b-with-hook. Upper c combines with L, making E and thence b and P with hooks. Any two of lower n and lower u or lower c make o. Lower n with L makes b, or with J makes d, and either thence gets upside-down A. Lower c with J makes d, same problem. L and J make U, and again the upside-down A. J and 7 make ].
Thus:
There aren't any trios in there. 7 and L only show up in one row, remove those and J is only in one row, combining all lowers or all uppers makes o several ways, and there's only one upper-lower combination.
Thus, we'd need to add singles or pairs to these. Considering just which ones are valid individually, we have (for simplicity, not recording positions):
There's only one of these where there are two smaller symbols that go together -- the second-to-last. That's an upper r, and a right-side 1. u + c = o, u + r = G, u + 1 = J with hook, c + r = E, c + 1 = d, r + 1 = 7 with hook, u + c + r = 6, u + c + 1 = d, c + r + 1 = 8 -- and there it fails, since that's not distinct from the set of all of them.
Thus, I think that's an exhaustive proof that your set of seven-segment numbers is a maximal set.
Edit: The proof is only true if the initial set is complete. I left out ". It doesn't make triplets, doesn't work with all-lower or all-upper three-segment pairs, and doesn't work with J or 1, so it doesn't affect the result.
Also, things get slightly more interesting if
-
and_
are considered distinct, but not a lot; they don't trio with any of the other one- and two-segment symboles, and as a pair they don't combine with any upper or lower three-segment symbols, nor the J or 7. Likewise'
and,
-- they again don't trio with the other one- and two-segment symbols, and as a pair don't combine with any of the three-segment pairs.Edit 2: I also missed upper u or upper c and 7 make 9. Again, this doesn't go anywhere; even though u and c also go together, the trio makes 9 two ways. Neither of those go anywhere with smaller symbols either.