Can you write a bot that beats Rachel Riley at Countdown? Your input is a list of integers, and a target, and your bot should return instructions to yield a result as close as possible to the target. For example, if your input is [40, [7 2 3]]
, you could return 1 2 * 0 *
, for a result of 42, two away from the target. Note your response must be encoded in Reverse Polish Notation, with operands referenced by index.
1. First, clone the botfights-sdk repository, and change to the countdown directory
$ git clone https://github.com/botfights/botfights-sdk.git
$ cd botfights-sdk/countdown/python
2. Next, edit the get_play() function in sample-bot (get_play takes a tuple of (target, operand_list) like [40, [7 2 3 ]] and should return your code encoded as a RPN string)
3. Test your bot locally
$ python botfights.py local countdown sample-bot.get_play
4. Once your bot is ready to fight online, register to get your credentials, if you haven't done so already
5. Fight your bot remotely to make sure everything works (replace XXXX and YYYY with your credentials)
$ python botfights.py --username XXXX --password YYYYY remote countdown sample-bot.get_play
6. Enter your bot in the BOTFIGHTS VI tournament
$ python botfights.py --username XXXX --password YYYY --tournament_id botfights_vi countdown sample-bot.get_play
7. Rinse, repeat!
1. First, register to get credentials to use the API.
2. Create a new fight like this (replacing XXXX and YYYY with the credentials from step 1):
$ curl -uXXXXX:YYYYY -d '{"game_id":"countdown"}' -X PUT https://api.botfights.ai/api/v1/fight/
{
"fight_id": "2hz4cp22",
"status": "RUNNING",
"version": "0",
"options": {
"min_target": 100,
"max_target": 999,
"num_operands": 6,
"min_operand": 1,
"max_operand": 99,
"num_rounds": 1,
"must_use_all": false,
"allow_reuse": false,
"operators": "+-/*"
},
"state": {
"rounds": {
"0": [ 631, [ 3, 52, 37, 7, 96, 6 ] ]
}
}
}
This fight is one round, your target is 631, and your operands are (3, 52, 37, 7, 96, 6). You could get 631 like this: (96 * 6) + (3 + 52). In RPN, and referencing operands by index, your solution is "4 5 * 0 + 1 +".
3. Submit your play like this:
$ curl -uXXXXX:YYYYY -d '{"game_id":"countdown", "version":"0", "play":{"0":"4 5 * 0 + 1 +"}}' -X PATCH https://api.botfights.ai/api/v1/fight/2hz4cp22
{
"status": "FINISHED",
"version": "0",
"options": {
"min_target": 100,
"max_target": 999,
"num_operands": 6,
"min_operand": 1,
"max_operand": 99,
"num_rounds": 1,
"must_use_all": false,
"allow_reuse": false,
"operators": "+-/*"
},
"score": 0,
"state": {
"rounds": {
"0": [ 631, [ 3, 52, 37, 7, 96, 6 ] ]
}
}
}
That is, you PATCH
your dictionary of plays to the fight endpoint returned in your create call above. Note you need to pass in the countdown
game_id and fight object version 0
.
3. Once your bot is ready, create a fight in a Countdown tournament like this:
$ curl -uXXXXX:YYYYY -d '{"game_id": "countdown", "tournament_id": "botfights_vi"}' -X PUT https://api.botfights.ai/api/v1/fight/
4. Questions? Head over to our discord channel. Good luck!
tournament | time start | time end | champion | prize |
BOTFIGHTS V — Botfights Does Countdown | 2022-02-25 00:00:00 | 2022-03-04 00:00:00 | micaherne ★ | 0.0005 BTC⤴ |
BOTFIGHTS VI — 8 out of 10 Bots Does Countdown | 2022-03-04 00:00:00 | 2022-03-11 00:00:00 | sasuke420 ★ | 0.0005 BTC |
BOTFIGHTS VII — Rachel Riley's Revenge | 2022-03-11 00:00:00 | 2022-03-18 00:00:00 | 0.0005 BTC | |
BOTFIGHTS VIII — Vorderman Strikes Back | 2022-03-18 00:00:00 | 2022-03-25 00:00:00 | 0.0005 BTC |
time | user | tournament | score |
2022-03-24 11:26:00 | sasuke420 ★ | BOTFIGHTS VII | 0 |
2022-03-24 07:47:03 | sasuke420 ★ | BOTFIGHTS VII | 0 |
2022-03-21 18:24:31 | sasuke420 ★ | BOTFIGHTS VIII | 477711957692392434984993752979953025106462046753964711734197863951200320827517523888177142947038939383279275093656964418487 |
2022-03-21 18:06:18 | sasuke420 ★ | BOTFIGHTS VIII | 0 |
2022-03-21 13:39:30 | sasuke420 ★ | BOTFIGHTS VIII | 8 |
2022-03-21 12:12:20 | sasuke420 ★ | BOTFIGHTS VIII | 2812 |
2022-03-21 10:54:17 | sasuke420 ★ | BOTFIGHTS VIII | 23590 |
2022-03-21 00:47:58 | sasuke420 ★ | BOTFIGHTS VIII | 3181322 |
2022-03-20 19:58:36 | sasuke420 ★ | BOTFIGHTS VIII | 152667551811 |
2022-03-17 16:06:52 | user:a5kq6zmq | BOTFIGHTS VIII | 45976040486561629819472347014622731691601 |