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.

NetworkPlayer.java 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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.controllers;
  8. import com.md87.cardgame.Card;
  9. import com.md87.cardgame.Deck;
  10. import com.md87.cardgame.interfaces.GameObserver;
  11. import com.md87.cardgame.Player;
  12. import com.md87.cardgame.Player.CallRaiseFold;
  13. import com.md87.cardgame.Player.OpenCheck;
  14. import com.md87.cardgame.interfaces.Game;
  15. import com.md87.cardgame.interfaces.PlayerController;
  16. /**
  17. * Provides the server-side interface for network games. Each network player
  18. * listens on its own port, waiting for connections to come in.
  19. *
  20. * @author Chris
  21. */
  22. public class NetworkPlayer implements PlayerController, GameObserver {
  23. /**
  24. * Creates a new instance of NetworkPlayer.
  25. */
  26. public NetworkPlayer() {
  27. }
  28. /** {@inheritDoc} */
  29. public CallRaiseFold doCallRaiseFold(int callAmount, boolean canRaise) {
  30. return CallRaiseFold.CALL;
  31. // Do nothing
  32. }
  33. /** {@inheritDoc} */
  34. public OpenCheck doOpenCheck() {
  35. return OpenCheck.CHECK;
  36. // Do nothing
  37. }
  38. /** {@inheritDoc} */
  39. public boolean shouldShowCards() {
  40. return false;
  41. // Do nothing
  42. }
  43. /** {@inheritDoc} */
  44. public void setPlayer(Player player) {
  45. // Do nothing
  46. }
  47. /** {@inheritDoc} */
  48. public void setGame(Game game) {
  49. game.registerObserver(this);
  50. }
  51. /** {@inheritDoc} */
  52. public int getRaise(int minimum) {
  53. return minimum;
  54. // Do nothing
  55. }
  56. /** {@inheritDoc} */
  57. public void communityCardsUpdated() {
  58. // Do nothing
  59. }
  60. /** {@inheritDoc} */
  61. public void playerCardsUpdated() {
  62. // Do nothing
  63. }
  64. /** {@inheritDoc} */
  65. public void playersTurn(Player player) {
  66. // Do nothing
  67. }
  68. /** {@inheritDoc} */
  69. public void newPlayer(Player player) {
  70. // Do nothing
  71. }
  72. /** {@inheritDoc} */
  73. public void newGame() {
  74. // Do nothing
  75. }
  76. /** {@inheritDoc} */
  77. public void endGame() {
  78. // Do nothing
  79. }
  80. /** {@inheritDoc} */
  81. public void setDealer(Player player) {
  82. // Do nothing
  83. }
  84. /** {@inheritDoc} */
  85. public void placeBlind(Player player, int blind, String name) {
  86. // Do nothing
  87. }
  88. /** {@inheritDoc} */
  89. public void raise(Player player, int amount) {
  90. // Do nothing
  91. }
  92. /** {@inheritDoc} */
  93. public void fold(Player player) {
  94. // Do nothing
  95. }
  96. /** {@inheritDoc} */
  97. public void call(Player player) {
  98. // Do nothing
  99. }
  100. /** {@inheritDoc} */
  101. public void check(Player player) {
  102. // Do nothing
  103. }
  104. /** {@inheritDoc} */
  105. public void open(Player player, int amount) {
  106. // Do nothing
  107. }
  108. /** {@inheritDoc} */
  109. public void winner(Player players) {
  110. // Do nothing
  111. }
  112. /** {@inheritDoc} */
  113. public void showdown() {
  114. // Do nothing
  115. }
  116. /** {@inheritDoc} */
  117. public boolean isLocalHuman() {
  118. return false;
  119. }
  120. /** {@inheritDoc} */
  121. public Deck discardCards(final int minimum, final int maximum) {
  122. return new Deck();
  123. }
  124. public void discards(Player player, int number) {
  125. // Do nothing
  126. }
  127. public void cardDealt(Player player, Card card) {
  128. // Do nothing
  129. }
  130. }