脏,73 57 54字节
⇖'le'⇗≐∀⭦)Ẃ'nar'⇗{=]}⭨'i'=]'woody'‼␛['tinny'‼␛('PVC'‼␛
在线尝试!
解释:
对于类似的旧版本(停止打高尔夫球时会对其进行更新)
␛‼'CVP'⇨⇖'leap'⇗≡⊭◌⬅Ẃ'nar'⇗{=]}1ẁ'i'=]'woody'‼␛['tinny'‼␛
它的主体由以下组成:
⇖ put the input into the left stack
'leap' push the string "leap"
⇗ put that string into the right stack
≡ are the left and right stacks equal
⊭ logically negate
◌ skip next instruction if true
⬅ change direction to leftwards
如果我们最终向左走,那么我们有:
⇨⇖'leap'⇗≡⊭◌ does stuff to the stacks, but isn't relevant
'CVP' push the string "PVC" (reversed, because we're going left)
‼ print the string on the main stack
␛ exit the program (this should wrap into the other exit, but that isn't working yet)
否则,这将检查字符串是否以“ nar”中的任何一个开头:
Ẃ wipe the right stack
'nar' push the string "nar"
⇗ move string to right stack
{
= compare the top of the left and right stacks
] goto matching bracket if true
} consuming loop while the right stack is true
然后,我们检查第二个字母是否为“ i”:
1 push the number 1
ẁ drop ^ number of elements off of the left stack
'i' push "i"
= are the top of the left and middle stacks equal
] goto matching bracket if true
如果他们全部失败,我们就会遇到
'woody' push the string "woody"
‼ print the string on the main stack
␛ exit the program
如果我们最后跳了,我们会绕到
[ matching bracket for the goto
'tinny' push the string "tinny"
‼ print the string on the main stack
␛ exit the program