r/pythonhelp • u/slimjim441 • Mar 12 '25
Guidance for CS50p Final Project
I'm working on my final project for the CS50 python course, a sort of dice-rolling simulator game for 2 players. I feel like I have a good handle on the bulk of the code and have my functions working properly, but there's one detail I'm snagged on, and I can't seem to figure it out. I can post more details here if needed, but I'm just trying to put out some feelers to see if anyone can help point me in the right direction/give me tips as to where I'm failing to implement things correctly. Thanks :)
1
Upvotes
View all comments
Show parent comment
1
u/FoolsSeldom Mar 13 '25
That's better. Just a few thoughts on a quick look through (will take more time later if I get chance - not found the problem you called out yet as just trying to get to know the code)
Not good practice to have methods/functions with "side effects"
for example,
get_successful_dicedoes two things:self.dice_rolls = ...@propertyto get current valueresolve_turnfor example (not clear to me what remaining_player_diceis used and why it isn't an attribute of aPlayer`)mainisn't a fairly simple flow of calls but has a mix of setup, output, and logicinitiativeyou might want to look intoItertools.cycle