The student news site of The Harker School.

Harker Aquila

The student news site of The Harker School.

Harker Aquila

The student news site of The Harker School.

Harker Aquila

Winged Post
Newsletter

AP Computer Science students stack up skills in Tetris lab

A+Tetris+block+falls+down+the+grid%2C+inching+closer+to+the+collection+of+blocks+at+the+bottom.+There+were+seven+tetrads+in+total%2C+each+one+with+a+different+color+and+shape.
Ashley Mo
A Tetris block falls down the grid, inching closer to the collection of blocks at the bottom. There were seven tetrads in total, each one with a different color and shape.

AP Computer Science A and Data Structures students used Java to build the popular game Tetris on the BlueJ app and finished the project on April 11.

The lab began with students constructing “tetrads,” the game’s fundamental moving Tetris pieces that come in four blocks. Each tetrad has a different color and shape, and resembles a specific letter of the alphabet: I, T, O, L, J, S and Z.

Throughout the project, students experimented with interfaces, 2D arrays and loops. They created a grid capable of storing the tetrads by using an interface called MyBoundedGrid and setting the dimensions to twenty rows and ten columns. 

“I liked the Tetris project because it let me practice a lot of complex computer science skills like 2D arrays,” AP Computer Science A student Allison Hoang (10) said. “Instead of doing practice problems on these concepts, we were able to actually integrate them into the project and see them work.”

Programmers also coded a method called “translate” that tested if the tetrads could successfully move across the grid without obstruction from other blocks. The students used the translation method to move the tetrad blocks left, right and down using the arrow keys. The up arrow and space key, in particular, served different functions: to rotate the block and to drop the block to the bottom of the grid, respectively.

Ashley Mo

To finish the final exercise, students used boolean methods, which return either true or false, to determine if a row was fully filled with blocks. If a row was complete, it would disappear, and the blocks above that row would move down one.

“The purpose of the Tetris lab is to give more experience for students with working with multiple classes,” AP Computer Science A teacher Susan King said. “You have to have awareness of objects and methods and their interplay with each other as well as the return value. The complexity in Tetris gives students an experience that’s beyond what’s part of the AP curriculum.”

Students could incorporate additional features at the end of the project, like adding background music, changing the color of the grid and increasing the speed of the falling tetrads. AP Computer Science A students were required to complete at least two additional options to earn full credit, while AP Computer Science Data Structures students needed three more features along with a “game end” and “score display” option.

“Once you get to do additional features, students get excited about making the game more of their own,” King said. “Of all the assignments I do, it is Tetris that I hear back from college students or alumni the most, that they sometimes still even play it in college and it makes them feel good … that they did something as complex as Tetris.”

Leave a Comment
More to Discover
About the Contributor
Ashley Mo
Ashley Mo, Reporter
Ashley Mo (10) is a reporter for Harker Aquila, and this is her second year on staff. This year, Ashley hopes to write about stories both within and outside of the Harker community, form friendships on the journalism team and learn more about global news events. In her free time, she enjoys playing golf and listening to music.

Comments (0)

All Harker Aquila Picks Reader Picks Sort: Newest

Your email address will not be published. Required fields are marked *