I noticed that interviewers often ask to design a poker game in either c++ or java. There could be many ways to do that, so I was wondering if anyone could give me a good template answer.
Thanks
I noticed that interviewers often ask to design a poker game in either c++ or java. There could be many ways to do that, so I was wondering if anyone could give me a good template answer.
Thanks
I'd start with classes like Card and Deck and Hand and Player. I'd tell them where I intended to encapsulate the rules for determining winning hands and how I'd evaluate them.
How specific would you like to be?
I don't find "design a poker playing system" to be very common interview question. As a matter of fact, I've never been asked such a thing in an interview. Are you applying for jobs at casinos? That might explain it....
I would stay away from template answers. The primary reason for this interview question is to find out how you think and how you incorporate the sum of your experiences. There is no correct answer for this interview question; but there could be many wrong ones.
Not only do you need to know how to design, but also be prepared to justify your design decisions. For example, why would you use Object Oriented Design versus procedural? Have you considered project scheduling? What platforms?
If you feel like panicking, you probably need to study more have real-world experience.
I saw an interesting way to represent a deck of cards in a Computer Science book. You create an array/list of numbers 1-52. Then you say the numbers 1-13 represent spades, 14-27 represent hearts, etc. Then you can use modulo to easily determine what suit the card is and from there what the card is itself.