-2

I am currently writing a Texas Hold'Em style Poker game that I would like both humans and computers alike to be able to play. However, I am hung up on how to implement the betting rounds. Currently I have a PokerGame class which consists of the community cards, the size of the pot, a List of PokerPlayers and a few other things. How would I implement a method that "asks" each player (I can't take input because it might just be a computer) whether they want to call, raise, etc? Originally I though I might just implement a server or possibly multithreading, but that seems way to complex. Currently my only though is setting up some sort of input stream between the game and each player in the game.

Dylan Siegler
  • 742
  • 8
  • 23
  • stack overflow is not a site where you just ask people to write you code. It's kind of helpful that you showed variables but you need to give us some code. Tell everyone what you've done so far and you'll get better answers. – MD XF Oct 03 '16 at 22:10
  • By "asks" are you referring to sending a request over a network for their play? I'm not really sure what the structure of your program is, or what you're asking. – 4castle Oct 03 '16 at 22:11

1 Answers1

3

Write subclasses HumanPokerPlayer and ComputerPokerPlayer. Have PokerPlayer provide an abstract method placeBet() and override it appropriately for the human and the computer class.

cadolphs
  • 9,014
  • 1
  • 24
  • 41
  • 1
    This is exactly the structure I'm hoping they use, but isn't the question asking about how to implement the override for the human player? – 4castle Oct 03 '16 at 22:13
  • @Lagerbaer sorry for the delayed response. My problem is that when I call some betting method, I can cycle through each player and prompt them in the console to respond. I can then wait until they respond. However, I can't do that with a computer (they wouldn't know when to respond and what an implementation might look like). That is my question (I'll edit the original question) – Dylan Siegler Oct 04 '16 at 12:14
  • @4castle sorry for the delayed response. My problem is that when I call some betting method, I can cycle through each player and prompt them in the console to respond. I can then wait until they respond. However, I can't do that with a computer (they wouldn't know when to respond and what an implementation might look like). That is my question (I'll edit the original question) – Dylan Siegler Oct 04 '16 at 16:22
  • And I explained to you how you would do that. By using different classes to represent human and computer players. – cadolphs Oct 05 '16 at 00:28