Project 11>Pong>VM Emulator runtime error: Illegal Rectangle Coordinates

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Project 11>Pong>VM Emulator runtime error: Illegal Rectangle Coordinates

johnnyFive
I've successfully completed and verified every project in Chapters 1 through 10 and all of 11 except for the Pong program.  (The other 5 programs, Seven, ConvertToBin, Square, Average, and ComplexArrays all work as intended with my code writer).  Pong loads fine in the VM emulator and the the bat, ball, the line at the bottom, and the word "Score: 0" appears at the bottom left, but after running for about one second with the bat and the ball both moving on screen to the right for a bit, the program stops, the bat disappears from the screen (the ball still shows but is frozen) and a error message pops up "Program Halted: Illegal Rectangle Coordinates"  At the bottom left of the screen, it now read "Score: 0ERR9"  

I thought if I got the other 5 programs to work, the Pong program should work too no?  Cause once you get through Average successfully, I would think one's code generator is now verified complete and working.  I guess not haha.  Any help in how to debug this would be appreciated!  The generated VM code is so long, I just don't know where to start.
Reply | Threaded
Open this post in threaded view
|

Re: Project 11>Pong>VM Emulator runtime error: Illegal Rectangle Coordinates

johnnyFive
Ok, I solved my own problem.  I thought I'd update this thread to say how in case it helps someone.  What I did was I looked up on Github some solutions by other people. I downloaded their Pong VM files from Chapter 11 and I ran them on my computer in the Vm emulator to make sure they ran properly (to make sure the game worked with their code).  Then I pasted my VM code in excel and pasted their vm code next to mine and ran a formula to show when any two rows differed. Using this method I figured out that when my code was compiling a method, it didn't make a special case to start the argument index from 1 (instead of 0 like it is for functions and constructors).  I guess this error didn't prevent Square from running somehow.  Anyway, I'm happy and off to Chapter 12!  

If the authors of the book read this forum, I want to say Bravo!  This is one of the best courses, if not the best, I've ever taken. And the 2nd edition book is written so perfectly clearly.