public class Table {
    public static final int MAXPLAYER = 4;

    private Shuffler shuffler;
    private Player[] players;
    private Dealer dealer;
    //TODO: Insert other necessary instance variables
    //NOTE: All instance variables should be private

    /**
     *  Initialize player and shuffler with nDecks
     */
    public Table(int nDecks) {
	shuffler = new Shuffler(nDecks);
	players = new Player[4];
    }

    /**
     *  Let player p seat at seat pos
     */
    public void set_player(int pos, Player p){
	if (pos >= 0 && pos <= players.length)
	    players[pos] = p;
    }

    /**
     *  Set the dealer
     */
    public void set_dealer(Dealer d){
	dealer = d;
    }

    /**
     *  Get the seat position of the player
     */
    public int get_my_pos(Player p){
	for(int i = 0; i < players.length; i++)
	    if (players[i] == p)
		return i;
	return -1;
    }

    /**
     *  Check the position that the player seats,
     *  and return all the cards that the player should have on hand
     */
    public Card[] get_my_cards(Player p){	
	//TODO: Modify the following line and insert the necessary code
	return null;
    }

    /**
     *  Return all the cards of all the players
     *  The i-th "row" of the array should contain the current
     *  face-up cards of player[i]
     *  
     */
    public Card[][] get_cards_of_all_players(){
	//TODO: Modify the following line and insert the necessary code
	return null;
    }


    /**
     *  Return the one face-up card of the dealer
     */
    public Card get_face_up_card_of_dealer(){
	//TODO: Modify the following line and insert the necessary code
	return null;
    }

    public void play(){
	ask_each_player_about_bets();
	distribute_cards_to_dealer_and_players();
	ask_each_player_about_hits();
	ask_dealer_about_hits();
	calculate_chips();
    }

    private void ask_each_player_about_bets(){
	for(int i = 0; i < players.length; i++){
	    if (players[i] != null)
		players[i].say_hello();
	}
	//TODO: Insert the necessary code	
    }

    private void distribute_cards_to_dealer_and_players(){
	//TODO: Insert the necessary code	
    }

    private void ask_each_player_about_hits(){
	//TODO: Insert the necessary code	
    }

    private void ask_dealer_about_hits(){
	//TODO: Insert the necessary code	
    }

    private void calculate_chips(){
	//TODO: Insert the necessary code	
    }
} 

