Hey, I'm not expecting to spend a whole lot more time on this exercise, however I can't help thinking about ways to improve it...
What if I used a class to handle the players? (I'm at my actual day job right now, so I can't look at it) The problem I see is how to handle instantiating some random amount of players? If you look at the code I have now I'm handling it with dictionaries, which I think is a good method, however could I do the same type of thing for classes?
Definitely! I think that's a good idea. You can have an overarching Game class that maintains a list of players and the list of cards, and ask for how many players to create in the constructor. Then, each player can be a Player instance, you can have a CardDeck, and a Card...I think classes and objects are really useful for organizing your code as it gets bigger. You can keep most of the same actual logic, it just provides a convenient, readable structure.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hey, I'm not expecting to spend a whole lot more time on this exercise, however I can't help thinking about ways to improve it...
What if I used a class to handle the players? (I'm at my actual day job right now, so I can't look at it) The problem I see is how to handle instantiating some random amount of players? If you look at the code I have now I'm handling it with dictionaries, which I think is a good method, however could I do the same type of thing for classes?
Definitely! I think that's a good idea. You can have an overarching
Gameclass that maintains a list of players and the list of cards, and ask for how many players to create in the constructor. Then, each player can be aPlayerinstance, you can have aCardDeck, and aCard...I think classes and objects are really useful for organizing your code as it gets bigger. You can keep most of the same actual logic, it just provides a convenient, readable structure.