Can someone check this code?

[code]The hallway is a room. The hallway is dark.

Instead of looking for the second time:
say “You are running low on food, make sure you find and eat some soon.”.

The player carries a Food Recycler. The Food Recycler has a number called food-remaining. The food-remaining of the lamp is 3.
Every turn:
if the food-remaining of the Food Recycler is greater than 0;
decrease the food-remaining of the Food Recycler by 1;
if the food-remaining of the Food Recycler is 0;
say “The food recycler is out of stuff to make into food for you.”;
now the food-remaining of the lamp is -1.
The Wheat Bag is here. The Wheat Bag can can be full or empty. The Wheat Bag is full.
Refilling is an action applying to one thing. Understand “fill [something]” and “refill [something]” as refilling.
Check refilling:
say “[The noun] can’t be refilled.” instead.

Instead of refilling the Food Recycler:
if the Food Recycler is enclosed by the location;
if the Food Recycler is full;
now the Food Recycler is empty;
increase the fuel-remaining of the lamp by 500;
say “You drain the Wheat Bag into the Food Recycler[run paragraph on]”;
say “, and now it starts making food for you to eat giving you the freedom of life[run paragraph on]”;
say “.”;
otherwise;
say “The Wheat Bag appears to be empty.”;
otherwise;
say “You have nothing to fill the Food Recycler with.”.
[/code]

I am doing this for an assignment in my Computers class. I am just wondering why I keep getting the error “You wrote ‘The Wheat Bag can can be full or empty’ : but only a room, a thing or a kind can have such adjectives applied to it, so that ‘a dead end can be secret’ is fine but ‘taking can be secret’ would not be, since ‘taking’ is an action and not a room, thing or kind.” I am sure it is a simple mistake. Thanks for any help.

You wrote the word “can” twice by accident, which caused the confusing error message:

The Wheat Bag is here. The Wheat Bag can can be full or empty. The Wheat Bag is full.

Thank you so much! I said it was a simple mistake.

You really have to be precise with what you put in!
:slight_smile:

You have some other issues as well.

You haven’t finished changing lamp -> Food Recycler throughout your code.

Your conditionals and the associated control flow are broken. They should look like:

if some condition:
	do something;
	do a second thing;
otherwise:
	do something else;

Note the colons rather than semicolons after the lines with if or otherwise and the indentation of the things to be done when a condition is true.

Stuff like:

now the Food Recycler is empty;
increase the fuel-remaining of the lamp by 500;

could be simplified (assuming lamp -> recycler) to “now the food-remaining of the Food Recycler is 500;” In other words, you don’t need to empty it to 0 and then increase it; you can directly set the variable from whatever it currently is to 500.

While you’ve defined the wheat bag as able to assume a state of full or empty, you haven’t done so for the recycler, so I expect that the compiler will barf when you test the recycler for full/empty unless you define what they mean (empty: food-remaining is 0; full: food-remaining is 500 (or whatever)).

I suspect that are other problems as well, but that’s probably enough to get started with. Feel free to come back for more help once you have this stuff handled.

Finally, these kinds of issues are to be expected when you’re learning a new language, particularly if you’re new to progamming entirely. Don’t be discouraged. Keep at it and it will come more naturally with time. Good luck.