ggz.cards.client
Class Client

java.lang.Object
  extended by ggz.cards.client.Client

public class Client
extends java.lang.Object


Nested Class Summary
static class Client.GameState
          GGZCards client game states
static class Client.TrickInfo
           
 
Field Summary
protected  int dealer
           
protected  java.net.Socket fd
           
protected  CardGameHandler game
           
protected  boolean isNewTrick
           
protected  Client.TrickInfo lastTrick
          Structure that contains cards in the trick for each player.
protected  java.lang.String options
           
protected  int playerWhoLedLastTrick
           
protected  Card[][] previousHand
          Represents the previous hand for each players.
protected  java.lang.String scores
           
static Client.GameState STATE_BID
          our turn to bid
static Client.GameState STATE_DEAL
          dealing
static Client.GameState STATE_DONE
          game's over
static Client.GameState STATE_INIT
          game hasn't started yet
static Client.GameState STATE_OPTIONS
          determining options
static Client.GameState STATE_PLAY
          our turn to play
static Client.GameState STATE_WAIT
          waiting for others
protected  Suit trump_suit
           
 
Constructor Summary
Client()
           
 
Method Summary
 void add_listener(CardGameHandler l)
           
 int get_dealer()
           
 Client.GameState get_game_state()
           
 java.lang.String get_game_type()
           
 Client.TrickInfo get_last_trick()
           
 Player get_nth_player(int n)
           
 Team get_nth_team(int n)
           
 int get_num_players()
           
 int get_num_real_players()
           
 int get_num_teams()
           
 java.lang.String get_options()
           
 Card[][] get_previous_hand()
           
 java.lang.String get_scores()
           
 void handle_server_connect(java.net.Socket server_fd)
           
protected  void handle_server_input()
           
 boolean hasTeams()
           
 void send_bid(int bid)
           
 void send_newgame()
           
 void send_options(int[] option_indexes)
           
 void send_play(Card card)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fd

protected java.net.Socket fd

lastTrick

protected Client.TrickInfo lastTrick
Structure that contains cards in the trick for each player.


previousHand

protected Card[][] previousHand
Represents the previous hand for each players. The first index is the player. So it's Card[player][card].


playerWhoLedLastTrick

protected int playerWhoLedLastTrick

isNewTrick

protected boolean isNewTrick

trump_suit

protected Suit trump_suit

dealer

protected int dealer

scores

protected java.lang.String scores

options

protected java.lang.String options

game

protected CardGameHandler game

STATE_INIT

public static final Client.GameState STATE_INIT
game hasn't started yet


STATE_WAIT

public static final Client.GameState STATE_WAIT
waiting for others


STATE_DEAL

public static final Client.GameState STATE_DEAL
dealing


STATE_PLAY

public static final Client.GameState STATE_PLAY
our turn to play


STATE_BID

public static final Client.GameState STATE_BID
our turn to bid


STATE_DONE

public static final Client.GameState STATE_DONE
game's over


STATE_OPTIONS

public static final Client.GameState STATE_OPTIONS
determining options

Constructor Detail

Client

public Client()
Method Detail

get_num_players

public int get_num_players()

get_nth_player

public Player get_nth_player(int n)

get_num_real_players

public int get_num_real_players()

get_num_teams

public int get_num_teams()

get_nth_team

public Team get_nth_team(int n)

hasTeams

public boolean hasTeams()

add_listener

public void add_listener(CardGameHandler l)

get_game_state

public Client.GameState get_game_state()

get_game_type

public java.lang.String get_game_type()

get_last_trick

public Client.TrickInfo get_last_trick()

get_previous_hand

public Card[][] get_previous_hand()

get_scores

public java.lang.String get_scores()

get_options

public java.lang.String get_options()

get_dealer

public int get_dealer()

send_newgame

public void send_newgame()
                  throws java.io.IOException
Throws:
java.io.IOException

send_bid

public void send_bid(int bid)
              throws java.io.IOException
Throws:
java.io.IOException

send_options

public void send_options(int[] option_indexes)
                  throws java.io.IOException
Throws:
java.io.IOException

send_play

public void send_play(Card card)
               throws java.io.IOException
Throws:
java.io.IOException

handle_server_input

protected void handle_server_input()
                            throws java.io.IOException
Throws:
java.io.IOException

handle_server_connect

public void handle_server_connect(java.net.Socket server_fd)
                           throws java.io.IOException
Throws:
java.io.IOException