Sixteen. Joy in Looking and Comprehending
Einstein said that joy in looking and comprehending is nature's most beautiful gift. So I'm inclined to be grateful to HashMap Labs for giving us this opportunity to see and comprehend more than we ever imagined, because it's been bringing me the most tremendous levels of joy as we become more and more comfortable with programming in Objective C and watch as our own capabilities unfold before us.
That may sound a bit poetic; granted, it's the emotional viewpoint, and when I tell you what the objective point is, it may take some explaining to bridge the gap. Today we returned for a bit to our bird Labyrinth game, which has been rechristened as "Bird Wars" by my talented namer programming partner Liam. The progress we made relied on one primary milestone: we established bluetooth connection between two devices using GKSession delegate methods, and got the game to the point where each device shows two birds, one controlled by you (the blue bird), and one controlled by your opponent (the red bird). We were pretty proud of ourselves.
After the break, during which we visited San Francisco's renowned mobile eatery Le Truc, we switched it up and started working with new pairs on a bejeweled-like game wherein you create a grid of blocks and try to make them disappear when the user creates or finds adjacent sets of same-colored blocks. Here was our main problem, starting out: we had to create a matrix or multi-dimensional array containing rows and columns, such that we could populate it with blocks who had their own class that allowed them to draw themselves with different colors to the screen. Strangely enough, our approach led us into a long adventure of logic trying to account for the positions of the blocks onscreen in the matrix.
I'm not going to lie, at first when Ned assigned this project I was a little skeptical about what its value was to us, but now I'm realizing that this process we are going through now with drawing instances of a class to the screen in a logical way is going to be immensely useful in the implementation of real-life designs.
Think about it, when you're making a web-app, it's easy enough to just create an unordered list or a container whose sub-elements are floated or positioned with margins, and after setting these styles on the container, you just run a for loop that fills it up. In iOS, we don't really have that flexibility that CSS provides you, so we have to do this sort of structured population programmatically, and now I'm starting to imagine exactly how we would do this using matrices or arrays that contain objects with CGRect properties. A CGRect is a struct representing a rectangle that may be a frame for a layer(a viewable object) on the screen, that contains a location and a width and height. We could increment the location values using a for loop and then allow a user to view a long collection by implementing the custom infinite scroll view that we learned about on Friday.
It's coming together; this is what's supposed to happen to us. We have been blowing through so many frameworks seeing so many different possibilities and features in iOS, and given a little time, they start to coalesce into new implementations and combinations that synthesize to be realistically useful on a greater scale. I'm dazed how excited I am. The countdown continues..