你面临的挑战是把输入的文本转换成大脑激活的代码,这样才能输出文本。
大脑-Flak有两个堆栈,称为“左”和“右”。活动堆栈从左侧开始。如果弹出一个空堆栈,它将返回0。就这样。没有其他变数。当程序启动时,每个命令行参数都被推入活动堆栈。
在一个大脑-弗莱克程序中唯一有效的字符是()[]{}<>
,它们必须始终保持平衡.有两种类型的函数:Nilad和Monads。nilad是一个接受0参数的函数。以下是所有的小插曲:
()
的计算值为1。[]
计算为当前堆栈的高度。{}
弹出活动堆栈。计算结果为弹出值。<>
切换活动堆栈。计算为零。当对它们进行评估时,它们将连接在一起。因此,如果在活动堆栈的顶部有一个'3‘,那么这个片段:
()(){}
将评估为1 + 1 + active.pop()
,而评估值为5。
单子们采取了一个论点,一大块大脑-Flak代码。下面是所有的单子:
(n)
将'n‘推到活动堆栈上。[n]
计算为负'n‘{foo}
虽然零不在堆栈的顶部,但请执行foo。<foo>
执行foo,但将其计算为0。这些函数还将返回它们内部的值,因此
(()()())
会推3,但是
((()()()))
会推三次。
{}
将计算为所有运行的总和。因此,如果我们在堆栈的顶部有'3‘和'4’:
{{}}
会被评估为7。
当程序完成执行时,在活动堆栈上留下的每个值都会被打印出来,中间有一个换行符。忽略另一个堆栈上的值。
-A
)。
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
The meaning of brain-flak is to flak your brain with pain.
`1234567890-=qwertyuiop[]\asdfghjkl;'zxcvbnm,./~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?
To be, or not to be, that is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous fortune,
Or to take arms against a sea of troubles
And by opposing end them. To die-to sleep,
No more; and by a sleep to say we die
<your brain-flak code here>
The fitness pacer test is a multi stage test. Avacado Avacado Avacadad Avacadad carrot.bat carrot.jar carrot.carrot Quack Quack Quack Quack Quack Quack Quack Quack Quack downgoat doawngoat down down gaot
This challenge came from a online program that turned text into brain-fuck. However brain-fuck has limitations and it is not nearly as cool as brain-flak. I really am looking forward to cool programs :) I am glad you took the time to read this and look forward to seeing your answer.
要想获胜,你必须给出每个测试用例所给出的大脑攻击代码的总长度,测试用例将在发布日期后1-2周内发布。最短的总长度获胜。
这不是密码-高尔夫,您的代码长度不会以任何方式影响您的最终得分。制作干净可读的代码是值得赞赏的。谢谢!
发布于 2018-03-09 01:18:04
{({}<>)<>}<>{((((()()()()()){}){}){}<>)<>{(((((()()()()()){}){}){}<>)())<>({}[()])}<>((((()()()()()){}){}){}())<>{}}<>{({}<>)<>}<>
<your brain-flak code here>
:5045字节/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
/*
* 提示:该行代码过长,系统自动注释不进行高亮。一键复制会移除系统注释
* * (()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())(()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()())
*/
*/
发布于 2018-03-09 01:46:44
cache = {}
def generate_number(num, height, level = 0, output = False): # Idea to use Stack Height inspired by Jo King
if output: print(" " * level + str(num) + " " + str(height))
if (num, height) in cache: return cache[(num, height)]
if num == 0: return ""
if num < 0: return "[" + generate_number(-num, height, level + 1, output) + "]"
if num == height: return "[]"
value = min((["[]" + generate_number(num - height, height, level + 1, output)] if height > num * 2 and abs(num - height) < num else []) + ["()" + generate_number(num - 1, height, level + 1, output)] + ["(%s)%s{}" % (generate_number(num // i, height, level + 1, output), "({})" * (i - 2)) for i in range(2, num) if num % i == 0], key = len)
cache[(num, height)] = value
return value
generate_number(256, 0, 0, False)
def generate_string(array):
string = ""
last = 0
for height, num in enumerate(array):
string = min("(" + string + generate_number(num - last, height) + ")", "<" + string + ">" + "(" + generate_number(num, height) + ")", key = len)
last = num
return string
a = lambda s: generate_string(list(map(ord, s)))
i = sys.stdin.read()
j = i[::-1]
print(min(a(j), a(i) + "{({}<>)<>}<>", key = len))
第一个低于1000的<your brain-flak code here>
:D
<((((((<(((<((((<((((<((((((()(()(()(()()()){}){}){}){})(()((()()[]){}){})({}){})()((()[]){}){})[()(([]){}){}])()()())>((()([])({}){}){})()((()(()()[]){}){}){})[()])()()()[])[()()()[]])>(()()([])({}){})(()(()[]){})({}){})[(()()()()()){}])()(()()()()()){})[(()()()){}])>(([])({}){})()(([]){}){})[()()()()()])[(()()()()){}])>((([])({}){}){})[((()()()()){}){}])[(()[])({}){}])()(()()()()()[])({}){})()()())[(()()()){}])(()()()()()){})>((()()()()[]){})
(本为<your brain-flak code here>
827 )
发布于 2018-07-03 02:33:09
For each character (main loop)
(([])<{({}[()]<
Get the difference between the top two characters
(({}<>)<>[({})]<><({}<>)>)
Push an open paren on the other stack
<>(((((()()){}()){}){}){})
Retrieve difference
(<>{}<>)
Greater than zero
([(({})[(())])](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}
If
{{}
While non-zero
({
Add value if not 1
<(({})[()])>{()(<{}>)}{}
<
Divmod 2
({}(())(<()>)){({}[()]<({}([{}]()))>)}{}({}[({})])
Hold the div
({}<
Push the mod part
{({}[()]<
((((((()()){}()){}){}){})())
>)}{}
Put div down
>)
Open paren if div non-zero
(({}))
{(<({}<{}
(((((()()){}()){}){}){})
>)>)}{}
Less than 4
([([({})[()()()()](())])](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}
If
{{}
Make that many 1s
{({}[()]<
((((((()()){}()){}){}){})())
>)}{}
End if
((<()>))}{}
End loop puting number of times run on the stack
>}{})
For each close push and pop
{({}[()]<
((((()()()()()){}){}){}())(((((((()()()()()){}){}){}())){}{})()())
>)}{}
End if
((<()>))}{}
Less than zero
([([({})(())])](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}
If
{{}
([{}]<
Push open bracket
((((((()()){}()){}()){}){}()){}())
>)
While non-zero
({
Add value if not 1
<(({})[()])>{()(<{}>)}{}
<
Divmod 2
({}(())(<()>)){({}[()]<({}([{}]()))>)}{}({}[({})])
Hold the div
({}<
Push the mod part
{({}[()]<
((((((()()){}()){}){}){})())
>)}{}
Put div down
>)
Open paren if div non-zero
(({}))
{(<({}<{}
(((((()()){}()){}){}){})
>)>)}{}
Less than 4
([([({})[()()()()](())])](<>)){({}())<>}{}{((<{}>))<>{}}{}<>{}
If
{{}
Make that many 1s
{({}[()]<
((((((()()){}()){}){}){})())
>)}{}
End if
((<()>))}{}
End loop puting number of times run on the stack
>}{})
For each close push and pop
{({}[()]<
((((()()()()()){}){}){}())(((((((()()()()()){}){}){}())){}{})()())
>)}{}
Push close bracket
((((((()()){}()){}()){}()){}){}())
Endif
((<()>))}{}{}
Remove top character
<>{}
End of main loop
>)}{}{}
Close the open parens
<>>){({}[()]<(((((()()){}()){}){}){}())>)}{}
Reverse code
([]){({}[()]<({}<>)<>>)}{}<>
<your brain-flak code here>
,582字节:([()((()(()(()()()){}){}){}){}]((()(()()){}){}([(()()()){}](()(()){}((()(((()(()()){}){}){}){}){}([(()((((()()){}){}){}){}){}]([(((()()){}){}){}](()(((()()){}){}){}([((()()){}){}]([()(()()){}](()(((((()()){}){}){}){}){}([()(((()(()()()){}){}){}){}]([(()()()){}](()(()(()()){}){}([(()(()()){}){}](()(()((()((()()){}){}){}){}){}([()(()((((()()){}){}){}){}){}]([((()()()){}){}](()(()(()()){}){}([()](()((()(((()()){}){}){}){}){}([(((()((()()){}){}){}){}){}](()(()){}([()((()()()){}){}](()((()()()){}){}(()(()(()((()()){}){}){}){}((()(()(()(()()()){}){}){}){})))))))))))))))))))))))))))
https://codegolf.stackexchange.com/questions/157539
复制相似问题