19
4
You are a foreign trader, hoping to make a profit. There are 5 goods people wish to trade: A
pricots, B
oars, C
anaries, D
affodils, and E
arwigs. Starting in the winter, you need to decide what to produce. Then, in the fall, you travel and spend your days trading for a profit.
Gameplay
You start the game with 10 of each product in storage. Each year, you will consume 2 of each product.
At the beginning of the game, you receive a list of 5 products, along with the amount you will be able to produce each year (ex:5-A,6-B,3-C,12-D,4-E
). You then will return a letter A through E deciding what to produce.
Then, in the fall time you will bring your products (including those in storage) to the market. You have 50 turns to trade.
You must decide if you want to P
urchase, S
ell, or L
eave the market. The buyers will then be paired up randomly with the sellers. If a group has extra, the random extras will miss out this turn. If a trader is skipped, they will receive S
, otherwise, T
. The seller must decide what he wants to sell, and amount (ex:3-A
), and then what he would accept (ex:5-B,2-D,1-E
) (The values are any of not all of). The buyer will then be told what product the seller is selling, then the products the seller will take for it, and he can choose a product to trade for it (ex: D
or X
for nothing).
After all trades are over, or after you have left the market, you will consume 2 of each product, and the year starts over. If you have less than 2 of any 1 product, you will die (and passed Q
).
Your score will be the number of years you last, and after 50 games, your scores will be averaged for your total score.
Optional moves
At any time you can return G
to query your goods
At any time you can return N
to query the number of new products in your inventory (produced by any player in the past year, and new products will be traded before old products)
At any time you can return T
for the current Turn phrase: P
roduce, M
arket, or T
rading
During a trade, you can query I
for an identifier unique to the player you are trading with.
During a trade, you can return M
to query the number of people trading
How to code it:
You may use any standard language, and must include a command.txt
which is the command to run your program.
The general flow of your program should be:
Get productivity
While alive:
Output product you want to produce
While in trading:
Output whether you want to purchase or sell
Get whether or not you were skipped. If not skipped:
If purchasing:
print product you offer, and products you will accept
Else:
Get product offered, products being accepted, and choose the product you will give
I have a tester program here. To use it, create a folder in the bots folder with your bot's name. Add a command.txt
, your program, and anything else your program needs. I will be adding submissions as they come in. If you don't want to install the languages required to run some or all of them, you just need to delete the command.txt in the bot's folder.
Inner Workings
There will be 5 bots for each program submitted. The ID will be different for bots of the same type.
I will call the amount a person can produce a given product the productivity. Each product will be given a base productivity, where all of the base productivity will add up to 30. One of the scores will be ensured to be at most 3, and all will be at least 2.
Then, each player's productivity will vary from the base productivity (One value will vary by +2, another +1, then +0, -1, and the remaining value will vary by -2).
The base productivity will change from game to game.
Scores:
seer: 10.128 years
level_headed_trader: 8.196 years
introvert: 6.856 years
random_ando: 5.408 years
hoarder_trader: 4.12 years
ratio_trader: 3.532 years
scared_trader: 3.056 years
So, if there are 10 user submitted programs a game will have 60 (10 submitted + 10 x 5 bots) players/traders? Also, I don't think you mentioned what the maximum number of years a game can last for. Only that there will be 50 games, and that trader/player's score for a game will be how long they lasted. – AndoDaan – 2014-08-18T01:52:49.620
No. My bots are no different than the rest. If there are 10 user submitted, there will be
(10 players + 4 my bots)*5
traders. The game is set up so it is impossible for a game go on forever. Eventually everybody will die. – Nathan Merrill – 2014-08-18T01:54:44.927Ah, thanks. It's a very interesting KOTH challenge. I'll certainly try and make a submission. Any programming language is permitted? – AndoDaan – 2014-08-18T02:01:45.703
Yes, any programming language. – Nathan Merrill – 2014-08-18T02:04:20.930
If you fail to consume from any one category, you die? Or from all categories? Eg. if I have no apricots but stuff in other categories, will I die? – Roddy of the Frozen Peas – 2014-08-18T02:11:42.427
Yes. I will modify my post to make that clearer. – Nathan Merrill – 2014-08-18T02:12:27.110
How long does
Scoring.py
normally run? – EaterOfCode – 2014-08-18T14:26:36.907@EaterOfCode With just the bots, and with debug on, it takes about 5 seconds to run. – Nathan Merrill – 2014-08-18T14:32:39.750
Im doing something really stupid probably but it just doesn't end, and I can't
CTRL-C
either – EaterOfCode – 2014-08-18T14:53:43.503@EaterOfCode If you are running it on Windows and your program doesn't provide output/input properly, it will freeze, and you will have to kill it. – Nathan Merrill – 2014-08-18T14:56:04.317
without my bot, it doesn't stop. I now use my bot to forcefully stop it – EaterOfCode – 2014-08-18T14:56:54.313
Let us continue this discussion in chat.
– Nathan Merrill – 2014-08-18T14:57:14.110What does the
T
command return if you're dead?Q
? – Sean Latham – 2014-08-18T21:32:59.780@ipi You won't get anything. I don't prompt any dead controllers for input. – Nathan Merrill – 2014-08-18T21:42:24.937
It's a pity nobody else made a submission. I was looking forward to this KOTH. – AndoDaan – 2014-08-19T11:32:31.217
1@AndoDaan I'm going to put a bounty on it after a week. There will be submissions. – Nathan Merrill – 2014-08-19T12:21:01.840
1@AndoDaan Im busy with one :D – EaterOfCode – 2014-08-19T13:40:38.093
@EaterOfCode and Nathan, ah great. Of course I'll try and contribute a more cerebral bot than I did with Rando. – AndoDaan – 2014-08-19T14:46:03.877
I'm not getting this to run on Windows with a fresh clone. – Moop – 2014-08-19T17:29:20.313
Hmm...it seems I can't run it from the console either on windows. I'm using Pycharm on Windows, and it runs just fine there. Let me see what I can figure out. – Nathan Merrill – 2014-08-19T23:45:40.980
Hey, can you add some example IO? – Beta Decay – 2014-08-24T08:51:38.070
I can't get the game to run on linux. Using only the bots that come with the controller. I just clone, compile and run. It sends the first message to each bot and then waits forever - no responses. – ccarton – 2014-08-24T13:46:27.857
@ccarton That's odd. I don't currently have access to a linux box, last time I used this code it worked. Try removing RandomAndo and/or the Introvert, as they are non-python. – Nathan Merrill – 2014-08-24T14:23:36.630
1@BetaDecay That's tough due to the variety of optional moves. The only outputs that will always happen is the beginning productivity, the final
q
, whether you were skipped, and if you are buying, the seller's offer and accepted products. I hope the inputs are obvious. – Nathan Merrill – 2014-08-24T14:26:55.240Can a bot be stateful across multiple runs? For example, by writing a file to record info about competitors or certain statistical properties? I realize the resource distribution changes with each run, but there are other unknowns that could be estimated and exploited to build a better bot. – COTO – 2014-08-25T08:04:35.283
@COTO you program needs to die across multiple runs, but you are definitely are fine to store information in a file between runs. – Nathan Merrill – 2014-08-25T11:23:01.680
Ha, Rando is smack dab in the middle. That's a win for a random bot. – AndoDaan – 2014-08-27T14:06:26.367