First implementation:
name: cw
init: q0
accept: qAccept
// any strings starting with 0 will always never terminate
q0,0
q0,0,<
q0,_
q0,_,<
// strings starting with 1 may accept in certain situations
q0,1
q1,1,>
// keep reading 1s
q1,1
q1,1,>
// eventually read a 0
q1,0
q2,0,>
// then accept if there is another 1
// q2,1
// qAccept,1,>
// or reject
q2,1
qReject,1,>
New implementation:
name: cw
init: q0
accept: qAccept
// always accept any first digit
q0,0
q1,0,>
q0,1
q1,1,>
// then repeat 1s
q1,1
q1,1,>
// then check if we have a 0
q1,0
q2,0,>
// go back if it's another 0
q2,0
q1,0,<
// otherwise accept and reject
q2,1
qAccept,1,>