int main(void) {
	int toothpicks = 21;
	int othermove;
	int mymove;
	printf ("To give this program the first move, type 0 as your first move\n");
	while (toothpicks > 0) {

		printf ("There are %d toothpicks.  How many do you want?", toothpicks);
  		scanf("%d", &othermove);

/* Check for special case where program takes first move */

		if (othermove == 0 && toothpicks == 21) {
			mymove = 1;
			printf ("You gave me the first move.  I take %d\n", mymove);
		}

/* typical case of gameplay */
		else {
			while (othermove > toothpicks || othermove > 3 || othermove < 1) {
				printf ("That's an illegal move.  Try again.\n");
				printf ("There are %d toothpicks.  How many do you want?", toothpicks);
  				scanf("%d", &othermove);
			}

/* subtract opponent's move and see if I win */

			toothpicks = toothpicks - othermove;
    			printf ("You took %d toothpicks.  There are %d left.\n", othermove, toothpicks);
			if (toothpicks <= 0) {
				printf ("CHOMP!  I win!\n");
				break;
			}

/* make my own move */

			if (othermove == 1)
				mymove = 1;

			if (othermove == 2)
				mymove = 2;

			if (othermove == 3)
				mymove = 3;

/* don't take more toothpicks than there are! */

			if (mymove > toothpicks)
				mymove = toothpicks;
		}


		toothpicks = toothpicks - mymove;

    		printf ("I take %d.\n", mymove);
		if (toothpicks <= 0) {
			printf ("CHOMP!  I lose!!\n");
			break;
		}
	}

  return 0;
}


			