Step 1 (Program Design) Due: | In hard copy on Tuesday, February 9, 2016 |
Step 3 (Initial Implementations) Due: | Via mercurial on Monday,
February 15, 2016 (you are encouraged to arrange an earlier deadline with your partner) |
Step 5 (Full Assignment) Due: | Thursday, February 18, 2016 |
"The game goes like this. Four people each show one card. You think of a calculation with addition, subtraction, multiplication and division on the numbers shown on the cards to get 24. Card Ace is 1, Jack 11, Queen 12, King 13, excluding big and small Jokers. Whoever comes up with the answer first wins that round. For instance, if the cards are 3, 4, 1, and 9, you can say 3*(4+1)+9 (* here means multiply)." - Yong Huang , Card Game 24
Task: Write a C++ program that generates the cards for the 24 game, allows the user to specify the solution in three steps, and has at least one of the following functionality (if you do more than one, then you can receive up to 10 points extra credit per extra bullet):
Here's the expected interaction:
Your program must do the following:
Copy
the executable /rd/cs246s2016/shared/hw2/24game and
run it to get an idea how your program should behave. Your
program should duplicate the same user
interaction, except that it should only stop if you win, or
you have run out of chances.
Step 1: Program Design
(Partnered work)
For
this homework, a program design is required from each group. A
program design is a document containing skeleton code that
represents the implementation of your actual program. All
functions are represented by prototypes only, except for main(),
which should be fleshed out with appropriate calls and local
variable declarations. You should not provide
implementations for the functions, just function prototypes and appropriate header comments.
In
the header comments for each function prototype, tell me
which member of the group will be responsible for implementing
this function. Divide the work evenly between all functions.
For this part, you should create a hw2group repository in one of your course directories and make sure that both partners have RWX access using nfs4_acl.
There should be 2 files in the hw2group repository, hw2.h, with your function headers, and hw2.cpp, with your main function
This part is due in hard copy on the due date above; you may either give it to me in class or slip a copy under my office door.
Put the function prototypes into a file called hw2.h, add it and commit it to the hw2group repository.
You must finish
the program design and design write-up before proceeding to the next step.
Even if you make modifications to the program design
in step 2, you should still turn in the program design determined
in this step.
Step 2:
Initial Implementations (Individual work)
hg clone your hw2group repository into an hg2ind repository in your own course directory.
Implement
each of the functions for which you're responsible. Your partner will be doing
the same for his or her
functions.
During this step, you
may NOT share or discuss your function implementations with
your partner.
Because you know
the function prototypes that your
partner is implementing, you can call
those functions trusting that the
implementation will work.
However, since you don't actually have their implementation, you will not be
able to run your code to
test it. Therefore,
you must use unit
testing
to test each part of your program
independently of your
partner's
implementation.
You may talk
to your partner about the interface (i.e., the function prototypes, adding or
deleting functions, etc.) During this step, you
may make changes
to the function
prototypes, in
hw2.h and program
design, in hw2.cpp, from step 1 in
consultation
with your
partner. Those
modifications should be
committed and pushed to
the hw2group repository,
and then pulled into
each of the hg2ind repositories.
Save your
implementation as a
file called hw2_<lastname>.cpp
(substituting in
your last
name).
Save your unit tests in a file called hw2_<lastname>_tests.cpp
Step 3: Submit
Initial
Implementations
(Partnered work)
Once
both partners have finished step 2, share your implementation
with your partner.
Without changing the
implementations at all, commit and push the two
implementations into your hw2group repositories.
Step 4: Final Implementation
(Individual work)
From this point on,
you will work individually. You may
not discuss your
implementation, your partner's
implementation, or
the program design any further with your
partner.
Combine your partner's
implementation with your own
to create a working 24 game
program.
Keep the two function implementation source
files separate (i.e., you should have
two .cpp files: hw2_<yourlastname>.cpp that
the implementations of
your functions and hw2_<partnerslastname>.cpp
that contains your partner's
implementation.)
Although you may modify anything to make it work (including the function implementations provided by your partner), try to modify as little code as possible.
Step 5: Submit Final
Implementation (Individual work)
Submit
your working 24 game program,
following the assignment guidelines and
submission instructions.
Be sure to list your partner's name in your README file.
Be sure to include an example compilation command in
your README file.
In
addition to the electronic submission of your program, hand in a
write-up with three sections:
1.) A discussion of how and why your final
implementation differs from your program design, if at all.
2.) A discussion of how and why you had
to modify your initial implemenation to make the assignment
work, if at all.
3.) A discussion of
how and why you had to modify your partner's initial
implemenation to make the assignment work, if at
all.
You can include this write-up in your README file.
Hand
in the write-up in hard copy along with the hardcopy printouts
of your code.
Grading
Your
grade will be based on: