r/Python • • Mar 24 '18

A path finder i recently made in Python PyGame

1.5k Upvotes

111 comments sorted by

View all comments

Show parent comments

2

u/boijunior Mar 24 '18

I see your point. I guess in this case the only way to reduce indentation I see is to "spread" the code out more by placing each loop into its class but I don't see them as removable. I will look back over it.

2

u/Atrament_ Py3 Mar 24 '18

Not wrong. And for a "prototype" code it is rather clean.

Your algorithm basically solves the same problem at different scales, right ?

If so the "detour" part could be a single function called over different parameters, for instance.

Ideally you would end up with the "high order logic" in a main block, and "problem solving logic" in some other blocks.

Much easier to maintain ( also to extract to reuse)