Skip to main content
Bounty Ended with 500 reputation awarded by lirtosiast
deleted 242 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26

Brainfuck, 587579 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[]]<]>[>>-]<[<]<<<[<]>>>>>>>[>[<]<[<<<<<[-[+>]<[<]<]>]>>>>>>>+>[<]<[<]<<<[<]>>>>>>>>[<]<-][+>]+[->+]>>>>+>[<-]<[
<[>+<>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[[<]>>>>>>>>>>>[<]<<<<<<[<]<-[+<]]]+[[+>]+[-<+]<<<+<[>-<<<]>[-<+<]]]<]
<+<]]]<]>[+>[>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>>]<]<+<[>]>[>>>[<<<<[
>>[<<<<[-<]<<<]>>>+>>>>[<<<<->>>>[>>>[-<]>>>>]]]>[<<<[<+[-->>]]>[-[.[-]]]>[<]>[<]]]>[<]>[<<++++++[
<++++++[>+++++++<>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->>>>>.[[-]<<<<]<<
]<<<<]<<<+>>>]>[<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>>>]<]]>>]>>>>>>>]<]]>>]<[>>>>>
]<[>>>>>>>]+[>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[>>-]<[<]<<<[<]
                >>>>>>><<
                [<<<[-]<[<]<<<[<]
                  >[<]>>>>>>>>[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]+[->+]
                > >>>>>>+>[<>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]<<<<<<[<]
                <[<-[+<]]
              ][+>]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[-<]<<<
    ]
    >>>+>>>>
    [
      start right of end
      <<<<->>>>
      [>>>[-<]>>>>]
    ]
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online.Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

Brainfuck, 587 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[-<]<<<]>>>+>>>>[<<<<->>>>[>>>[-<]>>>>]]]>[<<<[<+[-->>]]>[-[.[-]]]>[<]>[<
<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->>>>>.[[-
]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>>>]<]]>>
]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[-<]<<<
    ]
    >>>+>>>>
    [
      start right of end
      <<<<->>>>
      [>>>[-<]>>>>]
    ]
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

Brainfuck, 579 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[>>-<<<<<[-]<[<]<<<[<]>>>>>>>>[<]<-[+>]+[->+]>>>>+>[<-]<[
>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<[<]<-[+>]+[-<+]<<<+<[>-<<<]>[-<+<]]]<]
>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>>>[<<<<[
-<]<<<]>>>+>>>>[<<<<->>>>[>>>[-<]>>>>]]]>[<<<[<+[-->>]]>[-[.[-]]]>[<]>[<<++++++[
>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->>>>>.[[-]<<<<]<<
<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>>>]<]]>>]<[>>>>>
>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                >>-<<
                <<<[-]<[<]<<<[<]
                >>>>>>>>[<]
                <-[+>]
                +[->+]
                >>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<[<]
              <-[+>]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[-<]<<<
    ]
    >>>+>>>>
    [
      start right of end
      <<<<->>>>
      [>>>[-<]>>>>]
    ]
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

deleted 120 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26

Brainfuck, 595587 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[<+>->>>>>>]<<<]+>[<>>[<<<<[-]<[<]<<<]>>>+>>>>[<<<<->>>>>>>[>>>[>>>>[>>>[-<]>>>>]<]>]>[<<<[<+[<]>>>>]]]>[<<<[<+[-->>]]>[-[.[-]]]]]>[<]>[<
]>[<]>[<<++++++[>+++++++<<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->
>>>>>>>>>.[[- 
]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>]>>>>>>>]<]]>>
>>]<]]>>]<[>>>>>>>]+[]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[<+>->>>>>>]<<<
    ]
    +>
    [
      start left of end
      <<<<<[-<]<<<
    ]
    <>>>+>>>>
    [
      start right of end
      <<<<->>>>>>>>>>>
      [>>>[-<]>>>>]
      <
    ]
    >
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online.Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

Brainfuck, 595 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[<+>->>>>>>]<<<]+>[<-]<[->>>>>>>[>>>[-<]>>>>]<]>]>[<<<[<+[-->>]]>[-[.[-]]
]>[<]>[<<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->
>>>>.[[-]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>
>>]<]]>>]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[<+>->>>>>>]<<<
    ]
    +>
    [
      start left of end
      <-
    ]
    <
    [
      start right of end
      ->>>>>>>
      [>>>[-<]>>>>]
      <
    ]
    >
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

Brainfuck, 587 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[-<]<<<]>>>+>>>>[<<<<->>>>[>>>[-<]>>>>]]]>[<<<[<+[-->>]]>[-[.[-]]]>[<]>[<
<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->>>>>.[[- 
]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>>>]<]]>>
]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[-<]<<<
    ]
    >>>+>>>>
    [
      start right of end
      <<<<->>>>
      [>>>[-<]>>>>]
    ]
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

deleted 20 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26

Brainfuck, 597595 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[<+>->>>>>>]<<<]+>[<-]<[->>>>>>>[>>>[-<]>>>>]<]>]>[<<<[<+[-->>]>[>>]]>[-[.[-]]]]]
<]>>[<]>[<<++++++[>+++++++<]>[<]>[<<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>
 ->>>>>>
>>>>.[[-]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>]>>>>>
>>>>]<]]>>]<[>>>>>>>]+[>>]<]]>>]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[<+>->>>>>>]<<<
    ]
    +>
    [
      start left of end
      <-
    ]
    <
    [
      start right of end
      ->>>>>>>
      [>>>[-<]>>>>]
      <
    ]
    >
  ]
  >
  [
    <<<
    [
      <+[-->>]
      >[-[.[-]]]
      <
    ]
    >>[<]>[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online.Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

Brainfuck, 597 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[<+>->>>>>>]<<<]+>[<-]<[->>>>>>>[>>>[-<]>>>>]<]>]>[<<<[<+[-->>]>[-[.[-]]]
<]>>[<]>[<<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>
 ->>>>>.[[-]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>
>>>>]<]]>>]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[<+>->>>>>>]<<<
    ]
    +>
    [
      start left of end
      <-
    ]
    <
    [
      start right of end
      ->>>>>>>
      [>>>[-<]>>>>]
      <
    ]
    >
  ]
  >
  [
    <<<
    [
      <+[-->>]
      >[-[.[-]]]
      <
    ]
    >>[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

Brainfuck, 595 bytes

,[<<+>>>>+<<[[<+>>+<-]++++++[>-------<-]>-[-[-[-[--------------[--[<+++++[>-----
-<-]>+[--[<<[-]>>-]]<]>[<<<[-]<[<]<<<[<]>>>>>>>[>[<]<[-[+>]<[<]<]>]>>>>>>>+>[<-]
<[>+<-<]>]<]>[<<<[-]-[<]>>>>>>>>>>>[<]<<<<<<<[>[<]<[-[+<]]]+[-<+]<<<+<[>-<<<]>[-
<+<]]]<]>[+>[-<]<[<<]<[-]>>]]<]+>[-[<-]<[>+>+<<-<]<[-]>+>]<<[>-]>[,>]<]<+<[>]>[>
>>[<<<<[<+>->>>>>>]<<<]+>[<-]<[->>>>>>>[>>>[-<]>>>>]<]>]>[<<<[<+[-->>]]>[-[.[-]]
]>[<]>[<<++++++[>+++++++<-]>+>>[<<.>>-]<<++>-[<.>-]+++[<+++++>-]+<<<<<<+>[<<[>->
>>>>.[[-]<<<<]<<<+>>>]>[->->>>>[-]]]<[->+[>>>>>]>>[<]<<<<<<<<[[-]<]>[++.[-]>>>>>
>>]<]]>>]<[>>>>>>>]+[-<<<<<[-]<<],]
,
[
  <<+>> >>+<<
  [
    [<+> >+<-]
    ++++++[>-------<-]
    >-
    [
      not plus
      -
      [
        not comma
        -
        [
          not minus
          -
          [
            not period
            --------------
            [
              not less than
              --
              [
                not greater than
                <+++++[>------<-]>+
                [
                  not open bracket
                  --
                  [
                    not close bracket
                    <<[-]>>-
                  ]
                ]
                <
              ]
              >
              [
                greater than
                <<<[-]<[<]<<<[<]
                >>>>>>>
                [
                  >[<]
                  <
                  [
                    -[+>]
                    <[<]<
                  ]
                  >
                ]
                > >>>>>>+>[<-]
                <[>+<-<]
                >
              ]
              <
            ]
            >
            [
              less than
              <<<[-]-[<]
              >>>> >>>>>>>[<]
              <<<<<<<
              [
                >[<]
                <[-[+<]]
              ]
              +[-<+]
              <<<+<[>-<<<]
              >[-<+<]
            ]
          ]
          <
        ]
        >
        [
          minus
          +>[-<]
          <[<<]
          <[-]>>
        ]
      ]
      <
    ]
    +>
    [
      plus
      -[<-]
      <[>+>+<<-<]
      <[-]>+>
    ]
    <<
    [
      comma or period or bracket
      >-
    ]
    >[,>]
    <
  ]
  comma or period or bracket or eof
  <+<
  [
    start and end same cell
    >
  ]
  >
  [
    >>>
    [
      <<<<[<+>->>>>>>]<<<
    ]
    +>
    [
      start left of end
      <-
    ]
    <
    [
      start right of end
      ->>>>>>>
      [>>>[-<]>>>>]
      <
    ]
    >
  ]
  >
  [
    <<<
    [
      <+[-->>]
    ]
    >[-[.[-]]]
    >[<]
    >
    [
      <<++++++[>+++++++<-]>+>>
      [<<.>>-]
      <<++>-[<.>-]
      +++[<+++++>-]
      +<<<<< <+>
      [
        <<
        [
          go left
          >->>>>>.
          [[-]<<<<]
          <<<+>>>
        ]
        >
        [
          toggle left right
          ->->>>>[-]
        ]
      ]
      <
      [
        toggle right left
        ->+[>>>>>]>>[<]
        <<<<<<<<
        [
          [-]<
        ]
        >
        [
          go right
          ++.[-]
          >>>>>>>
        ]
        <
      ]
    ]
    >>
  ]
  <[>>>>>>>]
  +[-<<<<<[-]<<]
  ,
]

Try it online. (If a simulated cell's absolute value gets close to 256, there will be overflow issues.)

deleted 26 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
added 75 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
deleted 2 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
deleted 5 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
deleted 28 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
deleted 30 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
added 138 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
deleted 16 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
deleted 53 characters in body
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading
Source Link
Mitch Schwartz
  • 5.9k
  • 1
  • 27
  • 26
Loading