CSCI 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.

Assignment Details

You can work on this project individually or in pairs (of your choosing). Groups of three are allowed with special permission, though 3-person groups will be expected to create projects that are larger in scope (since there are extra person-hours involved).

Note that this project is intended to be around the size of two normal homework assignments--you have about two-and-a-half weeks, but also have multiple people and will be able to use lab time to work.

Also note that unlike homework assignments, the steps to complete this project are not being organized or spelled out for you. Part of this assignment is to practice creating a Java program from scratch, using what you know about object-oriented programming and algorithm design. We are of course happy to answer questions and help you out (particularly with newer concepts), but the high-level design needs to come from you.

Schedule

You have until Monday, Dec 10 at midnight to complete your project. However, there will be some deadlines along the way to help keep you on track:

Note that we will not be having normal lab while you are working on this project; instead, lab time will be a time available for you to work and to get help from us!

Once more, in case you missed it: the project is due Mon, Dec 10 at 11:59pm

Project Options

Below are a few project options. They are ordered by complexity, with more stars meaning more complex (though it is a shallow curve). We've included a description of the project, as well as suggestions for mid-point deliverables.

You are welcome to design your own project for this assignment. You'll just need to get instructor approval (to make sure you don't come up with something appropriately sized).

JavaPaint

Create a simple graphical "painting" program, similar to Microsoft Paint. With this program, the user should be able to drag the mouse and draw lines on a window in order to sketch a pretty picture. The user should--at a minimum--also be able to change the color of the "brush" (what color line they are drawing), and the thickness of the brush stroke, as well as being able to erase the canvas and start over. More advanced options include being able to draw simple shapes (circles, squares) by clicking on the canvas, and being able to erase with the mouse. A very advanced program could also save the image to a file.

An example of the most basic program can be found here.

Getting started: You'll want to make a class that extends JPanel and overrides the paintComponent() method, so that you can redefine how to the JPanel gets drawn (e.g., draws the image that you are creating). You will also need to implement MouseListener and MouseMotionListener in order to respond to mouse events. Take a look at how the Photoshopper class was implemented for potential ideas and hints.

Mid-point goal: A window on which you can draw (using a single color, etc) using the mouse.

Final check-in goal: A window that you can draw on with different colors and stroke thicknesses.

Helpful hint: You can get a nice painting interaction by drawing a very short line (using Graphics.drawLine()) between subsequent mouse locations.

The Game of Life

Create a program that plays Conway's Game of Life. This is a well-known mathematical "game" in which you specify an initial configuration of cells, and then watch what happens as the game runs. The game plays as follow (from Wikipedia):

The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells, each of which is in one of two possible states, alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
  1. Any live cell with fewer than two live neighbours dies, as if caused by under-population.
  2. Any live cell with two or three live neighbours lives on to the next generation.
  3. Any live cell with more than three live neighbours dies, as if by overcrowding.
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Very simple configurations can create amazing emergent effects, such as "gliders" and "pulsars". See the link above for more details.

Your program should allow the user to create configurations by clicking on cells of a window. A user can select a square to make a cell "live", or click it again to make it "die". Once the configuration is completed, the user should be able to start the game, and watch each generation evolve. The user can stop the game to modify the current configuration.

An example program can be found here. Click "Set Up" to place cells, then "Exit Set Up" and "Start" to watch it go. Try making some of the shapes described in the above article.

Getting started: Start by just making a program that plays the Game, without the GUI. You can keep track of a grid of cells using a two-dimensional array, and you can print out this array to the console to see who is alive and who is dead (e.g., print a space if dead and an X if alive). You should be able to specify some configurations by hand, and then run a loop and keep printing the next generation. Once you have the Game working, you can implement a GUI to draw the cells, then give the player the ability to create the configuration.

Mid-point goal: A program that can calculate a new generation in the game of life.

Final check-in goal: A program in which the user can configure a set of cells, and then animate successive generations in the game of life.

Helpful hint: You can use the code for the wait() method from the old Canvas class to slow down your animation and make it more visible.

Tic-Tac-Toe

Create a program for playing a game of Tic-Tac-Toe against a computer opponent. Your system should be able to take input from the user about where to place an X, and then have the computer respond with an O in an empty spot. You should display what the board looks like between turns. For example, a game played on the console might look like:

X  O  X 
.  .  X 
O  .  O
Note that your computer does to have to play particularly intelligently--it could guess an empty square at random if need be. The game should report when one player (the human or the computer) wins or loses.

Your Tic-Tac-Toe game should also include one or more of the following features:

An example program with many features implemented (created by former 161 student Eric Lund) can be found here. Note that you do not necessarily need to create a program with quite this level of functionality.

Getting started: Start by making a simple board (e.g., printed to console--this can be specified with a two-dimensional array) and a player to give input (e.g., by row and column number). You can then use inheritance to make your player be controlled by the computer and use different strategies for playing. Adding a GUI or an intelligent opponent comes later.

Mid-point goal: A simple game of Tic-Tac-Toe that the user can play, against either another human player or an unintelligent computer.

Final check-in goal: A simple game of Tic-Tac-Toe that the user can either play graphically or against an intelligent computer program.

Helpful hint: You can (but may choose not to) use similar organization to the HangmanGame in getting input from the player and playing multiple turns. For making a GUI, consider using JButtons and the GridLayout class.

Pong

Make a Java version of the classic game of Pong. This game 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 point 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.

An simple example program can be found here.

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 your BouncingBall class for an example). Finally, you can then add in bouncing off the paddles and scoring points.

Mid-point goal: A program that can move two "paddles" (rectangles) on the screen in response to keyboard input.

Final check-in goal: A program in which the paddles can bounce a ball back and force, and that registers when the paddle has missed the ball.

Helpful hint: The KeyListener is the hardest part of this--you'll need to make sure your drawn JPanel is set to be focusable so that it can listen for key events. See this official java tutorial for examples on using KeyListener.

Other Options

Other options might a GUI calculator , an image library , a minesweeper game , a sudoku solver , a music player , and many more! You may also be able to extend a previous homework or lab in an interesting way (e.g., enhancing the Photoshopper). You can also design your own project for this assignment--just check with us first!

Submitting

Because you are building a project from scratch, you won't be able to submit your project through the BlueJ submitter. Instead, you will need to zip up your project file and upload it to the Moodle Dropbox by the deadline.

Grading

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