// Path: src/shaft/poker/game/table/IPlayerData.java
// public interface IPlayerData {
//     
//     public int amountToCall();
//     public int betsToCall();
//     public double potOdds(int potSize);
//     public int moneyInPotForRound();
//     public int totalMoneyInPot();
//     public int stack();
//     public int position();
//     public String id();
// }
// 
// Path: src/shaft/poker/agent/handranges/weightedrange/IFrequencyTable.java
// public interface IFrequencyTable {
//     
//     public double estimatedStrength(ActionType a, int numBets, Round bettingRound);
//     
// }
// 
// Path: src/shaft/poker/game/table/IPlayerActionListener.java
// public interface IPlayerActionListener {
// 
//     public void gameAction(ITable table, IPlayerData plData, ActionType type, int amount);
//     
//     public void leave(ITable table, IPlayerData plData);
// }
// 
// Path: src/shaft/poker/game/ITable.java
// public interface ITable {
//    
//     enum ActionType {
//         FOLD,
//         CALL,
//         BET
//     }
//     
//     enum Round {
//         PREFLOP,
//         FLOP,
//         TURN,
//         RIVER
//     }
//     
//     public void runGame(int hands, int stackSize, int sBlind, int bBlind);
//     
//     public int numberBets();
//     public int maxBets();
//     public int numberCallers();
//     public Round round();
//     public int potSize();
//     
//     public int numberPlayers();
//     public int numberActivePlayers();
//     public int numberPlayersToAct();
//     
//     public int smallBlind();
//     public int bigBlind();
//     
//     public List<Card> board();
//     
//     public String playerSmallBlind();
//     public String playerBigBlind();
//     public String playerDealer();
//     
//     public void registerListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerPriorityListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerListenAllPlayerEvents(IPlayerActionListener listener);
//     public void registerEventListener(IGameEventListener listener);
// 
// }
// 
// Path: src/shaft/poker/game/ITable.java
// public interface ITable {
//    
//     enum ActionType {
//         FOLD,
//         CALL,
//         BET
//     }
//     
//     enum Round {
//         PREFLOP,
//         FLOP,
//         TURN,
//         RIVER
//     }
//     
//     public void runGame(int hands, int stackSize, int sBlind, int bBlind);
//     
//     public int numberBets();
//     public int maxBets();
//     public int numberCallers();
//     public Round round();
//     public int potSize();
//     
//     public int numberPlayers();
//     public int numberActivePlayers();
//     public int numberPlayersToAct();
//     
//     public int smallBlind();
//     public int bigBlind();
//     
//     public List<Card> board();
//     
//     public String playerSmallBlind();
//     public String playerBigBlind();
//     public String playerDealer();
//     
//     public void registerListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerPriorityListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerListenAllPlayerEvents(IPlayerActionListener listener);
//     public void registerEventListener(IGameEventListener listener);
// 
// }


import java.util.List;
import shaft.poker.game.table.IPlayerData;
import shaft.poker.agent.handranges.weightedrange.IFrequencyTable;
import shaft.poker.game.table.IPlayerActionListener;
import shaft.poker.game.ITable;
import shaft.poker.game.ITable.*;
import shaft.poker.game.table.*;
/*
 * The MIT License
 *
 * Copyright 2013 Thomas Schaffer <thomas.schaffer@epitech.eu>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package shaft.poker.agent.handranges.weightedrange.frequencytable;


/**
 *
 * @author Thomas Schaffer <thomas.schaffer@epitech.eu>
 */
public class PlayerSpecificFrequencyTable implements IFrequencyTable, IPlayerActionListener, IGameEventListener {
    
    // Dimensions: [BettingRound][LastAction][NumBets][Fold/Call/Bet]
    private int[][][][] _freqs;
    IFrequencyTable _defaultFreqs;
    private String _playerId;
    private static final int MINIMUM_DATA = 20;
    private ActionType _lastAction;
    
// Path: src/shaft/poker/game/table/IPlayerData.java
// public interface IPlayerData {
//     
//     public int amountToCall();
//     public int betsToCall();
//     public double potOdds(int potSize);
//     public int moneyInPotForRound();
//     public int totalMoneyInPot();
//     public int stack();
//     public int position();
//     public String id();
// }
// 
// Path: src/shaft/poker/agent/handranges/weightedrange/IFrequencyTable.java
// public interface IFrequencyTable {
//     
//     public double estimatedStrength(ActionType a, int numBets, Round bettingRound);
//     
// }
// 
// Path: src/shaft/poker/game/table/IPlayerActionListener.java
// public interface IPlayerActionListener {
// 
//     public void gameAction(ITable table, IPlayerData plData, ActionType type, int amount);
//     
//     public void leave(ITable table, IPlayerData plData);
// }
// 
// Path: src/shaft/poker/game/ITable.java
// public interface ITable {
//    
//     enum ActionType {
//         FOLD,
//         CALL,
//         BET
//     }
//     
//     enum Round {
//         PREFLOP,
//         FLOP,
//         TURN,
//         RIVER
//     }
//     
//     public void runGame(int hands, int stackSize, int sBlind, int bBlind);
//     
//     public int numberBets();
//     public int maxBets();
//     public int numberCallers();
//     public Round round();
//     public int potSize();
//     
//     public int numberPlayers();
//     public int numberActivePlayers();
//     public int numberPlayersToAct();
//     
//     public int smallBlind();
//     public int bigBlind();
//     
//     public List<Card> board();
//     
//     public String playerSmallBlind();
//     public String playerBigBlind();
//     public String playerDealer();
//     
//     public void registerListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerPriorityListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerListenAllPlayerEvents(IPlayerActionListener listener);
//     public void registerEventListener(IGameEventListener listener);
// 
// }
// 
// Path: src/shaft/poker/game/ITable.java
// public interface ITable {
//    
//     enum ActionType {
//         FOLD,
//         CALL,
//         BET
//     }
//     
//     enum Round {
//         PREFLOP,
//         FLOP,
//         TURN,
//         RIVER
//     }
//     
//     public void runGame(int hands, int stackSize, int sBlind, int bBlind);
//     
//     public int numberBets();
//     public int maxBets();
//     public int numberCallers();
//     public Round round();
//     public int potSize();
//     
//     public int numberPlayers();
//     public int numberActivePlayers();
//     public int numberPlayersToAct();
//     
//     public int smallBlind();
//     public int bigBlind();
//     
//     public List<Card> board();
//     
//     public String playerSmallBlind();
//     public String playerBigBlind();
//     public String playerDealer();
//     
//     public void registerListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerPriorityListenerForPlayer(String id, IPlayerActionListener listener);
//     public void registerListenAllPlayerEvents(IPlayerActionListener listener);
//     public void registerEventListener(IGameEventListener listener);
// 
// }


// Path: src/shaft/poker/agent/handranges/weightedrange/frequencytable/PlayerSpecificFrequencyTable.java
import java.util.List;
import shaft.poker.game.table.IPlayerData;
import shaft.poker.agent.handranges.weightedrange.IFrequencyTable;
import shaft.poker.game.table.IPlayerActionListener;
import shaft.poker.game.ITable;
import shaft.poker.game.ITable.*;
import shaft.poker.game.table.*;

/*
 * The MIT License
 *
 * Copyright 2013 Thomas Schaffer <thomas.schaffer@epitech.eu>.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */
package shaft.poker.agent.handranges.weightedrange.frequencytable;


/**
 *
 * @author Thomas Schaffer <thomas.schaffer@epitech.eu>
 */
public class PlayerSpecificFrequencyTable implements IFrequencyTable, IPlayerActionListener, IGameEventListener {
    
    // Dimensions: [BettingRound][LastAction][NumBets][Fold/Call/Bet]
    private int[][][][] _freqs;
    IFrequencyTable _defaultFreqs;
    private String _playerId;
    private static final int MINIMUM_DATA = 20;
    private ActionType _lastAction;
    
    public PlayerSpecificFrequencyTable(String playerId, ITable table) {