Brainfuck, 2766 바이트 (현재 유효하지 않음)
으니까. 나중에 언 골프 버전을 추가하겠습니다.
암호
>+<+[>[>[-]+<-]>[<+>>+[->,----------[<+>[>>>>>>>>>+<<<<<<<<<-]>>>>>>>>>[>+<<<<<<<<<<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]]<]<-]>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<[>[-]+<-]>[<+>>>>>>>>>>>>[<<<<<<<<<<+>>>>>>>>>>-]>[<<<<<<<<<<+>>>>>>>>>>-]<<<<<<<<+++++++[<+++++++++++>-]<[<<[>>>>>>>>>>+<<<<<<<+<<<-]>>>[<<<+>>>-]<<[>>>>>>>>>+<<<<<<<+>+<<<-]>>>[<<<+>>>-]<[>>>>>>>>+[<<<<<<<+>+>>>>>>-]<<<<<<[>>>>>>+<<<<<<-]+<[>-<[-]]>[>>>>>+<<<<<-]<<-]<-]++++++[>++++++++<-]>-[<<[>>>>>>>>>+<<<<<<<<+<-]>[<+>-]>-]<<<[-]>[-]+++++[<+++++>-]<[>>>>>>>>>>>+[<<<<<<<<<<+>+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]+<[>-<[-]]>[>>>>>>>>+<<<<<<<<-]<<-]++++++[>>>>>>>>>>+++++++++<<<<<<<<<<-]>>>>>>>>>>[<<+<<<<<<<<+>>>>>>>>>>-]<<<<<<<<<<[>>>>>>>>>>+<<<<<<<<<<-]>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]++++++++++++++++++++<<[<<<+>>>-]>>[<<<<<<<<+>+<<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>>[>>[<+<<<+>>>>-]<<<<[>>>>+<<<<-]+>>>[<<->>>-<<<<->>>[-]]<<<[>>[-]+<<-]>>-]>>[>>>-<<<[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[-]<<<-<->>-]>>>>>>>>>>>>>>>>[<<<<<<<<<<<<<<<<<+>>>>>>>>>>>>>>>>>-]<<<<<<<<<<<<<<<<<[>[-]+<-]>[<+>>+++++++++++[>+++++++>++++++++++>+++++++++>+++>++++<<<<<-]>-.>+.+++++++.>++.<---.>>-.<<------.>.>.<<+.+.+++++.>>>++...[-]<[-]<[-]<[-]<[-]<++++++++++.[-]>>>>>>>[-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>->[-]<[>+<-][-]>[<+<<<<<<<+>>>>>>>>-]<<<<<<<<[>>>>>>>>+<<<<<<<<-]>>>>>>>>>[-]<<[<<<<<<+>>>>>>-]->>[<<<<<<<<-<+>>>>>>>>>-]<<<<<<<<<[>>>>>>>>>+<<<<<<<<<-]>[>>>>>>+<<<<<<[-]]<->>>>>>>[<<<<<<<->>>>>>>-]<<<<<<<[>>>>>>>+<<<<<<<-]>>>>>>>[>>>>>>>+<<<<<<<<<<<<<<<<->>>>>>>>>[-]]<<<<<<<<-]<[>[-]+<-]>[<+>>++++++[>++++++++++<-]>.-------------.++++.<<<<->>-]<<]
의사 코드
loop
get a random byte
until random byte is >2 and <21
point to byte
[
output "Loves me..."
decrease byte by 1
if byte is 0
output "<3"
exit
eif
output "Loves me not..."
decrease byte by 1
]
output "</3"
견본
실행되면 프로그램은 입력을 기다리는 대화식 세션으로 들어갑니다. 입력은 숫자 여야합니다. 이 숫자는 시드로 사용됩니다.
시드 : 1 (임의의 숫자는 5이며 218,168,042 개의 작업이 필요함)
1
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
<3
시드 : 3 (임의의 숫자는 20이며 463,253,048 개의 작업이 수행됨)
3
Loves me...
Loves me not...
(...)
Loves me...
Loves me not...
</3
결과를 계산하는 6
데 2,105,900,375
반복 이 필요하기 때문에으로 시드하지 않는 것이 좋습니다 . :).
컴파일 / 실행
이를 위해서는 빠른 통역사가 필요합니다. 테스트 한 온라인 통역사는 실행 속도를 처리 할 수 없습니다. ips (초당 반복)는보다 커야 100,000,000
합니다. 그래서 다른 해결책을 생각해 냈습니다.
이것은 Brainfuck로 작성된 Brainfuck to C 컴파일러입니다. 온라인 인터프리터를 사용하여 코드를 순수 C로 변환 할 수 있습니다 . brainfuck.tk를 사용하는 것이 좋습니다 . stdin 입력에 내 코드를 붙여 넣고 코드 입력 에이 코드를 붙여 넣으십시오.
+++[>+++++<-]>>+<[>>++++>++>+++++>+++++>+>>+<++[++<]>---]>++++.>>>.+++++.>------.<--.+++++++++.>+.+.<<<<---.[>]<<.<<<.-------.>++++.<+++++.+.>-----.>+.<++++.>>++.>-----.<<<-----.+++++.-------.<--.<<<.>>>.<<+.>------.-..--.+++.-----<++.<--[>+<-]>>>>>--.--.<++++.>>-.<<<.>>>--.>.<<<<-----.>----.++++++++.----<+.+++++++++>>--.+.++<<<<.[>]<.>>,[>>+++[<+++++++>-]<[<[-[-<]]>>[>]<-]<[<+++++>-[<+++>-[<-->-[<+++>-[<++++[>[->>]<[>>]<<-]>[<+++>-[<--->-[<++++>-[<+++[>[-[-[-[->>]]]]<[>>]<<-]>[<+>-[<->-[<++>-[<[-]>-]]]]]]]]]]]]]<[-[-[>+<-]>]<[<<<<.>+++.+.+++.-------.>---.++.<.>-.++<<<<.[>]>>>>>>>>>]<[[<]>++.--[>]>>>>>>>>]<[<<++..-->>>>>>]<[<<..>>>>>]<[<<..-.+>>>>]<[<<++..---.+>>>]<[<<<.>>.>>>>>]<[<<<<-----.+++++>.----.+++.+>---.<<<-.[>]>]<[<<<<.-----.>++++.<++.+++>----.>---.<<<.-[>]]<[<<<<<----.>>.<<.+++++.>>>+.++>.>>]<.>]>,]<<<<<.<+.>++++.<----.>>---.<<<-.>>>+.>.>.[<]>++.[>]<.>[.---->.---,....]
소스를 다운로드하고 컴파일하십시오.
gcc.exe -c main.c -o main.o
gcc.exe main.o -o loveme.exe
온라인으로 C 코드 사본을 온라인으로 실행할 수도 있습니다 . 코딩 접지 .
최적화
아직해야 할 일이 있지만 셀 재사용이 거의 최적입니다.
비고
단어 나 구를 씨앗으로 사용할 수 있습니다.
Programming Puzzles & Code Golf
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
Loves me not...
Loves me...
<3