Thanks! I think this could be improved further by changing the names of the destination and source flags (all four of them) to make things clearer.
While I'm at it, here's another bug: the last test of the program engine feeds a 5 into j, which breaks things because the counter doesn't expect it at all.
Also the final level doesn't have any tests but I'm sure you know that.
I want to add that besides some issues that have already been pointed out, it's a really nicely made tutorial. I went through all of it pretty fast because I already have a good background, but I would definitely point a beginner to it as a learning resource.