tomasf1234

Donovic isLegal

Jun 4th, 2014
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. int isLegalAction (Game g, action a){
  2.     int flag = TRUE //returned true if test is passed.
  3.    
  4.     //Checks for a valid action code
  5.     while(a.actionCode =< 7 && a.actionCode >= 0){
  6.         flag = TRUE;
  7.     }
  8.     //Checks to see if inputted chars are allowed, ie. L, R, B
  9.     if(a.actionCode == 3 && ){
  10.  
  11.         int counterLegalInput = 0;
  12.         while(a.destination[counterLegalInput] != '\0'){
  13.             if((a.destination[counterLegalInput] != "L" || a.destination[counterLegalInput] != "R" ||
  14.                 a.destination[counterLegalInput] != "B") && flag == TRUE){
  15.                 flag = FALSE;
  16.             }
  17.         }
  18.  
  19.     checks to see if path is ok, one stage at a time
  20.     int charCounter = 0;
  21.     int destLen = strlen(destination);
  22.     while((charCounter <= destLen) && flag == TRUE){
  23.         char testPath[charCounter + 1] = a.destination[0];
  24.         int i = 1;
  25.         while( i <= charCounter){
  26.             strcat(testPath, a.destination[i]);
  27.         }
  28.         coord testPlace = convertPathToPoint(testPath);
  29.         if(testPlace.x < oob1x &&)
  30.     }
  31.  
  32.     }
  33.     return flag;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment