Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- push input into cell 0
- ,
- copy from cell 0 into cell 1 and 2 then move from 2 to 0
- [->+>+<<]>>[<<+>>-]>
- push 10 into cell 3
- ++++++++++
- push 10 into cell 4 and 5
- [>++++++++++[>++++++++++
- push 10 into cell 6 and 7 and multiply giving 100000 in cell 7
- [>++++++++++[>++++++++++<-]<-]<-]<-]
- move data from cell 7 into cell 3
- >>>>[<<<<+>>>>-]
- point to cell 3
- <<<<
- copy data from cell 3 to 4 and 5 then move from 5 to 3
- [->+>+<<]>>[<<+>>-]
- reserve variable space
- >>+>>>>>>>>>>
- fill cell 20 through 26 with 1s and reserve a 0 at cell 27 for {ref}
- >>>+>+>+>+>+>+>+>>
- push 6 into cell 28 which represents the current power iteration
- ++++++
- start main loop
- [
- point to cell 14 and set cell 14 aka baseflag to 1
- <<<<<<<<<<<<<<[-]+
- start position loop
- [
- point to cell 1 aka v1{2}
- <<<<<<<<<<<<<
- copy v1{2} to cell 9 aka v1c
- [->>>>>>>>+<<<<<<<<]
- point to cell 4 aka v2{2}
- >>>
- copy from v2{2} to cell 10 aka v2c
- [->>>>>>+<<<<<<]
- copy v2{1} to v2{2} and cell 5 then move from cell 5 to v2{1}
- <[->+>+<<]>>[<<+>>-]
- point to cell 9
- >>>>
- if v1c is nonzero enter loop
- [
- if both v1c and v2c are nonzero subtract 1 from v1c and v2c and add 1
- to cell 12 then move then point to cell 11
- >[-<->>>+<]
- move the pointer back one cell pointing to cell 9 if cell 10 was nonzero
- and pointing to cell 8 otherwise
- <<
- ]
- move the pointer back one cell and look for a 1 signaling that the pointer
- is in cell 7 rather than 8 and if so move it ahead to 8 to resynch
- <[>]
- move what's left from v1c to v1{2}
- >[-<<<<<<<<+>>>>>>>>]
- clear v2c
- >[-]
- add 1 to cell 13 aka basebuff which represents the current position tally
- then point to divvbuff
- >>>+<
- subtract divbuff from v2{2}
- [-<<<<<<<<->>>>>>>>]
- point to divbuff
- <<<<<<<<
- if v2{2} isn't empty subtract 1 from basebuff and clear v2{2} and set baseflag to 0
- [[-]>>>>>>>>>->-<<<<<<<<<<]
- copy v2{1} to v2{2}
- <[->+>+<<]>>[<<+>>-]
- if base flag is 0 end loop
- >>>>>>>>>
- end position loop
- ]
- move basebuff to cell 15 aka basebuffr and cell 16 aka basebuffr2
- <[->>+>+<<<]>>
- add 1 to basebuffr
- +
- [
- subtract 1 from basebuffr and point to cell 26
- ->>>>>>>>>>>
- from cell 26 search back to the first empty memory cell which would be
- cell 19 aka r2 on the first iteration and then add 1 to the cell behind it
- being r1 on the first iteration
- [<]<+
- move 2 cells ahead of r1 on the first iteration and search ahead to the
- first empty cell which will be cell 27 aka {ref} and then point back to
- cell 15 aka basebuffr
- >>[>]<<<<<<<<<<<<
- ]
- point back to cell 26 and search back to find the first empty memory cell
- being r2 on the first iteration and empty the cell infront of it
- >>>>>>>>>>>[<]>[-]
- point to the cell ahead of the recently emptied cell and search forward
- for the next empty cell which would be {ref}
- >[>]
- point to cell 16 aka basebuffr2
- <<<<<<<<<<<
- [
- if cell 16 isn't empty then move to v2{2} and clear it
- -<<<<<<<<<<<<[-]
- copy v2{1} to v2{2} and point to v2{2}
- <[->+>+<<]>>[<<+>>-]<
- add the contents of v2{2} to cell 17 aka v1neg
- [->>>>>>>>>>>>>+<<<<<<<<<<<<<]
- repeat until basebuffr2 is empty
- >>>>>>>>>>>>
- end loop and point to cell 17
- ]>
- subtract v1neg from v1{1}
- [-<<<<<<<<<<<<<<<<<->>>>>>>>>>>>>>>>>]
- clear v1{2}
- <<<<<<<<<<<<<<<<[-]
- copy v1{1} to v1{2}
- <[->+>+<<]>>[<<+>>-]>>
- subtract 1 from v2{1}
- <-
- if v2{1} isn't empty then start the loop
- [
- add 1 back to v2{2} and divide it by 10
- +>[-]<[>>++++++++++[-<<->>]<+<]
- ]
- copy v2{1} to v2{2}
- >[->+<<+>]>[-<+>]
- subtract 1 from cell 28
- >>>>>>>>>>>>>>>>>>>>>>>-
- ]
- point to cell 16 and empty
- <<<<<<<<<<<<[-]
- multiply 6 by 8 into cell 17 and subtract by 1
- ++++++[->++++++++<]>-
- add 47 to r1 through r6
- [->+>+>+>+>+>+<<<<<<]
- print r1 through r6
- >.>.>.>.>.>.
- clear all variables and point back to cell 0
- [-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]<[-]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement