木炭,71字节
NβA‹β³²τA§o^τεA§XVτφA§XvτθF³«P↑⁵|_»↑⁵←I←×_⁵‖O→↙↙←←ε↙←^↖↓ε↓→φθφθφ¿⁼β³¹‖←
注意:由于字符串索引已损坏,因此该代码在发布时的最新提交中不起作用。但是,它应该从10月25 日开始在此版本中运行。它还可以在“ 在线试用”上的当前版本上成功运行。。
说明
木炭是为ASCII艺术设计的语言。输出被放到画布上,该画布在程序末尾打印。
设定
获取输入并计算面部特征:
Nβ Input number into beta
A‹β³²τ Assign beta<32 to tau for easy reuse
A§o^τε Assign appropriate eye character (selected via indexing into "o^") to epsilon
A§XVτφ Assign outside and middle mouth character to phi
A§Xvτθ Assign other mouth character to theta
画南瓜
F³« » Do this three times:
P↑⁵ Draw a 5-character line upward (using | by default); don't move the cursor
|_ Draw that string, rightward
在这个循环之后,我们有
| | |
| | |
| | |
| | |
|_|_|_
下一个:
↑⁵ Draw a 5-character line upward
←I Draw the stem leftward
←×_⁵ Draw 5 underscores leftward
‖O→ Reflect the canvas rightward, overlapping in the middle
结果:
_____I_____
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
|_|_|_|_|_|_|
画脸
我们将把脸朝右看,并在必要时稍后进行更改。
↙↙←←ε Move to the correct spot and draw the right eye (our right, pumpkin's left)
↙←^ Move to the correct spot and draw the nose
↖↓ε Move to the correct spot and draw the left eye
↓→φθφθφ Move to the correct spot and draw the mouth with alternating characters
结果(用于输入31
):
_____I_____
| | | | | | |
| | |^| |^| |
| | | |^| | |
| | |VvVvV| |
|_|_|_|_|_|_|
反映是否是万圣节:
¿⁼β³¹ If beta equals 31:
‖← Reflect canvas leftward
最终输出:
_____I_____
| | | | | | |
| |^| |^| | |
| | |^| | | |
| |VvVvV| | |
|_|_|_|_|_|_|
x^n>30
技巧让我感到困惑,但是当我弄清楚发生了什么时,我无耻地偷了它以改善答案。作为补偿,我还是给你一个支持。