Dear Laurent,
Indeed, I agree that the issue stems from the construction of the alphabet in use. I am using the regular BinaryAlphabet.
I added two lines to the code (lines 54 and 78). In the outcome for line 54, you can see that the index returned for state 1 in the BinaryAlphabet instance is 3. I attach here a screenshot from the debugger that can explain why (the gap and unknown character states precede the actual alphabet states: 0,1). Consequently, you can see in line 78 that the index returned for the UserAlphabetInex1 instance is a double from a random memory cell.
I think that the issue might be solved by changing the order of states in BinaryAlphabet class s.t states 0 and 1 come before the states that represent gaps and unknown characters. If that is the case, I would be happy to change it and pull request.
Cheers,
Keren