University of Calgary

top dog

TOP DOG
created by: Katrin Becker, 1998 (Images: copyright K.Becker)
Problem Specification: Process a list of dogs and their show results to date to find the top dog for this breed.

Background: Top Dog competitions are common among most Dog Breed Clubs that have dogs competing in conformation shows.
In the Top Dog competition dogs are typically awarded 1 point for each dog defeated when they win one or more of the following awards: WM (Winners Male); WF (Winners Female); BW (Best of Winners); BO (Best of Opposite Sex); BB (Best of Breed).
Breed entries are sub-divided by sex (M/F) and each dog is entered in one of 5 possible classes:
JrP=Junior Puppy;
SrP=Senior Puppy;
BE= Bred by Exhibitor;
Cdn= Canadian Bred;
O= Open

This makes for a total of 10 'classes'. The first place winner of each 'class' then cometes against the other 1st place winners for the awards named above. From these are chosen a male and a female "Winner", one of which will be awarded "Best of Winners" (in the next round). If a dog is already a Champion then it may not compete in this group, but may only compete in the next "round", and must be entered in the Specials class.
The two Winners then go back in the ring to compete with dogs that are already champions for the Best of Breed award. A dog of the opposite sex to the Best of Breed will become the "Best of Opposite Sex".


Points are only awarded for dogs defeated directly and since dogs are separated by sex, points are tallied as follows:
WM: all class (i.e. non-special) males count
WF: all class females count
BW: add class dogs of the opposite sex to this show's current tally
BO: Specials and class dogs of same sex
BB: all dogs entered in this breed
 
**Another way to look at it:
- start with the highest award won
- BB means count all dogs
- BO means count all dogs of same sex
(if this dog also won BW, then count all class dogs of opposite sex as well)
- BW count all class dogs (both sexes)
- WM or WF count class dogs of same sex only
This way in all cases except BO you only need to check the highest award and tally points according to that.
 
Dogs cannot defeat themselves so the final tally for each show must be reduced by one.
 
Since we are dealing with many shows and not all dogs will be present at each show, we will need to build a list of individual dogs and keep a tally of points for each.
Here is a sample of the data one could expect for a single show:
"Ninja" M 1 WM 2 1 4 3
"Fagan" F 2 WF BW 2 1 4 3
"Cerberus" M 1 BB 2 1 4 3
"Atreyu" F 1 BO 2 1 4 3
 
Notice that the dog's name is enclosed in quotes and that all input items are separated from each other by blanks.
A single line of input consists of the following:
1. dog's name enclosed in quotes (it may contain blanks)
2. dog's sex: M or F upper case only
3. a number representing a count of the number of awards to follow
4. dog's wins(s): [ WF, WM, BW, BO, BB ] upper case only
beware: some combinations are possible so that some dogs may have more than one award listed for a single show; also, it is not necessary to list the Winner's placement for an animal that has won Best of Winners (it is assumed).
5. the total entries in the breed [class males, class females, special males, special females] any of these values can be zero, but there will always be 4 numbers.
 
Minimal requirements for this program:
To meet the minimal requirements your program must be able to read a single (possibly long) list of show results from a specified file, tabulate top dog scores and print the final list of dogs and their accumulated points in descending order (Top Dog first). Input must be checked for validity (illegal award combinations not included). You must check SEX (M/F); AWARDS (one of: BB, BO, BW, WM, WF), ENTRIES (>0, <=100). If there is an error in the line you may simply discard the line after reporting it. You may assume the the number representing the count of awards is valid.
 
Bonuses (caution: some of these bonuses are quite involved):
1. Allow the user the option of saving the results in an intermediate file which can later be added to (program should still print Top Dog List 'to date').
2. Allow the user to specify which intermediate file they wish to access and add to (program should still print Top Dog List 'to date').
3. Set up the user interface menu-style allowing the user to choose one of several 'command' options' (such as: print list; add dogs to list; use existing list; start new list, etc. - not necessarily in that order)
4. Have the program detect illegal award combinations. Hint: to do this it must be possible to separate one show from the next. You may assume that all results from one show will be listed one after the other (they will all have the same number of entries).
5. Allow the user to enter results from the terminal as well as from a file.
6. Include the award counts in the 'report', for example:
 
Dog Name 
Sex
Winners
Best of Winners
Best of Opposite
 Best of Breed
 Total Points
 Cerberus
M
0
0
0
1
9
 Atreyu
F
0
0
1
 0
 3
 Fagan
F
1
1
0
0
2
 Ninja
M
1
0
0
0
1


Updated: August 5, 2005 06:19 PM