generated from mwc/lab_dice
The most immediate thing that came to my mind with my experience with OOP is how unused to thinking in that way and working with objects I am. In yahtzee_goals.py, I don't know that it would have occurred to me to create a class for each goal. I think I was thinking of objects pretty literally as "things" one can do stuff to or with, e.g. dice that can be rolled. Goals don't immediately jump out as me in the same way, which perhaps highlights how my understanding of OOP probably still could be further developed. I thought a bit more about the difference between methods and functions as I worked through Yahtzee. They seem similar in the sense that either can do things or return values, but methods are more restrictive in that they're tied to particular objects/classes. I had some difficulty when writing the GoalThreeOfAKind class since I kept getting an error that the number of arguments being passed was wrong. I "realized," in the sense that I eventually figured out through trial and error, that self was being passed even if I didn't specify it should be. I imagine if I were to try doing this in unit 1 or 2, instead of treating the game as an object interacting with other objects (the dice and goals), it'd probably be some sort of loop with functions being called to mimic the methods and a declaration of a lot of global variables to keep track of things like score, which goals have been used, the faces of the dice, etc. I feel like with all these functions and variables I might need to be more mindful with making sure to only edit the things I don't need to keep track of if I were to go that route. I think one thing that I'm realizing generally is that I need to consider how best to use multiple files to write things in so that I can focus on particular elements, e.g. goals vs. how the game plays. I hope with more experience I'll get better at planning out how my projects can be written/organized. |
||
---|---|---|
__pycache__ | ||
.commit_template | ||
.gitignore | ||
dice_stats.py | ||
die.py | ||
play.py | ||
poetry.lock | ||
pyproject.toml | ||
yahtzee.py | ||
yahtzee_goals.py |