This is a closed-ended project that provides you the opportunity to apply everything you have learned in CIS 110 to one of the options below. You will be responsible for choosing one of the four given problems (or coming up with your own), analyzing that problem to determine how to solve it, decomposing the functionality of your program to identify its class structure and the API for each class, and then implementing and testing your program. You will not be given any skeleton code for this project. You must write your own files and make the best design and data structure choices as you see fit.
You are not permitted to work with a partner on this project.
Start early and reach out if you have any questions or concerns.
You may be tempted to use code directly from the internet or use such code as a base template. Please do not do so. We are extremely adept at catching such cases and strict action will be taken.
In this assignment, you will implement 1 of 4 games below. Your project must use object-oriented design. If you implement your entire project as static, with no object instances, you will lose significant points. Each project has their own requirements enumerated at the end of their writeup.
You must pick one of these 4 options. Brickbreaker - implement the game Brickbreaker using mouse or keyboard controls. 2048 - implement 2048 game using keyboard controls. 6x6 Sudoku Solver - Implement an interactive Sudoku game. Minesweeper - a classic puzzle game where you have to be careful where you click! Implement the beginner difficulty of minesweeper. Tetris - implement a simplified version of the classic Tetris game with keyboard controls.
We encourage you to spend time thinking out the design of your game before you begin programming it. A well-thought out design would include a list of classes, the functionality corresponding to each class, the fields and methods contained in each class, and the functionality corresponding to each method.
If you spend the time creating a design, we encourage you to stop by office hours and talk over your design with a TA before you begin coding. If you choose to do this, you are welcome to use the conceptual queue to discuss your design.
In this project, you will implement an interactive 6x6 Sudoku game. You can practice solving strategies by playing here. Sudoku is a puzzle where a player must fill an nxn (typically 9) grid with numbers 1-n such that no single number appears twice in any row, column, or grid box. Typically, Sudoku puzzles are written such that they have 1 and only 1 solution. This means most Sudoku’s can be solved by deductive reasoning.
The input sudoku table will be passed as a text file. For example, this text file represents the Sudoku puzzle below. This file should be passed in via command line arguments. Each digit is used for a square that is filled in at the start, while a whitespace character ’ ‘ is used for an empty square. Your program should produce a meaningful error message if the input is incorrectly formatted (such as not 6x6 characters, using characters besides whitespace and digits 1-6, or an illegal grid, such as two 4s in the same row as a starting point.)
Note that in 6x6 Sudoku, the grid boxes are all 2 rows by 3 columns. A single digit cannot appear twice in a bolded box. Your program will be an interactive sudoku game with meaningful visual interactions and involve both the mouse and keyboard. It cannot simply be text based through the command line.
Players must be able to choose which square they want to provide input for and then be able to type in a number to put in that square.
If a player inputs a value which directly violates a rule (for example, there was already a 1 in the row and the player input another 1 in the same row), you should mark the contradictory values in red and highlight the region of the board causing an issue. For example, if there’s a conflict in the second row, you should highlight the second row and mark the problem values in red. If there’s a contradiction in both a row and a column, you should highlight both the row and the column, etc. When a player has filled in all the squares correctly, you should provide a “win” message.
In this project, you will implement the game, Brickbreaker. If you need a refresher or introduction to the game, you can play here.
Brickbreaker is a game in which a ball is initially launched from a platform and collides with bricks in the upper region of the game board. When the bricks have been hit a certain amount of times, they lose their strength completely, and disappear. The game (or a certain level) is complete when the ball knocks out all of the bricks. The game is lost when the ball falls to the ground (off-screen), missing the platform enough times that it no longer has any lives/attempts left.
For this option you will be implementing the highly addictive 2048 game. Here is a description of the game.
The best way to understand the game is to play it yourself. You can find an online version here.
Your game should have a 4x4 grid. Using WASD controls (W is up, A is left, D is right, S is down). Pressing in a direction moves all blocks in that direction. Example:
Like numbers can be “combined”. That is, if two numbers “crash” into each other, they combine to be the sum of the two numbers. For example, two “2” blocks would combine to be a “4”, and two “4” blocks would combine to be an “8”. Example:
There are two special cases worth considering, 3 elements in a row or column and four in a row or column. Example of 3 in a row:
Minesweeper is a classic puzzle game (which can be played here).
In the game, a single player tries to sweep a minefield to clear out every space that isn’t a mine. Each space is either blank,a numberspace, or a mine. The contents of each space are initially hidden. By clicking on a space, you reveal its contents.
A mine is a square that if you click on, you lose the game. You can avoid clicking on mine squares by using the hints provided by number spaces.
A number space indicates that there is a mine either left, right, up, down, or diagonal of a mine. Clicking on a number square reveals that square and that square only. Example, a 1 means there is 1 mine nearby. The maximum possible digit is 8, which would mean all 8 squares around the space are mines.
A blank space is like a numbered square where the number is zero. That is, there are no mines in any of the adjacent 8 spaces. If you click on a blank space, it reveals both itself and all adjacent squares. If any of the adjacent squares are blank, it should further reveal all adjacents squares. For example, in the below game, when I click on the bottom right corner, I got about a third of the board shown:
The player wins the game if they click on every space that isn’t a mine. However, if the player clicks on a single square that is a mine, the player loses the game. Below is an example of a completed minesweeper game:
PennDrawdoes not support right clicking, so you do not need to implement the flag mechanic. Similarly, the “middle clicking” tool many minesweeper players use will also not be possible to implement in
In minesweeper, it is valuable to be able to “mark” spaces you know aren’t safe. This is done typically using a flag. In most variations of the game, this is done by right clicking with the mouse. However,
PennDraw does NOT support right clicking. Try to implement another way to use flagging in the game. This could include things like:
Tetris is a classic video game that can be played here.
In the game, various shapes (shown below) begin to fall from the top of the screen, and the player uses keyboard controls to control where the piece falls. When the player fills a row, all items in that row disappear and the above items shift down. The game is lost if any of the pieces reach the top of the board.
In the traditional version of the game, the player uses keyboard controls to move the piece side-to-side, rotate the piece, and control the dropping speed. For this version of the game, you are only required to implement side-to-side movement and “hard drop”. A hard drop should instantly place the piece where it would have ended up, without showing the animation as it falls.
Submissions will be through Gradescope. Any Java source files you submit will be tested for compilation and style. Make sure to submit every file necessary for running your program.
Important: You must write your own README text file and submit it with everything else. Structure it however you wish, but it must contain the following information: