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

Equalizer Agent #92

Closed irobert4 closed 4 years ago

irobert4 commented 4 years ago

I've finished editing the Equalizer code so that there is more of an emphasis on inflicting points rather than voiding suits, and I think we can consider it finished. A couple of additional notes:

There was a bug in the adjudicator where it wasn't masking the points cards for the players following during the first trick. This has been fixed.

I've updated play_hearts to get rid of hardcoded agents/agent positions, agents should now be generated randomly per position.

irobert4 commented 4 years ago

I don't think that we ever coded in a points check for the players following the trick leader, we only accounted for the trick leader itself.

As for the players playing points if points are all that they have, I thought we only decided on this when David and I stumbled over the scenerio where a random agent was unable to play any cards because hearts had not been broken, but hearts were the only cards that a player had left.

Lastly, I'm not sure how realistic it would be for a player to be dealt a hand with only points cards. I don't see the shuffle routine ever giving us a deck where one of the players has been assigned only points cards, because then you'd be void in all clubs/diamonds/spades (non-queen).

I can add in a check for it if you guys are concerned though, do you have any recommendations for checking for the existence of cards in other suits besides just looping through it? (Since we'd end up with a loop to check for the existence of cards in clubs/diamonds/spades, then another loop to negate the points cards if the former loop succeeds in finding something)

aphelps4 commented 4 years ago

Having all points is definitely rare so it is not like it would happen often but the issue is that when we are collecting 10 TB of data, it most likely will happen at least once during that time so I believe we need to account for that (and give it a state with all points to ensure that it would work properly). As for accomplishing this, while doing the for loop in the first_trick method, we could have a counter that increments whenever it finds a points card and then have a check at the end to see if that counter got to thirteen. If it did, we know all the cards are points and we would keep the original encoded state whereas if the number is less than thirteen, we can keep the encoded state that was just created. We can even use the fact that we have a copy of the encoded state to do this efficiently without having to change encoded state back and forth.

irobert4 commented 4 years ago

Ok, I'll go ahead and make the changes then.

Should we at least prevent the queen from being played on the first trick?

irobert4 commented 4 years ago

@aphelps4 @davidjha Made the additional fix Angela suggested.

Also made it so at the very least you can't play the queen on the very first trick.

aphelps4 commented 4 years ago

Sounds like a good solution. It looks good to go, thank you.