100 Days of Code Day 48
Even more exercism exercises on the Javascript track. Today I did the following:
- Spiral Matrix – Feels similar to the rectangle tracing I did yesterday. Fill spaces in a square matrix in a spiral pattern of sequentially increasing numbers starting with 1. One community solution had the code turn when it hit a cell that was already filled, that was more elegant than my shrinking bounds approach.
- OCR Numbers – More substring matching than OCR.
- Relative distance – I thought this would be the distance between points, nope it is how far removed peoples family trees are. Distance 1 is parents, children and siblings. To get further distances include (previously not included) parents, children, and siblings of everyone in the previous set. Repeat as needed until you find no more relatives or the sets have each other in them.
- Saddle Points – find spot(s) in a grid where it is the tallest in the row but largest in the column.
I am stopping here because the next one is the forth subset and that might take a long time. No strange parsing library this time so it might be faster. Either way, I better have regex at the ready.
By the way, Javascript has now passed the Python track in percent completion (55.77% vs 51.02%)
On to “Gameboy Coding Adventure” Chapter 13. Lots of debugging in the first example. I forgot the section header for the update code. This caused the other section to swell by 40 bytes and the linker failed because the code overflowed space available. Then after I fixed that it didn’t animate. I eventually realized the book was saying we edited the main file which we haven’t touched in about 10 chapters. Once I fixed that I had the optimized parallax scroller again, but requiring a mbc5 bank switching chip if you wanted to make a real cartridge. I guess the debugging is helping me learn. Which is why I am typing it in so that I go through the code more, but it is still frustrating when things like that happen.
There is one more sample in Chapter 13, mbc_eram. This is pretty much the same except you control the parallax scrolling with the left and right buttons on the d-pad. You can also save the current state with the A button. If you saved the state the scroll values will be restored when the game is reloaded.
On to Chapter 14 – Interrupts tomorrow.
