Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.46 KB | None | 0 0
  1. int getScore (GameView gv)
  2. {
  3.     {
  4.         if (strcmp(gv->pastP, "\0") == 0){
  5.             return GAME_START_SCORE;
  6.         }
  7.         int result = GAME_START_SCORE;
  8.         int turnInt = 0;
  9.         int i = 0;
  10.         int vampCount = 0;
  11.         int vampTimer = 0;//once it reaches 6 vamp falls off trail
  12.        
  13.         int maxLength = pastPlaysLength(gv);//just added.
  14.         maxLength -= PLAY_LEN;
  15.        
  16.         while(i <= maxLength){
  17.            
  18.             if(gv->pastP[i] == 'G'){
  19.                 turnInt++;
  20.             } else if(gv->pastP[i] == 'S'){
  21.                 turnInt++;
  22.             } else if(gv->pastP[i] == 'H'){
  23.                 turnInt++;
  24.             } else if(gv->pastP[i] == 'M'){
  25.                 turnInt++;
  26.             } else /*gv->pastP[i] == 'D'*/{
  27.                 turnInt++;
  28.                 //checking for vampires
  29.                 if(gv->pastP[i+5] == 'V') vampCount++;
  30.                 if(vampCount > 0) vampTimer++;
  31.             }
  32.            
  33.             if(turnInt % 5 == 0){
  34.                 result -= SCORE_LOSS_DRACULA_TURN;
  35.             } else {//not Draculas turn
  36.                 if(gv->pastP[i+1] == 'J' && gv->pastP[i+2] == 'M'){
  37.                     result -= SCORE_LOSS_HUNTER_HOSPITAL;//hunter taken to hospital
  38.                 }
  39.             }
  40.             if(vampTimer > TRAIL_SIZE) result -= SCORE_LOSS_VAMPIRE_MATURES;
  41.             i++;
  42.         }
  43.         gv->currScore = result;
  44.         return gv->currScore;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement