carlofazioli / cardiathena

A project to study strategies in the game of hearts, using distributed computing, AI, and data analytics.
GNU General Public License v3.0
6 stars 1 forks source link

Made Adjudicator Stateless #60

Closed irobert4 closed 4 years ago

irobert4 commented 4 years ago

I've completed making the adjudicator stateless, I added the state variable into the Game Manager.

Angela I know that you asked me to put it into play_hearts.py, but I'm not so sure about that. @c-to-the-fazzy @kruzaavn Should the state variable be in play_hearts.py or in the Game Manager?

carlofazioli commented 4 years ago

My thoughts are the following:

The GameManager has an Adjudicator as a data member. The Adjudicator previously had the state as a data member. Moving the state out of the adjudicator, the next layer up would be for it to be a data member on the GameManager.

It does not really make sense to me, off the top of my head, for the state to occupy a place as a global variable outside the GameManager.

aphelps4 commented 4 years ago

@irobert4 Let me clarify on what I meant when I said the state variable should be in play_hearts. I meant that I believe play_hearts should make the state and pass it into base.py for the GameManager to use and change as it pleases. It seems like GameManager should be able to play any game as long as it is given the right materials but if we initialize the state there, it becomes a GameManager specifically for hearts since the states are unique for the game. I was thinking play_hearts is specifically for hearts so there would be no issue in referencing the hearts state there and passing that in so base.py can remain a file that could be used for any game at any time.

irobert4 commented 4 years ago

Ok, I think I understand what you're saying now.

Still though, if the State is meant to be a data member on the Game Manager as Carlo suggests,I think it makes more sense to have the Game Manager initialize it within itself instead of passing it in from somewhere else.

carlofazioli commented 4 years ago

OK, I see. Angela, I think you're right.

Just as the hearts adjudicator is created in play_hearts.py but then passed into the GameManager to be set as a data member, so should be the hearts state.

I don't think there is a convenient way to have the GameManager know that it is supposed to create a hearts state during its init without making some overly complex machinery, or a derived class.

irobert4 commented 4 years ago

In that case I've gone ahead and edited play_hearts.py and base.py so that the Game Manager now accepts the state from play_hearts.py.