Your mistakes are on lines 36 and 38. There you call hanoi with only 4 arguments instead of the necessary 5, so you lose your code references. I'm willing to bet you missed the changes to the code between pages 8 and 9 since the author didn't highlight all his changes.