This is going to take me a while to finish and may never be fully done. Don't expect this to be posted anytime soon. However, this will be an ongoing project under development.
Rules of the KoTH
I am working on clarifying these and will post when I've finished. If you have any questions about the Monopoly part, please post them as comments below. But nothing about the KoTH just yet.
Rules of the KoTH
I have written (still finishing) a
Player class in Python which contains all of the things that a Monopoly player can do. Your task is to rewrite 2 of the functions that can change your player's behaviour.
While thinking about how to make this KoTH, I listed out the complete process that gives you a chance to change what you do. Let's go over that process! This flowchart shows the process for each turn. Green items show the choices that you have to make.
This is the text version:
1. Roll dice and move 2. Is the property owned by the Bank? 1. Yes. Nothing happens. 2. No. Pay the due rent. 3. Choice of: 1. Buy 2. Auction 4. Choice of: 1. Trade 2. Build 3. Mortgage 4. Unmortgage 5. Move On 5. Repeat until bankrupt Auction 1. Choice of: 1. Play the auction 2. Don't play the auction 2. Are you playing the auction? 1. Yes. 1. Choice of: 1. Bid new max 2. Skip one round 3. Skip all rounds 4. 'All in' 2. Repeat until 1 player left bidding 2. No. Don't do anything. Trade 1. Choose a player to trade with 2. Offer properties and/or money 3. Does the other player agree with the trade options? 1. No. They counter offer. Do you like their options? 1. No. Do you want to continue negotiating? 1. Yes. Go to point 2 above 2. No. The trade is over. 2. Yes. You trade the agreed upon items. 2. Yes. You trade the agreed upon items
But, for you coders out there, I'll explain using a bit of code.
Your submission should contain a single class that inherits from
Player. You may add in as many extra attributes as you want, but in order to be used, your code must refer to them. I'm not editing the controller just for your bot to work.
However, each class must look like this
class NameOfPlayer(Player): def turn(self, square, roll): (code that determines your actions per turn) def auction_action(self, price, bidders): (code that determines your auction actions) def trade_actions(self, players, last_offer): (code that determines your trading actions) (any other functions you want)
turn function will return 3 numbers as a list e.g.
[1,2,3] which are the results of the choices above. The first item should be either
2 (Buy or Auction), the second should be one of
5 (of the
4. Choice of: options) and the third should be either
1 (play the auction) or
0 (don't play the auction) such as
[1,5,0] would buy the property, move on to the next player and not play the auction on this turn (doesn't matter as there wasn't an auction).
auction_action function will return either a number (your bid) or one of
a (all in),
s (skip this round) or
q (quit auction), which determines what you will do on that round of the bidding. This continues until either you quit the auction of you are the only one left.
trade_actions function will return a list every time it is called. The list consists of
[agree with previous offer (as a bool), properties to trade (as a list), cash to trade (as an int)]. When a trade has just begun, the first item in the list will be ignored and the
last_offer parameter will be ignored. The
last_offer parameter contains the second 2 items returned by the person you are negotiating with, so that you can decide whether you want to continue trading or not.
If you lose all your money, your program with be taken out of the active players and placed into the results table. The last one standing wins!