// Aperture Game Development // runGame.c - allows user to test our game.c #include <stdlib.h> #include <stdio.h> #include "Game.h" #define WINKPI 150 action decideAction(void); int main(int argc, char *argv[]){ int inpActionCode = 1; path inpDestination; int inpDiscFrom; int inpDiscTo; action move; Game g (int discipline[], int dice[]); currentPlayer = getWhoseTurn(g); while(getKPIpoints(g, currentPlayer) <150) { int diceScore = rollDice(); throwDice(g,diceValue); move = decideAction(); while(move.actionCode != PASS) { assert(isLegalAction(g, move) == TRUE); if(move.actionCode == START_SPINOFF) { int randNum = rand(); int rand3 = (randNum % 3); if ((rand3 == 0) || (rand3 == 1)) { int finalAction = OBTAIN_PUBLICATION; } else { int finalAction = OBTAIN_IP_PATENT; } move.actionCode = finalAction; } makeAction(g, move); move = decideAction(); } } // increment turn } // free memory that was malloc'd action decideAction(void) { action move; printf("Type in your action code\n"); scanf("%d", &inpActionCode); printf("Type in your destination\n"); scanf("%s", &inpDestination); printf("Type in your discFrom\n"); scanf("%d", &inpDiscFrom); printf("Type in your discTo\n"); scanf("%d", &inpDiscTo); move.actionCode = inpActionCode; move.destination = inpDestination; move.disciplineFrom = inpDiscFrom; move.disciplineTo = inpDiscTo; return move; } int rollDice(void) { int randNum = rand(); int answer = (randNum % 11) + 2; return answer; }
Download file: runGame.c
(1.6 KB)