United Blocks of America
Tetris
Red, White, and Blue Edition
Tetris in QNX RTOS |
Don't be fooled, those blocks cleared immediately after I grabbed a screenshot. I just happen to have hands like lightning... only slightly less fast and destructive (cue the Nakadaka ipon ken karate hand strikes).
This is being developed for an Embedded Systems course I'm currently taking. This course's final project focuses on the design and development of an embedded software application--which, as you can see, is Tetris--in C using the QNX RTOS and implemented on an ATMEL AT91SAM9G45 microprocessor.
Development
This was developed in several stages. The first stage involved a GUI design and shape creation. The second stage entailed controlling shape movement and establishing bounds. The third stage required a redesign of the GUI (slightly) because our professor gave us the wrong initial dimensions... not too much of a change, but got to learn some more about the front end aspect. Additionally, we began to work on line clearing, shape rotation, and sound implementation. The next few sessions focused on the same.My teammate and I spent a *long* time scribbling on a white board to figure out how we could implement and keep track of the shapes. Once we figured out our plan, which was to essentially create a grid of panels that would be realized and unrealized as the shape moved, we got started coding.
We used a Shape struct to determine what values we'd need, but basically it came down to initial positioning, an indicator to let us know whether the shape was active, and a color. I was in charge of GUI creation because I find that sort of stuff fun. I created a striped panel to make it easier to figure out where the shape would land. The stripes reminded me of the flag and so eventually the design sort of evolved so that the flag ('murica!) would be its theme. My teammate was in charge of sound effects... giggling, we decided that the Star Spangled Banner would be fitting. She converted an MP3 to a WAV file and used some voodoo magic to make it play.
We successfully have lines clearing, music playing, a score being tracked (win and lose conditions), and shapes rotating and moving as they should... All that remains are out of bounds checking--code needed to be rewritten to account for a shape rotated near the edge--and implementing it all on the board. We'll connect the movement to the joystick next week and then hold a battle to find the greatest Tetris champion of all time (or at least lab time).
Things I Learned
I will admit that I learned a LOT from this lab. Mostly, I learned how to develop with limited resources. Although QNX does have standard documentation, there isn't a whole lot outside of their manual (Stack Overflow, you were sincerely missed). Aside from that, I learned the power of thinking and researching before developing. In the past, I have had a bad habit of jumping right into code. I will blame all of my years in retail and not being comfortable appearing to do nothing because in retail thinking doesn't usually count as "doing something."
Except that's completely wrong--both the way I used the meme and the message it's sending. Also, what's up with the way I worded that? *Ew* Anyway, I went in circles for a day simply because I was trying to reinvent the wheel. Don't do that, folks.
Anywho, I have to work on a security lab now. Off to VM world to learn about viruses. Thank goodness for snapshots, eh? Stay tuned...
I found this funny, so I'm making a note of this for myself. The lab initially called for using a button to toggle an auto and manual mode. "What is manual mode in Tetris?" you ask... IT'S NOT A REAL MODE. The professor wanted manual mode to disable to automated downward movements, of the piece to the bottom of the playing field, to allow the user to move it at their own pace. WHAT?! That's too easy. Jokingly, I told my teammate that I refused to implement a manual mode because "that's not how you play Tetris" and she said she would email the professor to ask if we could implement the game as the game is meant to be played. She decided to word her email in the same manner I relayed my concerns to her... "Krystal refuses to implement the game in this way because 'that is not how you play Tetris'. Can we implement it this way..." Fortunately, the professor knows me from previous courses and didn't take offense to the wording. In fact, he agreed with me!
In class, today, the professor was reviewing the requirements for the assignment and stated that two implementations would be accepted because "a student" had contacted him about the initial suggestion. I started chuckling and then he let the class know that I was that student. 😁 Being a good student goes a long way towards building rapport with your professors. My only suggestion, is to take your relationship with the professor into account and to assess whether your approach is the correct approach. In this case, the professor knows my personality and work ethic, and was not put off by my comment. Don't be afraid to speak up if you think things can be done differently!
Update
I found this funny, so I'm making a note of this for myself. The lab initially called for using a button to toggle an auto and manual mode. "What is manual mode in Tetris?" you ask... IT'S NOT A REAL MODE. The professor wanted manual mode to disable to automated downward movements, of the piece to the bottom of the playing field, to allow the user to move it at their own pace. WHAT?! That's too easy. Jokingly, I told my teammate that I refused to implement a manual mode because "that's not how you play Tetris" and she said she would email the professor to ask if we could implement the game as the game is meant to be played. She decided to word her email in the same manner I relayed my concerns to her... "Krystal refuses to implement the game in this way because 'that is not how you play Tetris'. Can we implement it this way..." Fortunately, the professor knows me from previous courses and didn't take offense to the wording. In fact, he agreed with me!
In class, today, the professor was reviewing the requirements for the assignment and stated that two implementations would be accepted because "a student" had contacted him about the initial suggestion. I started chuckling and then he let the class know that I was that student. 😁 Being a good student goes a long way towards building rapport with your professors. My only suggestion, is to take your relationship with the professor into account and to assess whether your approach is the correct approach. In this case, the professor knows my personality and work ethic, and was not put off by my comment. Don't be afraid to speak up if you think things can be done differently!
Comments
Post a Comment