I am currently building a MUD (Multi-User-Domain) for an rpg game. Doing this entirely in Python to both make a game I enjoy, and learn python. A problem I am running in to, and due to the extreme specificity of the question, I've been unable to find the right answer.
So, here's what I need, in a nut-shell. I don't have a good snippet of code that fully shows what I need as I'd have to paste about 50 lines to have to 5 lines I'm using make sense.
targetOptions = ['Joe', 'Bob', 'zombie', 'Susan', 'kobold', 'Bill']
A cmd in our game is attack, where we type 'a zombie' and we then proceed to kill the zombie. However, I want to just type 'a z'. We've tried a few different things in our code, but they're all unstable and often just wrong. One of our attempts returned something like ['sword', 'talisman'] as matches for 'get sword'. So, is there a way to search this list and have it return a matched value?
I also need to just return value[0] if there are say, 2 zombies in the room and I type 'a z'. Thanks for all your help ahead of time, and I hope I was clear enough for what I'm looking for. Please let me know if more info is needed. And don't worry about the whole attacking thing, I just need to send 'zo' and get 'zombie' or something similar. Thanks!