A Python framework to allow AI algorithms to compete at playing Monopoly
This project is maintained by richard-shepherd
The deadline has been extended by a week. The new closing date is midnight London time 4th February (ie, between the 4th and 5th). This is to give entrants time to code for the new eminent domain rule.
Eminent domain is now fully implemented. See the "Differences between the standard rules and Monopyly rules" section of the Rules and prizes page.
It's the closing date for entries!
I've added two features to try to reduce the number of 'boring' games. A boring game is one where no player gets a complete set and where the game goes to the maximum number of rounds with all players slowly accumulating cash. The winner in these games is the one who (just by luck) got the higher value properties.
The first change is that we play all combinations of 2-player, 3-player and 4-player games when we play tournaments. Two player games in particular make it more likely that players will get complete sets.
The second change is more radical: the 'eminent domain' rule. If a game is boring, then all properties are compulsorily purchased after 200 turns and re-auctioned. This benefits AIs that have implemented a good auctioning algorithm. Tournaments now play the complete set of games with the eminent-domain rule as well as the complete set without it.
Fixed a bug where mortgaged properties that are returned to the bank (when a player goes bankrupt) would remain mortgaged. They are now unmortgaged when this happens.
Thank you to Huw Roberts for spotting this and pointing it out!
When a deal is proposed to you, you now receive the Player object for the player who proposed it, in the proposed_by_player field of the DealProposal object.
There is a new method on the PlayerAIBase API, received by all players when a deal has been completed successfully.
def deal_completed(self, deal_result):
'deal_result' is a DealResult object (monopyly/game/deal_result.py) which holds the
details of the deal:
Happy New Year, Monogymists!
Monopyly now has a limit of twenty seconds total processing time for each AI in each game. The PlayerState has a property 'ai_processing_seconds_remaining' which lets you know how much time your AI has left in the game.
I think that twenty seconds should be enough processing time for AIs. The samples only use a few milliseconds per game, though they are not particularly clever and I can imagine better AIs needing a lot more.
The final will be played as a tournament of twenty four games between four players, so if each AI uses all of its twenty seconds, the final will take approximately thirty minutes to play.
Remember that there is a prize - as well as considerable kudos - for the AI with the most efficient code. This will be the AI in the final which uses the least processing time per turn it plays.
Changed the get_out_of_jail() method. It is now passed the game-state as well as the player:
def get_out_of_jail(self, game_state, player):
Started thinking about how to do the graphics. I had been thinking about doing this with pygame, but that seemed rather complicated and low-level. Bel Lobley gave me a good idea: to do the graphics in C#, and to communicate the game-state between the Python code and C# somehow. I rather like this idea.
My current thought is to send data using a messaging protocol between the Python code and C# front-end. I'm currently thinking of using ZeroMQ and Protocol Buffers for this. To be honest, this may end up being more complicated than just writing the graphics in pygame, but it will a good excuse to learn ZeroMQ which I've wondered about doing for a while, and an opportunity to brush up on proto-bufs, which I haven't looked at in anger for a while.
The coding challenge is now open. Welcome to all the Monopynauts who have already entered!
Added two new events to the PlayerAIBase API:
Cleaned up main.py and made it easier to switch between playing tournaments and playing a single game.
Added information about the differences between standard Monopoly rules and Monopyly rules to the rules page.
The first version of the Monopyly framework is now available. There are no graphics yet but the APIs and the game engine all work. The framework includes four sample AIs that you can use to help get you started.
Thank you very much to Nick Pollard for helping test the API and suggesting a number of significant improvements to it.