All pastes #266382 Raw Edit

Something

public text v1 · immutable
·published 2006-12-04 02:07 UTC
rendered paste body
int roomNew(int roomP, int change){           
               
     if (change == 1) { //NORTH
        if (roomP != (3*ROOM_ROWS-1) || roomP != ((3*ROOM_ROWS)+1)) {
                  if (roomP == 1) { //the only room that breaks the formula is room 1.  This fixes that
                     roomP = 3; 
                     }  
                  else roomP = roomP + 3; 
                  }
        else printf("You can't go North from here!");
        }
        
     if (change == 2) { //EAST
        if (roomP % 3 != 1)
        roomP = roomP + 1; else printf("You can't East from here!");
        }     
        
     if (change == 3) { //SOUTH
        if (roomP != (2 || 4))
        roomP = roomP - 3; 
        else printf("You can't go South from here!");
        }
        
     if (change == 4) { //WEST
        if ((roomP % 3) != 2)
        roomP = roomP - 1; 
        else printf("You can't go West from here!"); 
        }
     return roomP;
}