->Homepage
->Schedule
->Courses
-->CS183
-->Tentative Schedule
-->Objectives
-->Quiz 1
-->Lab 1
-->Lab 2
-->Lab 3
-->Lab 4
-->SE281
->Course Policies
->Electronic Submission
->Documentation Standards
->Old Exams
->C++ Examples
->MSVC++ Info
->Software
->Support Forum
->Unix Info
->Nature Photos

[Home]
[Rich][Home][Rich]
[Author]
CS183 -- Lab 3: SameGame

Spring 2004

Objectives Addressed
  • Understand the rationale for object-oriented design and programming.
  • Understand data abstraction and abstract data types.
  • Be familiar with UML class notation and use cases.
  • Be familiar with composition, inheritance, polymorphism, and C++ templates.
  • Be able to design and implement simple C++ classes and class libraries.
  • Be able to design small software systems using classification and use cases.
  • Be able to document the design and implementation of small software systems.
  • Be able to work in a team to create a small software system.
Overview

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

Here is an video introduction to this assignment.

Important Notes

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.

Your design must include at least one user defined class (not counting the derived windows forms class given to you).

Problem Statement

In teams of two 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(color of (i,j) == clr) {
    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)
  }
}

The removing and shifting of game pieces may be done by recoloring the buttons. A sample button framework that uses windows forms in a .NET environment has been developed. You should find it quite helpful.

Interim Activity Log (due 11:00pm, the day prior to week 6 lab)

You should submit an activity log to indicate your activity and progress on this assignment during the first week (one log file for the entire team).

Lab Report (due 11:00pm, the day prior to week 7 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:

  • Your design documentation. (You may include images (in .png format) of scans of hand drawn UML diagrams and sequence diagrams if needed.) In the paragraphs following the UML diagram(s) you should describe how the classes interact. You should also have at least one use case.
  • A brief description of any problems you encountered or questions you have regarding the lab.
  • Any suggestions you have for how the assignment could be improved.
  • A description of how you worked (or didn't work) together as a team along with your individual activity logs and a summary of your activity logs indicating how much time you spent on the assignment. Please follow the time log format given in the template file. In particular, you should record the date and time for each block of time you work on the project. Please report the time in the following categories:
    • Designing
    • Coding
    • Debugging (before you think it's working)
    • Testing (after you think it's working)
    • Writing report
    • Other
  • The documented source code for your program. Include only the source files that you modified.
  • Included in your zip file should be a virus-free copy of your project executable.

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:

  • Meeting specifications
  • Technical quality
  • Design documentation
  • Narrative report
  • Internal documentation (comments)
  • Program clarity (formatting, etc.)
  • Activity logs
  • Spelling and grammar
  • Timeliness of submissions

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:37:37 EST