A Brainfuck derivative
Let's define a simple Brainfuck-like programming language.
It has a two-directional tape of cells, and each cell holds one bit.
All bits are initially 0.
There is a moving head on the tape, initially at position 0.
A program is a string over the characters <>01!
, executed from left to right, with the following semantics:
<
moves the head one step to the left.>
moves the head one step to the right.0
puts 0 in the current cell.1
puts 1 in the current cell.!
flips the current cell.
There are no loops, so a program of n characters terminates after exactly n steps. A program is boring if all cells contain 0 at the end of execution, and exciting if there is at least one 1. Note that the size of the tape is not specified, so depending on the implementation, it may be two-way infinite or circular.
An example program
Consider the program 1>>>!<<<<0>!>>>!
.
On an infinite tape, execution proceeds as follows:
v
00000000000000 Put 1
v
00000100000000 Move by >>>
v
00000100000000 Flip
v
00000100100000 Move by <<<<
v
00000100100000 Put 0
v
00000100100000 Move by >
v
00000100100000 Flip
v
00000000100000 Move by >>>
v
00000000100000 Flip
v
00000000000000
At the end, all cells are 0, so this program is boring. Now, let's run the same program on a circular tape of length 4.
v
0000 Put 1
v
1000 Move by >>>
v
1000 Flip
v
1001 Move by <<<< (wrapping around at the edge)
v
1001 Put 0
v
1000 Move by > (wrapping back)
v
1000 Flip
v
0000 Move by >>>
v
0000 Flip
v
0001
This time, there is a cell with value 1, so the program is exciting! We see that whether a program is boring or exciting depends on the size of the tape.
The task
Your input is a non-empty string over <>01!
that represents a program in the above programming language.
An array of characters is also an acceptable input format.
The program is guaranteed to be boring when run on an infinite tape.
Your output shall be the list of tape lengths on which the program is exciting.
Note that you only need to test the program on tapes that are shorter than the program length.
The solution with the lowest byte count in each language is the winner. Standard code-golf rules apply.
Test cases
> : []
110 : []
1>0<! : [1]
0>>1>0<<>! : [1]
1>>>!<<<<0>!>>>! : [2, 4]
!<!<><<0>!>!<><1!>>0 : [2]
>>!>><>001>0<1!<<!>< : [1, 2, 3]
1!><<!<<<!!100><>>>! : [1, 3]
!!1>!>11!1>>0<1!0<!<1><!0<!<0> : [3, 4]
<><<>>!<!!<<<!0!!!><<>0>>>>!>> : [1, 2, 4]
0>>><!<1><<<0>!>>!<<!!00>!<>!0 : [3]
0000!!!!><1<><>>0<1><<><<>>!<< : []
!>!>!>!>!>1>!>0<!<!<!<0<!<0<!<!<!<1>!>0<<! : [1, 2, 5, 7]
<!!>!!><<1<>>>!0>>>0!<!>1!<1!!><<>><0<<!>><<!<<!>< : [1, 2, 4, 5]
!>1<<11<1>!>!1!>>>0!!>!><!!00<><<<0<<>0<<!<<<>>!!> : [1, 2, 3, 5, 6]
<>01!
? \$\endgroup\$