Today’s exercise was Space Age. You calculate your age based on the year length for each planet in the solar system (orbital periods are given). For being such a simple exercise it sure took a while. That was largely due to unspoken requirements.

For instance pass a planet not on the list, you have to throw a specific error message. The orbital periods in the text use planets with title-case, but the tests use lower-case. I am sure that the test system could compare numbers with precision to a given number of digits, but instead it requires we have exactly two places after the decimal. Of course Javascript’s round function or fround function won’t do that so you have to use toFixed() and then change it from a string back into a number or scale the number by 100 then divide by 100 after rounding (my choice). Oh, and someone needs to tell me why key in Object.Keys(dictionary) doesn’t work, but key in dictionary does.

Hey, look! I got an award for viewing community solutions on the Javascript track.

I got up through Chapter 6 in “Game Boy Coding Adventure“. Already there are some things out of date between the current version hardware.inc and the one used in the book. _VRAM8000 was deprecated in his version and has been removed in mine (I ended up defining my own constant). The code for the vblank check failed to compile because SCRN_Y is not defined. Looking at the .inc file, I replaced it with LY_VBLANK which I think is correct (they are both a constant of 144). Anyway, the sample code still doesn’t do anything but you can inspect the video memory and see that I have loaded his sample files.