CS 161 Final Project

Overview

You will be implementing a final programming project to demonstrate all of the programming and computer science skills you've mastered throughout the course. This is a chance to work on something that is of interest to you, while also reinforcing what you've learned. You should aim to make a project that you'd be proud to show off to your friends and family--an awesome "look what I made!" program that will make you the envy of everyone you know.

Schedule

You have until Tuesday, May 14 at 11:59pm to complete your project. (This is the day after the final exam, so you will have a chance to make some final changes without getting in the way of studying). However, there will be some deadlines along the way to help keep you on track:

Once more, in case you missed it: the project is due Tuesday, May 14 at 11:59pm.

Project Requirements

You are welcome to design your own project for this assignment. Pick something that you think would be fun to create, useful to use, or neat to show off!

However, no matter what you choose, your project should meet a few basic requiremnts:

  1. Your project should include a Graphical User Interface (GUI). This can either be a window with buttons and displays, or a painted graphical image. But it shuold not be just a command-line program!
  2. Along those lines, your project should include user interaction with the GUI: mouse and/or keyboard interaction, interaction with buttons, etc. Be sure and think about what makes the program easy and pleasant to use!
  3. Your project should include multiple classs. This means the project should be large enough that it has more than one component. Of course, giving the program a GUI means that you'll likely need at least two classes (one for the UI and one for the program model).
  4. ...that's about it really. :)

We have included a couple of suggestions for suitable projects below. You are encouraged to choose one of these projects, but are welcome to come up with your own idea!

Some Project Options

At this point you have the ability (the power!) to create full if simple applications. One great example of such applications are classic arcade games! These games follow very simple computational and graphical rules (since that was all that was available at the time), and so are quite feasible to put together. Some examples are discussed below.

Pong

Pong is a computer version of ping-pong, in which players control opposing "paddles" and try to knock a ball back and forth. If the ball gets past your opponent's paddle, you get a point. Whoever gets the most points wins!

Your game should allow two players to play using the keyboard (for example, one using the arrow keys and one using the 'w' and 's' keys). Players can move their paddles up and down on the screen, and when the ball hits the paddle it bounces off. The ball should also bounce off the floor and ceiling, and will need to detect when it has gotten past a paddle. An advanced program could have the ball bounce at a more extreme angle as it hits further away from the center of the paddle. Your game should keep track of the current score, and declare a winner (like first to 3 or first to 10).

A really advanced Pong game could include a computer-controlled paddle. This is not a requirement.

Getting started: Start by making two paddles that are able to move up and down based on keyboard input. You'll need to use a KeyListener for this. Start with getting the keyboard input, as it can be tricky (hint: make sure your target component is the "focused" window--the one the user is interacting with). Once you can move paddles, add a ball bouncing around the screen (look back at the BouncingBall lab for an example). Finally, you can then add in bouncing off the paddles and scoring points.

Alpha Demo: A program that can move two "paddles" (rectangles) on the screen in response to keyboard input.

Beta Demo: A program in which the paddles can bounce a ball back and force, and that registers when the paddle has missed the ball.

Breakout

Somewhat like a one-player version of Pong, Breakout is a game that involves using a paddle to bounce a ball around. However, instead of trying to knock the ball past your opponent, you are trying to aim the ball to hit and destroy a grid of different colored "bricks". If the player destroys all the bricks, they win! If they miss bouncing the ball too many times, they lose.

The paddle in this game could be controlled either with the keyboard (e.g., the arrow keys) or with the mouse (tracking only horizontal movement). The ball will need to bounce off of the walls and the bricks, but after it bounces off the brick the brick should be removed. You will need to check whether a brick has been removed or not (so you don't collide with removed bricks!), and if all the bricks have been removed let the player know that they won!

This project may be slightly more challenging than Pong (since you need to deal with bricks as well as paddles).

Getting started: You might start by making a ball that bounces around the screen (you can use the BouncingBall lab as a launching point). Then add in a row of bricks, making sure the ball can bounce off them (note that you can track what bricks exist by using a list (either an ArrayList or an array--perhaps a 2D-array to represent the grid!). Add the functionality to remove the bricks when they are hit. Finally, add in the moving paddle at the bottom so that the ball can bounce off that.

Alpha Demo: A program that has a ball bouncing around the screen, including bouncing off of positioned bricks.

Beta Demo: A program in which the ball bounces around the screen and removes the bricks when it hits them. Likely with a paddle it bounces off of as well.

Snake

Snake is another classic arcade game, and a staple of simple programming systems (my old graphing calculator came with a Snake game). In Snake you control the head of a snake, moving it in different directions based on user input. Note that the snake doesn't stop moving: you just indicate what direction it is going You're trying to move the head to eat a "pellet" or "dot", without crashing into the tail of the snake or any walls. Each piece of the tail follows the head exactly where it went---like you might do for a conga line of Dancing Turtles! In addition, the tail gets longer each time a pellet is eaten, making the game increasingly difficult. The goal is to eat as many pellets as possible before you crash.

Your program should allow the player to control the snake via the keyboard--different keys should tell the snake to turn in different directions, but othewise the snake will move one step each "frame" of the animation. The hard part will be tracking each individual piece of the tail: I suggest making an ArrayList of "segments", and then having each segment move to the position of the segment in front of it (with the "head" being the first segment, and moved in whatever direction it is facing).

Getting started: Start by making the head that runs across the screen in a particular direction--this should be relatively simple. You can then add the "tail", programming it to folow the head. Then add in the ability to change the head's direction using the keyboard, and finally add in the ability to collect pellets (as well as scoring).

Alpha Demo A snake that moves across the screen in different directions (with which direction hard-coded)

Beta Demo The snake moves across the screen in response to the keyboard, being able to turn around and have the tail follow. Snake should also be able to pick up randomly positioned "pellets".

Pac-Man (Challenging!)

If you're feeling ambitious, you can also try to implement a simple version of the greatest arcade game of all time: Pac-Man! Your Pac-Man game won't necessarily follow the exact details of the original (and it shouldn't, due to copyright restrictions), but can do some of the same details. The player should be able to control Pac-Man using the keyboard--Pac-Man can move around the screen (which may or may not look like a maze), collecting pellets when he steps on them. In addition, there should be "ghosts" that wander randomly around the screen; if Pac-Man runs into a ghost, he gets eaten! The goal of the game is to eat all the pellets.

Getting started: Start by getting Pac-Man to draw on the screen, and to be controlled with the keyboard. Add in pellets, and make sure Pac-Man collects pellets when he walks over them. Then add in the Ghosts (who can step in a random direction), who have the ability to eat Pac-Man. If you wish to use a maze, add in that before you get to the Ghosts: just having Pac-Man manuever through the maze and not being able to walk through walls can be a challenge!

Alpha Demo Pac-Man can be moved around the screen and collects pellets he steps over.

Beta Demo Ghosts wander around and chase Pac-Man.

Other Options

There are of course many other options for projects. These include other classic arcade games (Space Invaders, Asteroids, etc.). And again, you can also pick a different project. Maybe you want to extend a previous homework or lab in an interesting way (making a Graphical Evil/Cheating Hangman, or enhancing the Photoshopper for example). Or maybe you have another idea in mind--feel free to be creative!

Submitting

There are multiple compents and requirements in submitting your project: be sure to read them carefully!

Grading

This project will be graded based on roughly the following components: