Java poker implementation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PlayerController.java 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (c) Chris 'MD87' Smith, 2007. All rights reserved.
  3. *
  4. * This code may not be redistributed without prior permission from the
  5. * aforementioned copyright holder(s).
  6. */
  7. package com.md87.cardgame.interfaces;
  8. import com.md87.cardgame.Deck;
  9. import com.md87.cardgame.Player;
  10. import com.md87.cardgame.Player.CallRaiseFold;
  11. import com.md87.cardgame.Player.OpenCheck;
  12. /**
  13. * Defines the standard methods required for a player controller.
  14. *
  15. * @author Chris
  16. */
  17. public interface PlayerController {
  18. /**
  19. * Determine whether the player will call, raise or fold.
  20. *
  21. * @param callAmount The amount the player needs to put in the pot to call
  22. * @param canRaise Whether the player can raise or not
  23. * @return The player's selected action
  24. */
  25. CallRaiseFold doCallRaiseFold(final int callAmount, boolean canRaise);
  26. /**
  27. * Determine whether the player will open or check.
  28. *
  29. * @return The player's selected action
  30. */
  31. OpenCheck doOpenCheck();
  32. /**
  33. * Indicates whether this player's cards should be shown locally.
  34. *
  35. * @return True if the cards should be shown, false otherwise
  36. */
  37. boolean shouldShowCards();
  38. /**
  39. * Sets the player that this controller is controlling.
  40. *
  41. * @param player The player that this controller is controlling
  42. */
  43. void setPlayer(final Player player);
  44. /**
  45. * Sets the game that the player is playing in.
  46. *
  47. * @param game The game that is being played
  48. */
  49. void setGame(final Game game);
  50. /**
  51. * Determine the amount that the player wishes to open or raise by.
  52. *
  53. * @param minimum The minimum raise or opening amount
  54. * @return The player's chosen amount
  55. */
  56. int getRaise(final int minimum);
  57. /**
  58. * Determines if this controller represents a local human or not.
  59. *
  60. * @return True iff the controller represents a local human
  61. */
  62. boolean isLocalHuman();
  63. /**
  64. * Determines which cards (if any) this controller wishes to discard.
  65. *
  66. * @param minimum The minimum number of cards to be discarded
  67. * @param maximum The maximum number of cards to be discarded
  68. * @return A deck containing the cards that are being discarded
  69. */
  70. Deck discardCards(final int minimum, final int maximum);
  71. }