Take into consideration each npc’s print_interaction.Find a larger list of ACCEPTABLE_INTERACTS words.The entity the parser has determined as most the most likely entity the player is trying to interact with location ( str) – The location in which the player is trying to interact.Compare every npc and pick the one where the most words of the user input match the name.(Could potentially be an issue if there are overlapping keywords) If only one interaction is possible then the npc of that interaction is returned, else the parser continues below.Check if the text contains any of the acceptable interaction words such as “talk”, “interact”, etc… If no matches are detected then the parser returns.interact_parser ( choice: str, location: Location ) → Entity ¶Ī bit more robust parser for picking a npc to interact with. The piece of equipment the parser had determined as the most likely the player is trying to equip player ( str) – The player trying to equip something.Compare every item and pick the one where the most words of the user input match the name.Check if any of the words in the user input match an acceptable word for equipping.Clean up user input and remove Stopwords. equip_item_parser ( choice: str, player: Player ) → Equipment ¶Ī more robust filter for deciphering what item the player desires to equip, wether Take into consideration each exit’s print_interaction.Find a larger list of ACCEPTABLE_MOVEMENTS words.The direction the parser has determined the user is trying to go in current_location ( Location) – The location the user is currently at and against which to check the exits direction and names.Compare every location and pick the one where the most words of the user input match the name.If one of the words is a cardinal direction or a number equivalent to one of the cardinal directions then return that, else the parser continues below.If only one exit is possible then the direction of that exit is returned, else the parser continues below.Check if the text contains any of the acceptable movement words such as “go”, “walk”, etc… If no matches are detected then the parser returns.Clean up user input and remove Stopwords. direction_parser ( choice: str, current_location: Location ) → ¶Ī bit more robust parser for picking a direction you want to go in.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |