File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Hand evaluator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Hand evaluator" Watch "Hand evaluator" New topic
Author

Hand evaluator

Charles Angemeyer
Greenhorn

Joined: Dec 18, 2012
Posts: 22
This **is** for homework. The code below, that I modified, does the first part of the job and gives me two hands for 5 card poker.
Column 1 is Hand 1 and column 2 is hand two.
How can I evaluate it now and determine whether the hand holds a pair, two pairs, three of a kind, etc?
The professor suggested an array to handle it but I know that we are not supposed to pre-suppose the solution with questions like this.
Any help that you can give me would be most appreciated. Thank you.




fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 10911
    
  12

the first thing you do is....

turn of your computer. Get some paper, some pencils, and some erasers. Start writing down directions as if you were explaining to a child how to evaluate a poker hand. then, revise them. Then revise them again.

I would plan on having several methods. For example, have a method that figures out if you have a flush. Have a method that figures out if you have a straight. Note that these two methods are 100% independent of each other. Once you have those done, then to determine if you have a straight flush, you call both methods and see if they are both true.

In any case, do not write a single line of code until you have steps in clear, plain English, written out on your paper.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
 
subject: Hand evaluator
 
Similar Threads
illegal start of expression
Main class not recognized
cards game
Help With 5 card stud program
Cards game, deitel exercise question!