Example Project Proposal for Tetris Game

Using the game Tetris, here is an example project proposal including the types of justifications we expect for each of the core concepts. core concepts used to create it. Note, this is one example of how you could break this game down and is not the only correct way to do so.

xkcd tetris

What game are you planning to implement? If it is a game of your own design, or not especially well-known, provide a 2-3 sentence description of the game.

We are going to implement Tetris.

What classes and interfaces do you plan to create? How will the different components of your game (the model, the GUI, etc.) interact?

We will create a Piece interface with concrete subclasses for each of the differen shapes (L, S, J, etc.). In addition, we will have a Board class that stores a 2-D array which represents the board. The board will also contain the pieces that are currently on the board, and be responsible for clearing them. There will be a function in Board which allows it to be drawn as a JComponent in the GUI.

What do you think will be the most challenging thing to implement?

I think Tetris piece rotations will probably be the most challenging, because they require a lot of checking to see whether a particular rotation is allowed given the location of the piece and the pieces around it.

  1. Core Concept 1:2D Array

    What specific feature of your game will be implemented using this concept?

    A 2D Array makes sense to represent the tetris board as a grid. It will allow search to be implemented easily because we can search for completed rows using the inner arrays and the outer array holds each of the rows.

    Why does it make sense to implement this feature with this concept? Justify why this is a non-trivial application of the concept in question.

    The 2-D array is an appropriate data structure because the board cannot be resized, and it is a regular grid with order and indices.

  2. Core Concept 2: File I/O

    What specific feature of your game will be implemented using this concept?

    We will keep track of a list of usernames, high scores, and display them to the user. Users can add their names to the high score list once the game ends, and they can click on a button to display the scores.

    Why does it make sense to implement this feature with this concept? Justify why this is a non-trivial application of the concept in question.

    We want the high scores list to be a list of all-time high scores, which means that the scores need to be saved to a file in order to persist across sessions of the game. We will then read that file into our game when it launches.

  3. Core Concept 3: Inheritance/Subtyping

    What specific feature of your game will be implemented using this concept?

    We will use an inheritance hierarchy to model the different types of shapes in the tetris game.

    Why does it make sense to implement this feature with this concept? Justify why this is a non-trivial application of the concept in question.

    Since there are many types of Pieces that all fall and can rotate, it makes sense to have an interface of Piece. It doesn't make sense to have Piece as a class opposed to an interface because you would never instantiate a generic Piece. Additionally, it makes sense to have each type of Piece (L, J, S, etc.) as a different class because their implementations of fall and rotate will be different from each other.

  4. Core Concept 4: Testable Component

    What specific feature of your game will be implemented using this concept?

    We chose to test the different implementations of rotate.

    Why does it make sense to implement this feature with this concept? Justify why this is a non-trivial application of the concept in question.

    This makes sense to test over any other component because this is the core of the game logic. If we don't have rotations correct, then checking that a row has been completed will not work. Additionally, displaying a falling and rotating piece will not work until rotations are implemented correctly. Some of the edge cases we have considered are rotating next to the wall and rotating next to a block of stationary pieces. Our test cases are not redundant because we are testing the rotate implementation for each Piece.