CS1020 -- Lab 4: SameGame

Winter 2004
Student Solutions

For each program you should indicate:

You should also rank the four programs with 1 being the highest rank. When you are done, send me an email with the above items.

Objectives Addressed
Overview

The purpose of this project is to develop a simple computer game.

Important Notes

An example GUI is available along with a video explanation.

Source code for a number of implementations of this assignment are freely available on the web. You may look at the applications to get an idea of how the game works, but you MAY NOT LOOK AT THE SOURCE CODE for any of these implementations until AFTER you have submitted your final report.

Problem Statement

In teams of three or four you are to write a version of the Same Game.

Game board

The game consists of a multi-colored tiled board. The board should be at least ten tiles high and twenty tiles wide and should have at least four unique tile colors.

Game play

Same Game is a one player game. The player removes tiles from the board by selecting a tile that has at least one adjacent (to the west, east, north or south) of the same color. The first click selects a group of adjacent tiles. The second click on the selected group of tiles will remove the tiles from the board. This causes the tiles to the north to shift south and tiles to the east to shift west to fill the space left by the removed tiles (all southerly shifts should occur before any westerly shifts).

Game scoring

When a player removes a group of N same-colored blocks, the player's score increases by (N-2)2 points. When play has progressed to the point where there are no groups left (only single colored blocks remain), the game should end. The player's final score should be reduced by one point for each remaining block. If no blocks remain, the final score should be increased by five times the number of tiles on the full board.

Game extras

Although not required, you may choose to incorporate additional features. These may include a high score list, resizable board, selectable number of colors for the blocks, hint feature, undo, sound, make it a two player game where players alternate turns, etc...

On the last day of lab, each team will test all of the implementations and vote on which one they like the best. Extra credit may be awarded (ask your instructor) for the most liked implementation.

Here are a few sites that offer versions of the game. Remember, you may not look at the source code for these implementations until after you have submitted your final report.

Design

Your design should consist of an annotated UML class diagram (see my useful software page for a tool to draw UML diagrams) expressing your high level design, a verbal description of how your objects/functions will interact, and at least one use case for your software project.

Hints

You will need to store the grid of game pieces in your program. One way to do this would be to make each button be a windows forms button. When a button is clicked a function would be called that will need to figure out if it is a valid move and if so, which pieces to remove and then shift the other pieces south and west. The following is a pseudocode function that is designed to give you an idea about how to tackle the problem of figuring out which game pieces should be removed.

function(i, j, count, clr) {
  if((not visted) and (color of (i,j) == clr)) {
    flag as visited
    increment count
    flag piece as one to be removed

    // Calls the function on the neighboring pieces
    function(i-1,   j, count, clr)
    function(  i, j-1, count, clr)
    function(i+1,   j, count, clr)
    function(  i, j+1, count, clr)
  } else {
    flag as visited
  }
}
Interim Activity Log (due 11:00pm, the day prior to week 9 lab)

You should submit an incomplete report with the activity log updated.

Team Evaluation

Upon completion of the project, each team member must complete the Team Evaluation Form and turn it in before taking the final exam.

Lab Report (due 11:00pm, the day of week 10 lab)

Here is a template file to use as a starting point for this report.

There should be one lab report for each team of students. The report should consist of the following:

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the XML help video and/or sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

Your lab grade will be determined by the following factors:

If you have any questions, consult your instructor.

Acknowledgment

This project was inspired by the game "Chain Shot", written by Kuniaki Moribe in 1985. In 1992 Eiji Fukumoto rewrote the game and gave it its more common title, "Same Game." This assignment was developed by Dr. Chris Taylor.

Last Updated: Thursday, 01-Jan-2015 14:30:14 EST