Quickfingerz
Diamond Member
I need tips on this program. I don't need the answer since I am TRYING to be a CS major.
Assignment:
You are to construct a poker hand evaluator. The program will read each hand from a file, determine the best poker hand that can be made
from it, and then rank it with others in the same deal. The first line of the file has two integers: 1) The number of hands in each deal; and 2)
The number of deals stored in the file. Your program will take the name of the file as its command line parameter. The card values are
represented by 2,3,4,5,6,7,8,9,T,J,Q,K,A, with Aces being highest in value. The card suits are represented by S, H, D, C. In poker, all suits have
equal rank.
Further specifications: You may not use any arrays in this program. Instead you should use the vector template from the STL. You must
overload the << and >> operators for your hand class. When presented, the cards must be sorted by value, and then by suit within the same
value, with S > H > D > C.
Suggestions: You will find that by writing card and hand comparison functions to use with the sort and stable_sort algorithms you can save
yourself a lot of work. I also used a multiset and multiset::count to help with analyzing how many cards of each value a hand had. Besides five
Cards, you may wish to have each hand contain some information from its evaluation. This information could then allow a simpler
comparison among the hands. Share ideas with other people in the class about how best to evaluate each hand. Do not write code until you have
a clear design! This is not a huge program (< 300 lines of code including comments), but it is complex. Once you start to write your code,
work in steps. Get your input and output routines working CORRECTLY before dealing with the evaluation routines.
Assignment details may be found here:
http://wwwcsif.cs.ucdavis.edu/~wilson/ecs40/hw/hw8.html
Assignment:
You are to construct a poker hand evaluator. The program will read each hand from a file, determine the best poker hand that can be made
from it, and then rank it with others in the same deal. The first line of the file has two integers: 1) The number of hands in each deal; and 2)
The number of deals stored in the file. Your program will take the name of the file as its command line parameter. The card values are
represented by 2,3,4,5,6,7,8,9,T,J,Q,K,A, with Aces being highest in value. The card suits are represented by S, H, D, C. In poker, all suits have
equal rank.
Further specifications: You may not use any arrays in this program. Instead you should use the vector template from the STL. You must
overload the << and >> operators for your hand class. When presented, the cards must be sorted by value, and then by suit within the same
value, with S > H > D > C.
Suggestions: You will find that by writing card and hand comparison functions to use with the sort and stable_sort algorithms you can save
yourself a lot of work. I also used a multiset and multiset::count to help with analyzing how many cards of each value a hand had. Besides five
Cards, you may wish to have each hand contain some information from its evaluation. This information could then allow a simpler
comparison among the hands. Share ideas with other people in the class about how best to evaluate each hand. Do not write code until you have
a clear design! This is not a huge program (< 300 lines of code including comments), but it is complex. Once you start to write your code,
work in steps. Get your input and output routines working CORRECTLY before dealing with the evaluation routines.
Assignment details may be found here:
http://wwwcsif.cs.ucdavis.edu/~wilson/ecs40/hw/hw8.html