inter.c
extern void use(char *input[8])
{
	int i;
	int j;
	int room;
	int items[2];
	int cur_phrase;
	char *words[4];

	putchar('\n');

	/* initialize words to null */
	for (i = 0; i < 4; i++)
		words[i] = NULL;

	/* condense input to four words at most */
	for (j = 0, i = 1; i < 8; i++) {
		if (input[i] == NULL ||
			strcmp(input[i],"on") == 0 ||
			strcmp(input[i],"the") == 0) {
			continue;
		} else {
			words[j] = input[i];
			j++;
		}
	}

	/* Make sure something was used */
	if (words[0] == NULL) {
		printf("Use what?\n");
		return;
	}

	/* room id for item information */
	room = room_id();

	/* process word by word */
	for (j = 0, i = 0; i < 3 && j < 2; i++) {
		if (words[i] == NULL) { 
			items[j] = -1;
			break;
		}
		if ((cur_phrase = unique_item(room, NULL, words[i])) == -2) {
			printf("Which %s?\n",words[i]);
			return;
		} else if (cur_phrase == -1) {
			if ((cur_phrase = unique_item(room, words[i], words[i+1])) == -1) {
				printf("There is no %s here.\n",words[i]);
				return;
			}
			i++;
		}
		items[j++] = cur_phrase;
	}

	/* parsed items, now use them */
	interact(room, items[0], items[1]);
}
/* use item word parsing:
 *	I have simplified this. It's still a little gross to look at, but it
 *	should make a lot more sense now!
 */
use item word parsing:
I have simplified this. It's still a little gross to look at, but it
should make a lot more sense now!
use item word parsing : I have simplified this . It ' s still a little gross to look at but it should make a lot more sense now!
extern void use(char *input[8])
{
	int i;
	int j;
	int room;
	int items[2];
	int cur_phrase;
	char *words[4];
	putchar('\n');
	for (i = 0; i < 4; i++)
		words[i] = NULL;
	for (j = 0, i = 1; i < 8; i++) {
		if (input[i] == NULL ||
			strcmp(input[i],"on") == 0 ||
			strcmp(input[i],"the") == 0) {
			continue;
		} else {
			words[j] = input[i];
			j++;
		}
	}
	if (words[0] == NULL) {
		printf("Use what?\n");
		return;
	}
	room = room_id();
	for (j = 0, i = 0; i < 3 && j < 2; i++) {
		if (words[i] == NULL) { 
			items[j] = -1;
			break;
		}
		if ((cur_phrase = unique_item(room, NULL, words[i])) == -2) {
			printf("Which %s?\n",words[i]);
			return;
		} else if (cur_phrase == -1) {
			if ((cur_phrase = unique_item(room, words[i], words[i+1])) == -1) {
				printf("There is no %s here.\n",words[i]);
				return;
			}
			i++;
		}
		items[j++] = cur_phrase;
	}
	interact(room, items[0], items[1]);
}
extern void use ( char * input [ 8 ] ) { int i ; int j ; int room ; int items [ 2 ] ; int cur_phrase ; char * words [ 4 ] ; putchar ( ' \n ' ) ; for ( i = 0 ; i < 4 ; i ++ ) words [ i ] = NULL ; for ( j = 0 , i = 1 ; i < 8 ; i ++ ) { if ( input [ i ] == NULL || strcmp ( input [ i ] , " " ) == 0 || strcmp ( input [ i ] , " " ) == 0 ) { continue ; } else { words [ j ] = input [ i ] ; j ++ ; } } if ( words [ 0 ] == NULL ) { printf ( " \n " ) ; return ; } room = room_id ( ) ; for ( j = 0 , i = 0 ; i < 3 && j < 2 ; i ++ ) { if ( words [ i ] == NULL ) { items [ j ] = -1 ; break ; } if ( ( cur_phrase = unique_item ( room , NULL , words [ i ] ) ) == -2 ) { printf ( " \n " , words [ i ] ) ; return ; } else if ( cur_phrase == -1 ) { if ( ( cur_phrase = unique_item ( room , words [ i ] , words [ i + 1 ] ) ) == -1 ) { printf ( " \n " , words [ i ] ) ; return ; } i ++ ; } items [ j ++ ] = cur_phrase ; } interact ( room , items [ 0 ] , items [ 1 ] ) ; }
use item word parsing:
      I have simplified this.
use item word parsing : I have simplified this .
/* initialize words to null */ /* condense input to four words at most */ /* Make sure something was used */ /* room id for item information */ /* process word by word */ /* parsed items, now use them */