ajamesVISD / AdventureGalley

A world to explore. An ongoing project of students at Vashon Island High School.
0 stars 9 forks source link

Items should be able to have names with more than one word #37

Open ajamesVISD opened 6 years ago

ajamesVISD commented 6 years ago

Right now, commands can only take the form

examine book

which sends the String "examine" to the handle(String s) method of a book item in the room. It does so by chopping the first and last words of the string "examine book." So if we typed "examine the huge green magic book" it would still only send the word "examine" to the handle(String s) method of the book.

Now we need to be able to have an Item named "huge green magic book" So if we type:

examine huge green magic book

and there was a huge green magic book in the room, the word "examine" would go to the handle(String s) method of the huge green magic book.

As a general strategy, start looking for matches from the right. So we would look for matches for, in order:

book magic book green magic book huge green magic book

For now, don't try putting a book and a huge green magic book in the same room. We will deal with that complication later.

ajamesVISD commented 6 years ago

Also, we need to able to type:

help
look
jump