OOP - Assignment 1 – Dice in a bitmap

Purpose:          Getting back in the groove    

Points:             25

Due:                01-19-2006 at class time

Instructor:       Dana Steil

Turn In:           Source code on Easel.



Write a c++ program that reports on dice represented in a bitmap. 


Start with this code: dice.cpp


This program reads a bitmap into a data structure.  Part of that data structure is a single dimension array named Pixels that contains all of the pixels in the bitmap.  Each pixel’s color is represented by an RGB value.  255 255 255 represents a white pixle and 0 0 0 represents a black pixel.  You will also need to know the width and the height of the bitmap.  These values can be found in the CInfoHeader.


Bitmap Description

  • The size of the bitmap files will very.
  • Each bitmap will have pure white backgrounds with black pixels representing a die or multiple dice.
  • All dice have white faces surrounding each black dot(square).
  • All dots are represented by square islands (black squares completely surrounded by white pixels).  The black squares may very in size.
  • No stray pixels will be used.
  • In options 2 & 3 each die will have a single pixel black border.
  • Any group of black pixels that does not represent a wall should be counted as a dot on the face of a die.


Option 1 – Earn at most 19 points.

Assume that the bitmap contains only one die with no border.  Report the face value of the one die. Example: SingleDie.bmp & OddSingleDie.bmp


Option 2 – Earn the full 25 points.

The bitmap may contain multiple dice. All dice will have single pixel black borders.  Report the total value of all of dice that appear. Examples: MultipleDice.bmp & OddMultipleDice.bmp


Option 3 – Earn the full 25 points + 5 bonus.

The bitmap may contain multiple dice. All dice will have single pixel black borders.  Report the number of dice that appear in the bitmap, the face value of each die, and the total value of all of the dice. Example: MultipleDice.bmp


Points will be deducted for poor coding style and/or poor documentation.