Re: Python coders, can this code be more efficient?

2018-11-20 Thread AudioGames . net Forum — Developers room : connor142 via Audiogames-reflector


  


Re: Python coders, can this code be more efficient?

hi, thanks for your help yall! I'm just starting to try and wrap my head around objects, modules, and classes. It's some of the hardest to understand things I've seen so far but I'll be damned if I stop now lol.

URL: http://forum.audiogames.net/post/394202/#p394202




-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector


Re: Python coders, can this code be more efficient?

2018-11-19 Thread AudioGames . net Forum — Developers room : Hijacker via Audiogames-reflector


  


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