Computer Science I for majors by James Tam |
(Note: new design principles, e.g., Object-Orientation, as well design/style requirements from previous assignments such as good naming conventions must be applied in your work).
You are to write a dating simulator for fictional life forms called the "Tims" (Tam's simulated life forms) 1. There are two types of Tims in this simulation: a 'pursuer' and a 'target'. The target is the object of the pursuer's desire. In the full version of the program, the goal of the pursuer is to have a successful date with the target. The target's behavior is purely random. The date consists of a number of social interactions. If by the end of the date the proportion of successful interactions is 50% or greater then the date is considered successful otherwise it's deemed a failure. Two types of reports will show statistics on various aspects of the date. |
The program will consist of two classes: the Pursuer class and the Target class. Each class should be defined in its own module file.
Class Pursuer | ||||
Minimum attributes (you probably will define more) | ||||
Tally of the number of X-interactions generated by the pursuer | ||||
Tally of the number of Y-interactions generated by the pursuer | ||||
Probability of an X-interaction occurring (0 - 100%) | ||||
Probability of a Y-interaction occurring (0 - 100%) | ||||
Tally of the number of successful interactions with the Target (needed so that Pursuer can 'match' its behavior with that of the Target, even if you don't implement the intelligent matching behavior the information should be tracked here and not elsewhere). | ||||
Minimum number of methods (you will probably define more) | ||||
An "init()" constructor | ||||
A method that will display a report at the end of each interaction between the pursuer and target | ||||
A method that will display a report at the end of the simulation (when all interactions between the Pursuer and Target have finished) | ||||
One or more methods that will determine the type of behavior that will occur for a particular interaction with the target (among other things the random numbers must be generated). | ||||
Class Target
|
||||
Tally of the number of X-interactions generated by the target | ||||
Tally of the number of Y-interactions generated by the target | ||||
Probability of an X-interaction occurring (0 - 100%) | ||||
Probability of a Y-interaction occurring (0 - 100%) | ||||
Minimum number of methods (you will probably define more) | ||||
An "init()" constructor | ||||
One or more methods that will determine the type of behavior that will occur during an interaction (among other things the random numbers must be generated). |
In addition you will define a 'Manager' module that contains the starting execution point for the your program (the start() or the main() function). The capabilities of this module can be written purely in a procedural manner (functions instead of classes and methods). At a minimum the functions in this module should be able to: 1) prompt the user for the number of interactions to occur when the program runs, 2) prompt the user for the probability of x-type interactions for the target 3) instantiate instances of the Pursuer and Target class inside of one of the Manager's functions. Finally the 'main loop' (that executes a number of times equal to the specified number of interactions) will be inside a function of the Manager. The appropriate methods of the pursuer and the target should be called within the body of this loop.
For an animated overview of the assignment see the following [presentation]
The total number of interactions for the date: it can be any integer >= 1. Your program should be able recover if the type of information entered by user is invalid (i.e., a non-numeric string) or if the range of information entered is invalid (zero or less). You can count floating point values as an invalid 'type' in this case. Whether the type or range of information is incorrect an appropriate error message should be displayed for each case and the program will prompt the user again for the number of interactions.
Examples of determining the number of interactions that the simulation will run (program prompt and user input in blue, program response in red)The probability of the Target object exhibiting type 'X' interactions: It will be an integer value 0 <= (value) <= 100. Similar to the total number of interactions your program should check the validity in the type and range of data entered and display appropriate error messages as necessary for each case.
Examples (program prompt and user input in
blue, program response in red)
Enter the percentage # of 'X'
interactions for target (whole numbers from 0 - 100): xyz
Do not enter non-numeric values
Enter the percentage # of 'X' interactions for target
(whole numbers from 0 - 100): 1.5
Do not enter non-numeric values
Enter the percentage # of 'X' interactions for target
(whole numbers from 0 - 100): 100