public void update() { for (int i = 0; i < brain.lastActions.length; i++) { PerformedAction performedAction = brain.lastActions[i]; if (performedAction.getType().equalsIgnoreCase("RAISE")) { if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myRaiseAction(performedAction); else theirRaiseAction(performedAction); } else if (performedAction.getType().equalsIgnoreCase("BET")) { if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myBetAction(performedAction); else theirBetAction(performedAction); } else if (performedAction.getType().equalsIgnoreCase("CALL")) { if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myCallAction(performedAction); else theirCallAction(performedAction); } else if (performedAction.getType().equalsIgnoreCase("CHECK")) { if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myCheckAction(performedAction); else theirCheckAction(performedAction); } else if (performedAction.getType().equalsIgnoreCase("POST")) { if (performedAction.getActor().equalsIgnoreCase(maj.myName)) myPostAction(performedAction); else theirPostAction(performedAction); } else if (performedAction.getType().equalsIgnoreCase("DEAL")) { streetAction(performedAction); } } }
public Action act() { reset(); for (LegalAction legalAction : legalActions) { if (legalAction.getType().equalsIgnoreCase("RAISE")) { raiseAction = legalAction; canRaise = true; } else if (legalAction.getType().equalsIgnoreCase("BET")) { betAction = legalAction; canBet = true; } else if (legalAction.getType().equalsIgnoreCase("CHECK")) { canCheck = true; } else if (legalAction.getType().equalsIgnoreCase("CALL")) { canCall = true; } else if (legalAction.getType().equalsIgnoreCase("DISCARD")) { canDiscard = true; if (chosenDiscardCard == null) chooseDiscardCard(); return discardCard(); } } for (PerformedAction performedAction : lastActions) { if (performedAction.getType().equalsIgnoreCase("DEAL")) { ec.setBoard(board); if (performedAction.getStreet().equalsIgnoreCase("FLOP")) { chooseDiscardCard(); // this will also update equity } else { equity = ec.calculateTotalEquity(); } } else if (performedAction.getType().equalsIgnoreCase("POST") && performedAction.getActor().equalsIgnoreCase(maj.myName)) { equity = ec.calculateTotalEquity(); } } maj.update(lastActions); dory.update(); if (board[2] == null) return actPreFlop(); else if (board[3] == null) { return actPostFlop(); } else if (board[4] == null) return actPostTurn(); else return actPostRiver(); }