Spades.c

#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include "game.h"

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>

void write_player_unplayed_cards(struct player *);
void write_all(struct array_b *, char * buf, size_t size);
void write_all_current_cards(struct array_b *, struct dll *);

/* 
 * Define the game name and initial game protocol string
 * This must be 64 characters long including the terminating NUL |
 */
#define SPADES_NAME \
"Spades: Version 0.10                                            "

/*
 * Globals
 */
struct game * Spades;

/* Number of teams in a game */
#define SPADES_TEAM_COUNT	  2
/* Number of players in a game */
#define SPADES_PLAYER_COUNT       4
/* Initial number of cards to deal to each player */
#define SPADES_PLAYER_CARD_COUNT 13

struct Spades_misc {
    unsigned int team_bid[SPADES_TEAM_COUNT];
    unsigned int team_score[SPADES_TEAM_COUNT];
    unsigned int game_end_score;
    struct dll * current_cards;
};

struct Spades_misc * Spades_misc;

int Spades_port = 37619;
int score = 1000;			

next slide