Hawaii iOS Developer Meetup – Session 7

We programmed Tetris yesterday at the meetup. I was surprised at how long it took to code up Tetris before the meetup. I used a single dimensional array to store the game piece and the game board. Bad move. Translating the index of an array to a differently sized array was a nightmare. An hour before the meetup I recoded Tetris with multidimensional arrays — Instant coordinate system.

There’s a technique Hemingway used when he wrote novels and short stories. He’d write until he caught a good tailwind, then, just as abruptly as he started, he would stop in the middle of writing.

Halfway through writing, his brain wouldn’t have the chance to fully express what it wanted to — no closure. This meant that his brain would continue to sift and sort his thoughts until the next day when he would dive into writing with gusto to finish what he started writing the day before.

I suspected the same effect exists in coding.

Stopping in the middle of implementing a function might not be the best place to stop. So I stopped when the game functioned well enough but contained a visual bug.

The bug gave us an opportunity to talk about Swift on a deeper level without being too invested in setting up a new project to have something specific to talk about.

If you’re interested in compiling, testing the code yourself, and checking out the bug, here’s a link to the repo.

This is a cool bug. It’s giving me ideas about other games that would benefit from this kind of visual oddity. Kind of like glitch art. The piece is placed on the screen then “melts” down the page. It’s kind of cool. How would you fix it?

We’ll be tackling piece rotation and scoring next week Thursday at the Hawaii iOS Developer Meetup. Please RSVP if you’re interested in attending.

Advertisements

Author: David Neely

Professional Software Developer. Technology and Web Coordinator at the University of Hawaii's Manoa Career Center.