-
Notifications
You must be signed in to change notification settings - Fork 5
/
challenge.txt
141 lines (91 loc) · 6.05 KB
/
challenge.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
KotH: Bots to play the Grid Game
This is Grid Game (link)
(picture here)
It's a game based on cellular automata, where the aim is to remove all of the pieces belonging to your opponent.
How it works:
* There are two kinds of piece in the game, cities and walkers.
* Each player starts with one city (marked with C and a number, which is it's health), which will regularly send out walkers (marked with a number, initially the number 1) in a given direction.
* The player can change the direction of all of their walkers to be north, south, east or west at any time.
* When walkers can't go any further, they will stay still and can be joined by other walkers, increasing their number.
* When 10 walkers join up, they become another city.
* When walkers meet walkers or cities belonging to the opponent, they deal damage to the opponent equal to their number, and take damage equal to the opponent's number.
* Damage is dealt to all adjacent opponent pieces.
* There is no way to replenish the health of a city.
* The game ends when either player has no pieces remaining, or when a clear stale-mate is reached.
## The Challenge
To write a bot to play Grid Game, and defeat as many rival bots as possible.
* A bot is some code which will be run on each turn of the game.
* It can only be JavaScript, sorry.
* The size of the code is immaterial.
* An object named `api` will be provided as an interface to the player from your bot.
* In this iteration of the challenge, there is no way for your bot to know what it's opponent is doing. The challenge is to write a proactive (not reactive) strategy.
## The API
* **api.turn** - Returns the numbered turn the game is on.
* **api.towardsX** - Aim your walkers towards the opponent on the East-West axis.
* **api.towardsY** - Aim your walkers towards the opponent on the North-South axis.
* **api.awayX** - Aim your walkers away from the opponent on the East-West axis.
* **api.awayY** - Aim your walkers away from the opponent on the North-South axis.
* **api.random_direction** - Aim your walkers in a randomly selected direction.
* **api.north** - Alias of awayY. North for green player, South for red player.
* **api.south** - Alias of towardsY. South for green player, North for red player.
* **api.east** - Alias of towardsX. East for green player, West for red player.
* **api.west** - Alias of AwayX. West for green player, East for red player.
* **api.spawning_turn** - Returns a boolean which if true if the Cities are going to send out a Walker this turn.
_Note:_ The last direction method called will define the next direction the walkers move in from that turn until a different direction is called.
## How to write a bot
_Note:_ I recommend playing a manual game or two first; to do this, grab a friend to play against and select 'Manual (simple)' in the footer.
* Go to https://ajfaraday.github.io/grid_game/
* Select a default bot as your base (in the green or red box)
* Click Edit Code in the same coloured box.
* Click Use when you're happy with it.
To test it:
* Select an opponent bot as the other colour (or 'Manual' if you'd like to challenge it yourself.
* Open the developer console (f12) in case of errors in your code.
* Click Start.
* Watch the game unfold.
* Click Reset and repeat the process as desired.
## How to deploy your bot
Once you've written a boss you'd like to keep:
* Go to https://gist.github.com
* Log in, if not already logged in.
* (The default page is the form to create a new gist, this is where we want to be.)
* Name the file 'bot.js'
* Copy the code into bot.js
* Save the gist
* Copy the gist ID (an alphanumeric string found after the last forward slash in the URL).
This Gist ID can now be used to import your bot into Grid Game at any time:
* Select Gist Id in a coloured box.
* Paste the ID into the field which appears.
You will need to include this gist ID in your answer.
## Answer Format
Your answer will consist of:
* A Title consisting of
* A name for your bot
* The gist ID (which should be a link the gist).
* A brief description of the bot's strategy.
* Any notes you wish to include.
Note: I would like to include answers in the respository's code, partly to sidestep rate limiting on github's gist and partly to include more interesting bots for future users to challenge or modify. Please clearly indicate if you consent to your bot becoming a part of the game code or not.
Example answer:
### The Faraday Cage - d9eb9a70ad0dc0fb1885be0fce032adc
The Faraday Cage is an arrangement of four cities in the player's starting corner, which this bot will attempt to build, which then allows it to repeatedly send two 9's towards the opponent.
This is named after Alan Faraday, the elder brother of the game creator, who discovered it while playing the game manually.
* It has proven difficult to defeat.
Please include this in the game.
## The Tournament
In order to determine the challenge winner, bots will be placed in a bracket tournament which will be streamed live, and recorded for posterity.
Pause points:
In tournament conditions, the game will pause automatically every 500 turns to allow me to assess the state of the game and declare a winner if it looks like the game will not be won outright.
Ending conditions:
* Outright win - There are no opponent pieces left on the board.
* Winning by numbers - during any pause point a bot has an insurmountable numerical advantage.
* Draw - If there's no clear winner at turn 3,000, a precise numeric count will be used to determine a winner. Best of these three metrics.
* Number of cities
* Number of cities + walkers
* Overall health of active pieces
Qualification:
In order to have a simple, single elimination tournament, there will have to be 4, 8, 16 or 32 initial competitors. Depending on the number of replies I may have to add or remove some bots from the tournament.
If we are just short of one of these numbers, I will add in some of the standard bots (already in the code).
If there are too many, I will select the answers with the most up-votes on this question.
Broadcast at:
(possible dates 8, 9, 15, 16 Nov)
(London time and GMT are the same after 27th Oct)