挑战
按字符数计算最短的程序,接受 XY R
形式的标准输入,并具有以下保证:
-
R
是小于或等于 8 的非负十进制数
X
和 Y
是以十进制形式给出的非负角度,为 45° 的倍数(0
、45
、< code>90、135
等)
-
X
小于 Y
-
Y
不 < code>360 如果 X
为 0
并在标准输出上生成从起始角度 X
到结束角度的 ASCII“弧”半径 R
的角度 Y
,其中:
- 圆弧的顶点由
o
表示
- 0 和
0
的角度code>180 用 -
表示
- 用
/
表示
45
和 225
的角度 90
和 270
由 |
表示
135
和 315
的角度由\
- 两条线围成的多边形区域用非空白字符填充。
如果给出无效输入,程序不需要产生有意义的输出。任何语言的解决方案都是允许的,当然,专门为此挑战编写的语言或不公平使用外部实用程序的语言除外。只要输出格式保持正确,输出中就允许出现多余的水平和垂直空格。
快乐高尔夫!
大量示例
输入:
0-45 8
输出:
/
/x
/xx
/xxx
/xxxx
/xxxxx
/xxxxxx
/xxxxxxx
o--------
输入:
0-135 4
输出:
\xxxxxxxx
\xxxxxxx
\xxxxxx
\xxxxx
o----
输入:
180-360 2
输出:
--o--
xxxxx
xxxxx
输入:
45-90 0
输出:
o
输入:
0-315 2
输出:
xxxxx
xxxxx
xxo--
xxx\
xxxx\
Challenge
The shortest program by character count that accepts standard input of the form X-Y R
, with the following guarantees:
R
is a non-negative decimal number less than or equal to 8
X
and Y
are non-negative angles given in decimal as multiples of 45° (0
, 45
, 90
, 135
, etc.)
X
is less than Y
Y
is not 360
if X
is 0
And produces on standard output an ASCII "arc" from the starting angle X
to the ending angle Y
of radius R
, where:
- The vertex of the arc is represented by
o
- Angles of
0
and 180
are represented by -
- Angles of
45
and 225
are represented by /
- Angles of
90
and 270
are represented by |
- Angles of
135
and 315
are represented by \
- The polygonal area enclosed by the two lines is filled with a non-whitespace character.
The program is not required to produce meaningful output if given invalid input. Solutions in any language are allowed, except of course a language written specifically for this challenge, or one that makes unfair use of an external utility. Extraneous horizontal and vertical whitespace is allowed in the output provided that the format of the output remains correct.
Happy golfing!
Numerous Examples
Input:
0-45 8
Output:
/
/x
/xx
/xxx
/xxxx
/xxxxx
/xxxxxx
/xxxxxxx
o--------
Input:
0-135 4
Output:
\xxxxxxxx
\xxxxxxx
\xxxxxx
\xxxxx
o----
Input:
180-360 2
Output:
--o--
xxxxx
xxxxx
Input:
45-90 0
Output:
o
Input:
0-315 2
Output:
xxxxx
xxxxx
xxo--
xxx\
xxxx\
发布评论
评论(12)
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print$/,map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
..编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 个字符Perl 使用 say 功能,
161 149139 个字符Perl 不带尾随换行符,
153143 个字符原版评论:
编辑 1: 内联子运算符、关系运算符和相等运算符返回 0 或 1。
编辑2:添加了带有评论的版本。
编辑 3: 修复了 360° 的封闭线。字符数显着增加。
编辑4:添加了一个较短的版本,改变了规则。
编辑 5: 更智能地修复 360° 包围线。另外,使用数字作为填充。这两件事都是显而易见的。嗯,我应该多睡一点:/
编辑6:从匹配运算符中删除了不需要的
m
。删除了一些分号。编辑7:更智能的正则表达式。少于200个字符!
编辑 8: 很多小改进:
split
字符串映射(1 个字符)编辑 9: 对条件运算符进行一点重新排序可以节省 2 个字符。
编辑10:使用裸字作为字符。
编辑11:将打印移到循环内部,受到Lowjacker答案的启发。
编辑12:使用
say
添加版本。编辑13:重复使用角度字符作为填充字符,就像Gwell的答案一样。不过,输出不如 Gwell 的那么好,这需要 5 个额外的字符:) 另外,.. 运算符不需要括号。
编辑14:将正则表达式直接应用于<>。根据 Adrian 对 bta 答案的建议,将范围运算符分配给变量。添加没有最后换行符的版本。更新了
say
版本。编辑15:更多内联。地图{块}@a ->映射 expr,@a。
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Original version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print$/,map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
"'"'){say map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
..EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
){print+(map$_|$y?!($t=8*($y>0)+atan2(-$y,$_)/atan2 1,1)&-amp;/45==8|$t>=EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Perl,
/45&$t<=-amp;/45?qw(- / | \\)[$t%4]:$":o,@a),$/}235 211 225 211 207 196 179 177 175 168 160 156146 charsPerl using say feature,
161 149139 charsPerl without trailing newline,
153143 charsOriginal version commented:
EDIT 1: Inlined sub, relational and equality operators return 0 or 1.
EDIT 2: Added version with comments.
EDIT 3: Fixed enclosing line at 360º. Char count increased significantly.
EDIT 4: Added a shorter version, bending the rules.
EDIT 5: Smarter fix for the 360º enclosing line. Also, use a number as fill. Both things were obvious. Meh, I should sleep more :/
EDIT 6: Removed unneeded
m
from match operator. Removed some semicolons.EDIT 7: Smarter regexp. Under 200 chars!
EDIT 8: Lots of small improvements:
split
string -> qw (3 chars)EDIT 9: A little reordering in the conditional operators saves 2 chars.
EDIT 10: Use barewords for characters.
EDIT 11: Moved print inside of loop, inspired by Lowjacker's answer.
EDIT 12: Added version using
say
.EDIT 13: Reuse angles characters for fill character, as Gwell's answer does. Output isn't as nice as Gwell's though, that would require 5 additional chars :) Also, .. operator doen't need parentheses.
EDIT 14: Apply regex directly to <>. Assign range operator to a variable, as per Adrian's suggestion to bta's answer. Add version without the final newline. Updated
say
version.EDIT 15: More inlining. map{block}@a -> map expr,@a.
Lua,259 个字符
稍微滥用了
非空白字符
子句,以产生令人眼花缭乱的显示,更重要的是节省笔划。输入:
45-360 4
能够处理奇数角度
输入:
15-75 8
Lua, 259 characters
Slightly abuses the
non-whitespace character
clause to produce a dazzling display and more importantly save strokes.Input:
45-360 4
Able to handle odd angles
Input:
15-75 8
MATLAB,188 个字符 :)
input '';[wxr]=strread(ans,'%d-%d%d');l='-/|\-/|\-';[XY]= meshgrid(-r:r);T=atan2(-Y,X)/pi*180;T=T+(T<=0)*360;T(T>w&T
注释代码:
MATLAB, 188 chars :)
input '';[w x r]=strread(ans,'%d-%d%d');l='-/|\-/|\-';[X Y]=meshgrid(-r:r);T=atan2(-Y,X)/pi*180;T=T+(T<=0)*360;T(T>w&T<x)=-42;T(T==w)=-l(1+w/45);T(T==x)=-l(1+x/45);T(r+1,r+1)=-'o';char(-T)
Commented code:
Mathematica 100 Chars
由于图形太完美而退出竞赛 :)
调用
f[30-70 5]
结果
替代文本http://a.imageshack.us/img80/4294/angulosgolf。 png
替代文本 http://a.imageshack.us/img59/7892/angulos2.png
注意
>
SetAttributes[f, HoldAll];
是必需的,因为输入
否则被解释为
Mathematica 100 Chars
Out of competition because graphics are too perfect :)
Invoke with
f[30-70 5]
Result
alt text http://a.imageshack.us/img80/4294/angulosgolf.png
alt text http://a.imageshack.us/img59/7892/angulos2.png
Note
The
SetAttributes[f, HoldAll];
is needed because the input
is otherwise interpreted as
GNU BC,339 个字符
Gnu BC 因为
read()
、else
和逻辑运算符。GNU BC, 339 chars
Gnu bc because of
read()
,else
and logical operators.MATLAB 7.8.0 (R2009a) -
168163162 个字符从 雅各布的回答,灵感来自gwell 使用任何非空白字符来填充弧线,我管理了以下解决方案:
以及一些测试输出:
我可以通过删除将其进一步减少到156个字符对
disp
的调用,但这会在输出之前添加额外的ans =
(这可能违反输出格式规则)。尽管如此,我还是觉得有一些方法可以进一步减少这种情况。 ;)
MATLAB 7.8.0 (R2009a) -
168163162 charactersStarting from Jacob's answer and inspired by gwell's use of any non-whitespace character to fill the arc, I managed the following solution:
And some test output:
I could reduce it further to 156 characters by removing the call to
disp
, but this would add an extraans =
preceding the output (which might violate the output formatting rules).Even still, I feel like there are some ways to reduce this further. ;)
Ruby,
292 276186 个字符更好的格式版本:
我确信有人比我睡得更多可以压缩这个更多...
编辑 1: 已切换内循环中的
if
语句要嵌套? :
运算符编辑2:将范围存储到中间变量(感谢Adrian),使用stdin而不是CLI参数(感谢Jon的澄清),消除数组以支持直接输出,修复错误其中 360 度的结束角度不会显示一条线,删除了一些不需要的括号,使用除法进行舍入而不是
.round
,使用模而不是条件加法Ruby,
292 276186 charsNicer-formatted version:
I'm sure someone out there who got more sleep than I did can condense this more...
Edit 1: Switched
if
statements in inner loop to nested? :
operatorEdit 2: Stored range to intermediate variable (thanks Adrian), used stdin instead of CLI params (thanks for the clarification Jon), eliminated array in favor of direct output, fixed bug where an ending angle of 360 wouldn't display a line, removed some un-needed parentheses, used division for rounding instead of
.round
, used modulo instead of conditional addRuby,168 个字符
需要 Ruby 1.9 才能工作
可读版本:
Ruby, 168 characters
Requires Ruby 1.9 to work
Readable version:
Perl - 388 个字符
由于提出一个我自己无法解决的挑战是不公平的,这里有一个解决方案,它使用字符串替换而不是三角函数,并大量利用您友好的邻居 Perl 将裸字视为字符串的能力。它必然有点长,但为了独特性也许很有趣:
所有换行符都是可选的。这相当简单:
$a
) 和底部 ($b
) 部分。$_
)。sub A
来获取角度的填充字符。sub B
来获取区域的填充字符。A
和B
构建替换字符数组 (@a
)。生成的格式如下所示,对于
R
= 4:其中
AH
表示角度,IP
表示区域。(诚然,这可能会进一步解决。当写成一个列表时,
@a
上的操作给了我不正确的输出,大概与map
与map
的播放方式有关。代码>$_。)Perl - 388 characters
Since it wouldn't be fair to pose a challenge I couldn't solve myself, here's a solution that uses string substitution instead of trigonometric functions, and making heavy use of your friendly neighbourhood Perl's ability to treat barewords as strings. It's necessarily a little long, but perhaps interesting for the sake of uniqueness:
All newlines are optional. It's fairly straightforward:
$a
) and bottom ($b
) parts of the pattern.$_
).sub A
to get the fill character for an angle.sub B
to get the fill character for a region.@a
) of substitution characters usingA
andB
.The generated format looks like this, for
R
= 4:Where
A-H
denote angles andI-P
denote regions.(Admittedly, this could probably be golfed further. The operations on
@a
gave me incorrect output when written as one list, presumably having something to do with howmap
plays with$_
.)C# -
325319 个字符 换行符不重要。
输入/输出示例
C# -
325319 charsNewlines not significant.
Sample input/output
Java - 304 个字符
更可读的版本:
Java - 304 chars
More readable version:
C(902 字节)
这不使用三角函数(像原始的 perl 版本),所以它相当“臃肿”。无论如何,这是我的第一个代码高尔夫提交:
另外,
#define
看起来相当丑陋,但它们节省了大约 200 个字节,所以无论如何我都保留了它们。它是有效的 ANSI C89/C90,编译时几乎没有警告(两个关于atoi
和puts
以及两个关于main
的残缺形式)。C (902 byte)
This doesn't use trigonometric functions (like the original perl version), so it's quite ``bloated''. Anyway, here is my first code-golf submission:
also, the
#define
s look rather ugly, but they save about 200 bytes so I kept them in, anyway. It is valid ANSI C89/C90 and compiles with very few warnings (two aboutatoi
andputs
and two about crippled form ofmain
).