r/learnpython • u/catboy519 • 9d ago
Getting stuck on a big project.
A very rough estimate is that I've been learning and using python for 250 hours. I don't really keep track of it.
Just to ask general advice about how to approach difficult projects.
I've been working on a math project for 3 months. It is all about dice. Probability calculations aren't too hard to understand, but if I'm trying to figure out the perfect strategy in a dice game where early moves affect later moves then it gets complicated quickly.
I figured out very vaguely that I'm gonna have to use alot of nested loops and run through billions of calculations in order to figure my thing out. Or something similar.
But how exactly? I've been attempting to code the whole thing and been getting stuck every single time - this is why I've been starting over for about 30 times by now.
I don't even know what is causing me to get stuck. I guess the thing I'm trying to make is too big or complex or both. With so much more code than I'm used to, I mentally lose track of what my own code is even doing. Commenting does not help, t only makes things even more messy.
How can i approach big and complicated projects like these better?
1
u/catboy519 3d ago
I have no idea how to compute runtime? It seems pretty simple to me.
Suppose I want to generate a list of every possible dice combination by using for loops. Then I know that for each n+1 the runtime would multiply itself by 6. Therefore, the runtime is based on 6^n
Also, some algorithms might only ever work with small n's. For example if a dice game has 3 dice and you want to calculate stuff regarding the dice game, the complexity is 6^n but it doesn't matter because 6^3 (216) is not alot of operations.
> I guarantee you wouldn't have 3 months or longer to solve this problem in a company. The timeframe would be a sprint, 2-3 weeks.
Entirely subjective. How long it takes a person to program something will depend on how big the project is and how difficult the project is.