128 lines
3.3 KiB
Brainfuck
128 lines
3.3 KiB
Brainfuck
|
>
|
||
|
+>
|
||
|
+++++>
|
||
|
>+++++[<++++++>-]
|
||
|
>++++++++[<++++++++>-]
|
||
|
>>+>+>+[+>++[-<+++>]<<]>-[-<+<+>>]
|
||
|
|
||
|
|
||
|
>+>+>+++[+>+[-<++++>]<<]>>
|
||
|
>
|
||
|
>+++++++++[<+++++++++++++>-]
|
||
|
>+>+>+>+[++>[-<++++>]<<]>[-<+>]
|
||
|
++++[>++++<-]>[<++++++++>-]<+>
|
||
|
>+>+>+>+[++>+[-<+++>]<<]>[-<+>]
|
||
|
|
||
|
>
|
||
|
<<<<.>.
|
||
|
<<<<<<<<<<.<<....>.>>>.<<<<.>>>>>>>>>>>>>.<<<<<<<<<<<<<...
|
||
|
>>>>----------
|
||
|
<<.<<.>>.<<.>>>>>>.<<<<<<.>>.<<.>>>.>>>>>>>>>>...
|
||
|
<<<<<<<<<<<.<.>>>.<<<<.>>>>>.<<<<<.>>.<<.>>>.>>>>>>>>>>...
|
||
|
<<<<<<<<<<<
|
||
|
[
|
||
|
.>>>>>.>.>.>.<<<<<<<<<<.>>.<<.>>.<<...
|
||
|
>>>>>>>>>>>>>>[->>+>+<<<]>>>[-<<<+>>>]+<<<<<<<<<-----[->>>>>>>>+<<<<<<<<]>>>>>>>>+++[>-]>
|
||
|
[<<<<<<<<+<<[->>-<<]>>[-<<+>>]<+<[>>>>>>>>>+++++<<<<<<<<-]>
|
||
|
[>>>>>>>>-----<<<<<<<<->]>>>>>>>>->]
|
||
|
<<---[-<<<<<<<<+>>>>>>>>]
|
||
|
<[->+<<<<<<+>>>>>]>[-<+>]<<<<<<-----
|
||
|
[->>>>>>+>>+<<<<<<<<]>>>>>>>+
|
||
|
>--[<->[-]]
|
||
|
<[-<<++++++++++>>]
|
||
|
<[-<<<<<<+>>>>>>]
|
||
|
<<<<<<[->>>>>>+>>+<<<<<<<<]>>>>>>>+
|
||
|
>+++++++++++++++++++[<->[-]]
|
||
|
<[-<<---------->>]
|
||
|
<[-<<<<<<+>>>>>>]
|
||
|
start boundaries check
|
||
|
<<<<<<<<<[->>+>>>>>>>>+<<<<<<<<<<]>>[-<<+>>]
|
||
|
<[->+>>>>>>>>>>>>+<<<<<<<<<<<<<]>[-<+>]
|
||
|
>>>>>>>>+>>>>[->+>+<<]>[-<<<+>>>]
|
||
|
check left boundary
|
||
|
<<+<-------------[>-]>
|
||
|
|
||
|
[
|
||
|
-
|
||
|
copy ball_y to mem3 and paddle_left_y to mem4
|
||
|
<<<<<<<<<<[-<+>>>>>>>>>>+<<<<<<<<<]<[->+<]
|
||
|
<<<[->>>+>>>>>>>>>>>+<<<<<<<<<<<<<<]>>>[-<<<+>>>]
|
||
|
>>>>>>>>>>
|
||
|
if mem3 ge mem4
|
||
|
[->-[>]<<]< (mem3 ends up = mem4 minus men3)
|
||
|
[
|
||
|
then if mem3 ge 31
|
||
|
>>>>+++++[<++++++>-]<+
|
||
|
<[->-[>]<<]<
|
||
|
[then just clean up ->]<
|
||
|
[else set mem0=1 ><<+>-]>
|
||
|
]
|
||
|
>>[-]<<<[-]+<
|
||
|
if mem0 eq 1 (ball hit left paddle)
|
||
|
[
|
||
|
then change direction of the ball
|
||
|
<<++++++++++>>-
|
||
|
>-]>
|
||
|
|
||
|
[< else reset ball_y
|
||
|
>>[-]>>[-]<<<<
|
||
|
<<<<<<[-]<<[-]
|
||
|
+>+++[++>++[-<++++++>]<<]> 117
|
||
|
[->+>+<<]
|
||
|
<++++++++++[->++++<]>+>[-<+>] 158
|
||
|
|
||
|
request a random char (ff 03 01 01 ff 01)
|
||
|
>>.>++.>>[-]+..<<<.>--.
|
||
|
>>->[-]>+>[-]>+>[-]>+>>
|
||
|
read random char (mem6) and set mem1 and mem2 to (mem6 % 4) (in binary)
|
||
|
,[
|
||
|
-
|
||
|
<<<<
|
||
|
[-[<[-<->]<[->+<]+>>-->]>>[-]]<[<]>[-]<<++
|
||
|
>>+>>
|
||
|
]<<-<<-<<->>
|
||
|
set the ball (x and y) directions based on mem1 and mem2
|
||
|
[-<<<++++++++++>>>]<[-<<<++++++++++>>>]
|
||
|
>
|
||
|
]
|
||
|
>>>
|
||
|
]
|
||
|
<<[-]<<[-]<
|
||
|
|
||
|
>>>>>>>[-<<<<<<<+>>>>>>>]
|
||
|
<<<<<<+<-----------------------------------------------[>-]>
|
||
|
[<<<---------->>>->]<<[-]
|
||
|
>[-]>[-]>[-]
|
||
|
end boundaries check
|
||
|
<<<<<<<<<<<<<<<<<.>>>>>.>.>.>.<<<<<<<<<<.>>.<<.>>.>>>>>>>>>>>..<<<<<<<<<<<<<.
|
||
|
move right paddle (computer)
|
||
|
>>>>>>>>>>>>>>>>+<<[
|
||
|
<<<<<<<<<<<<.<.>>>.<<<<.>>>>>.<<<<<.>>.<<.>>>.<<<...
|
||
|
>>>>>>>>>>[-<+>>>>>>>>>+<<<<<<<<]<[->+<]
|
||
|
<<<<[->>>>+>>>>>>>>>>+<<<<<<<<<<<<<<]>>>>[-<<<<+>>>>]
|
||
|
>>>>>>>>>>>>+<<+++++++++++++++<[->-[>]<<]>>>
|
||
|
[-
|
||
|
<<<<<<<<<<<<<<<<----->>>>>>>>>>>>>>>
|
||
|
]>
|
||
|
[-
|
||
|
<<<<<<<<<<<<<<<<+++++>>>>>>>>>>>>>>>>
|
||
|
]<<[-]<[-]
|
||
|
<<<<<<<<<<<<<<<<.<.>>>.<<<<.>>>>>.<<<<<.>>.<<.>>>.>>>>>>>>>>...
|
||
|
>>>-<<[>>>+<<<-]
|
||
|
]>>>[<<<+>>>-]<[-]
|
||
|
move left paddle (user input)
|
||
|
<<<<<.>+.-<<<<<<<<<<<.
|
||
|
>>>>>>>>>>>>>>>,
|
||
|
[,>>+>+>+++[>[-<++++++>]<<]
|
||
|
>[-<<->>]<+<
|
||
|
[----[>-]>[>>+++++>>+<<<<->]<[-]]
|
||
|
>[>>>+++++>+<<<<->]<<[-]]
|
||
|
<<<<<.>.
|
||
|
>>>>>>>>>[<<<<<<<<<<<<<<<<<<<.<<.>>.<<.>>>>>>.<<<<<<.>>.<<.>>>.<<<...>>>>>>>>>>>>>>>>>>>>>[-]]
|
||
|
<<[-<<<<<<<<<<<<<->>>>>>>>>>>>+>]
|
||
|
>[-<<<<<<<<<<<<<<+>>>>>>>>>>>>+>>]
|
||
|
<<[<<<<<<<<<<<<<<<<.<<.>>.<<.>>>>>>.<<<<<<.>>.<<.>>>.>>>>>>>>>>...>>>>>[-]]
|
||
|
<<<<<<<<<<<<<<<<.<.>>>.<<<<.>>>>>.<<<<<.>>.<<.>>>.>>>>>>>>>>...
|
||
|
<<<<<<<<<<<
|
||
|
]
|