这场比赛结束了。感谢您提供有趣的非eolang条目,并祝贺Jakuje赢得了JavaScript提交。
按照此站点上ASCII艺术挑战赛的悠久传统,这是另一个。给定输入,绘制螺旋。
&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<
很简单,是吗?呵呵呵呵...是的...
(灵感来自ASCII Dragons Curve帖子和Optimizer的ASCII Art of the Day帖子)
输入项
输入将采用一系列参数的形式,这些参数取自通常的STDIN /函数自变量/等,无论您使用哪种语言,均由四个部分组成。这些部分可以是四个单独的参数,一个四元组,一个大小为4的数组等。为了在整个挑战中保持简洁和一致,我将输入表示为单个单词。
- 一个整数
2 ≤ x ≤ 20
,以“正方形”指定螺旋的大小,每个打印字符代表一个“正方形”的大小。从理论上讲,它的范围可能很大,但是考虑到我们正在绘制ASCII艺术,此值的安全上限为20,因此它在屏幕上的显示效果相当不错。 d u r
或的单个字母l
,表示从开始的“正方形”(向下,向上,向右,向左)的初始移动。- 可选的
c
,指示“逆时针”。如果c
省略,则假定螺线为顺时针旋转。 - 最后一个整数
1 ≤ y ≤ 10
,用于指定将螺旋图形递归多少次,使用前一个螺旋的完成“正方形”作为新螺旋的开始“正方形”。我选择上限为10,因为我想在某个时候完成绘图。 - 一些示例输入:
20lc5
13d2
2rc1
有趣的是,请注意,输入尺寸的奇数值将@
始终始终是螺旋的精确中心,但是偶数值可能会在四个对角线方向的任何一个上具有起始“平方”偏移量,具体取决于初始方向旅行。这可能会导致某些有趣的模式。请参阅下面的两个偶数示例。
未遵循输入规范的输入(例如11q#s
)是未定义的,我完全希望程序能够正确发出信号。:)
输出量
输出是通过与语言等效的STDOUT的ASCII可打印输出,具有以下规范:
- (每次递归的)起始“平方”必须标有at-符号
@
。 - 最后的“正方形”必须标有“&”号
&
。在多次递归的情况下,仅应标记最后一个“正方形”&
。 - 螺旋路径的角需要使用来“指向”行进方向
< > v ^
。 - 垂直行程需要用管道来绘制
|
。 - 水平行程需要用破折号绘制
-
。 - 被以后的递归覆盖的“平方”应该显示最近的行进方向。这将导致“较新”的递归似乎在“较旧”的递归之上。请参见
4rc3
下面的示例。 - 最后一个换行符是可以的,前导空格可能是必须的,因此可以允许,但不允许尾随空格。
- 如果您使用转义序列来绘制将输入到STDOUT的ASCII艺术字,那么我不会停靠您,但是我会让您感到非常失望。(如果使用它们,您仍然有资格获得赏金)
例子
2d4
=直径2,开始时顺时针向下旋转4次递归
&@@@@
^<<<<
在此示例中,图形从右上角开始@
,向下一幅,向左一幅,向上一幅。至此,我们已经完成了该2d
部分,然后开始第二次递归,所以我们有了另一个@
,向下一个,向左一个,向上一个;然后是第三次递归;然后第四,最后是我们的&
。
4rc3
=直径4,从逆时针向右开始,进行3次递归
&--<
v-<|
|@^|<
>--^|
|@^|<
>--^|
|@^|
>--^
在此示例中,图形从底部开始@
,向右上移,向上向上,向上旋转,直到到达中间@
并完成该4rc
部分。然后再重复两次以获得请求的全部3个递归。注意,4rc1
这只是本示例的左上4x4块。
7u1
=直径7,从顺时针向上旋转1次递归开始(请注意,与简介相同)
&>----v
||>--v|
|||>v||
|||@|||
||^-<||
|^---<|
^-----<
获胜与限制
这是Code Golf,因此以字节为单位的最小答案将获胜。提交内容应采用程序/功能/ CJam代码块等的常规形式。适用标准漏洞限制。封闭路线上的专业驾驶员。如果刺激仍然存在,请停止使用并咨询医生。