A POMDP that plays a two-player Hearts variation.
For the two-player variation of hearts, all cards are removed except twos, fours, sixes, eights, tens, queens, and aces. 13 of each of the remaining 28 cards are dealt to each player, and the remaining two cards are not used in the game.
The POMDP uses a rather naive formulation in which the opponent is modeled as part of the environment, and takes random actions (as allowed by the rules).
To run this code, you must first have Python 3.9 installed, as well as Poetry.
To build the virtualenv and install dependencies, run:
poetry install --no-root
plan_hearts.py
is an example script that plans a policy and uses it to play a
single game of hearts. Policy planning is done online, so the policy is updated after
each observation is received. It can be run as follows:
poetry run python plan_hearts.py
If you want to play against the agent, you can do that through a simulator:
poetry run python -m simulator