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.

ConservativeOpener.java 832B

123456789101112131415161718192021222324252627282930313233
  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.Player.CallRaiseFold;
  10. /**
  11. *
  12. * @author Chris
  13. */
  14. public class ConservativeOpener extends RandomPlayer {
  15. @Override
  16. public CallRaiseFold doCallRaiseFold(int callAmount, boolean canRaise) {
  17. Card c1 = player.getCards().get(0);
  18. Card c2 = player.getCards().get(1);
  19. if (c1.getSuit() == c2.getSuit() || Math.abs(c1.getRank().compareTo(c2.getRank())) < 2) {
  20. return super.doCallRaiseFold(callAmount, canRaise);
  21. } else {
  22. return CallRaiseFold.FOLD;
  23. }
  24. }
  25. }