- //join ##HELLOKITTY2
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include "Game.h"
- int validPath(path thePath);
- int rollDice();
- int main(int argc, char* argv[]){
- int curPlayer = 0;
- // Current move specified by the user.
- int curMove;
- int curDice = 0;
- int disciplines[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18};
- // assigns a color to hexes
- int temCounter;
- int counter = 1;
- while(counter < NUM_REGIONS){
- temCounter = 1;
- while(temCounter <= 6 && counter + temCounter - 1 < NUM_REGIONS) {
- disciplines[counter+temCounter-1]=temCounter;
- temCounter++;
- }
- counter += 5;
- }
- int dice[] = {2,4,12,3,5,9,10,2,6,9,11,8,8,10,12,4,2,10,11};
- Game curGame = newGame(disciplines,dice);
- int winFlag = FALSE;
- int legitDice = FALSE;
- int endTurn = FALSE;
- int legitInput;
- int diceRolled;
- int resultDice;
- path pathBuffer;
- printf("Welcome to generic_team_name's Game!\n");
- printf("Our game is cool\n");
- printf("Instruction set:\n");
- printf("To build an arc, type a followed by xx and yy\n");
- while(winFlag == FALSE){
- endTurn=FALSE;
- while(!legitDice){
- diceRolled = rollDice();
- if(diceRolled>=2 && diceRolled <=12){
- legitDice = TRUE;
- } else {
- printf("Dear friendly awesome dungeon master, please enter a valid roll (2-12)");
- }
- }
- throwDice(curGame,diceRolled);
- curPlayer=getWhoseTurn(curGame);
- while(!endTurn){
- printf("What is your next intended move, sweet prince of ponies?: ");
- legitInput=FALSE;
- while(!legitInput){
- /*scanf("%s",moveString);
- if(moveString[0]>='A' && moveString[0]<='Z'){
- moveString[0]+='a'-'A';
- }
- if(!(moveString[0]>='a' && moveString[0]<='z')){
- printf("Please type in a valid move on pain of death\n");
- } else{
- legitInput=TRUE;
- }*/
- scanf("%d",&curMove);
- if(curMove<8 && curMove>=0){
- if (curMove == PASS){
- endTurn = TRUE;
- } else if(curMove==BUILD_CAMPUS){
- fgets(pathBuffer, PATH_LIMIT, stdin);
- if (validPath(pathBuffer)) {
- makeAction(curGame,curMove);
- }
- } else if (curMove == BUILD_GO8){
- fgets(pathBuffer, PATH_LIMIT, stdin);
- if ((validPath(pathBuffer)) && ((getGO8s(curGame,UNI_A) + getGO8s(curGame,UNI_B) + getGO8s(curGame,UNI_C)) < 8)){
- makeAction(curGame,curMove);
- }
- } else if (curMove == OBTAIN_ARC){
- fgets(pathBuffer, PATH_LIMIT, stdin);
- if (validPath(pathBuffer)){
- if (getARC(curGame, pathBuffer) == VACANT_ARC){
- makeAction(curGame, curMove);
- }
- }
- } else if (curMove == START_SPINOFF){
- double randomValue = (rand() % 100 + 1) / 3;
- if (randomValue <= 33.33){
- makeAction(curGame, OBTAIN_IP_PATENT);
- } else {
- makeAction(curGame, OBTAIN_PUBLICATION);
- }
- }
- } else {
- printf("Please type in a valid move on pain of death\n");
- }
- }
- }
- }
- }
- int validPath(path thePath) {
- int i = 0;
- int isEnd = FALSE;
- int isInvalid = FALSE;
- while (i < PATH_LIMIT && !isEnd && !isInvalid) {
- if (thePath[i] != 'B' &&
- thePath[i] != 'R' &&
- thePath[i] != 'L' &&
- thePath[i] != 0) {
- isInvalid = TRUE;
- } else if (thePath[i] == 0) {
- isEnd = TRUE;
- }
- i++;
- }
- return !isInvalid;
- }
- /*
- void asciiGame(){
- int numTurns = getTurnNumber(curGame);
- printf("%d ", numTurns);
- int currentPlayer = getWhoseTurn();
- printf(" %d ", currentPlayer);
- int diceRoll = rollDice();
- printf(" %d ", diceroll);
- }
- */
- int rollDice(){
- int diceRoll;
- printf("Almighty SudoUser, what is le dice roll?: ");
- scanf("%d",&diceRoll);
- return diceRoll;
- }