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; }