Re: Python coders, can this code be more efficient?
Hi,well, those ifs can be simplified and arranged much cleaner by using a callback system.You for example arrange a dictionary which contains the key input by the player (a, b, c, whatever) and a function handle as value (just an example). Whenever the player enters something, you can easily check if the dictionary contains a key with that exact same text. If yes, call this function (with a given set of parameters which are equal for each of those functions, see blackbox concept), and if no, print some error screen and continue running your while loop.Best Regards.Hijacker
URL: http://forum.audiogames.net/post/394072/#p394072
--
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector