Game.c - OpenLearning
// Our Game.c with all of the Game functions and the game struct
#include <stdio.h>
#include <stdlib.h>
#include "Game.h"

#define NUMBER_OF_TILES 19
#define MAX_NUM_CAMPUSES 53
#define MAX_NUM_ARCS 70
#define MAX_NUM_GO8 8
#define MAX_NUM_TRADING_STATIONS 10
#define VERTEX_X 12
#define VERTEX_Y 11
#define VERTEX_CONTENTS 7

typedef struct _vertex {
    int xPos;
    int yPos;
    int contents;
} vertex; //see photo (Vertex_Coord) in dropbox

typedef struct _arc {
    vertex start;
    vertex end;
    int arcType;
} arc; // look at two verticies to work out arc

typedef struct _tradeStation {
    int xPos;
    int yPos;
    int tradeType;
} tradeStation;

typedef struct _tile {
    vertex topLeft;
    vertex topRight;
    vertex midRight;
    vertex bottomRight;
    vertex bottomLeft;
    vertex midLeft;
    int tileNum;
} tile;

typedef struct _player {
    int playerName;
    int KPI;
    int numOfCampuses;
    int numGO8;
    int numARCGrants;
    int numOfPatents;
    int numOfPapers;
    int THDs;
    int BPSs;
    int BQNs;
    int MJs;
    int MTVs;
    int MMONEYs;
} player;

typedef struct _game {
    // gameboard defaults
    int disciplines[NUMBER_OF_TILES];
    int dice[NUMBER_OF_TILES];
    
    // gameboard
    vertex boardVertexes[MAX_NUM_CAMPUSES];
    tradingStation boardTradingStations[MAX_NUM_TRADING_STATIONS];
    arc boardARCPos[];
        
    int turnNumber; //number of turns
    int whoseTurn;  //whose turn (using remainders of numTurns/3
    int diceValue; //current dice roll
    player UniA;
    player UniB;
    player UniC;
} game;

Download file: Game.c (1.5 KB)

Comments

Chat