Typing by hand is an underrated option. Inevitably there's gonna be transcription errors, so you'll have to correct them and in the process understand the code. Also, just take a moment at the end of a chapter to review the code and make sure it follows. I thought that it wasn't doing much either until I realized I actually understood what was going on!
After that, you could maybe port it to a different language. But doing that the first time around would be a little hard. Especially if you wanted to keep the code idiomatic to the language.
After that, you could maybe port it to a different language. But doing that the first time around would be a little hard. Especially if you wanted to keep the code idiomatic to the language.