Basically the tron light-cycle game as a king of the hill competition!
Leaderboard
Updated as of 2022-04-05
#1) Player Avoid by Agent Biscutt
#2) Dodge West by Imanton1
#3) Space Finder by Spitemaster
#4) Blind Bot by TheSilican
The Game
Players will write bots that compete in a light-cycle tournament. A round of light-cycle starts with bots evenly spaced out along the edge of a rectangular play area:
+--------------------+
| @ @ |
| |
| |
| |
| |
| |
| |
| @ @ |
+--------------------+
Each turn, each bot simultaneously must choose one of 4 directions to step (N, E, S, or W). The "head" of the bot steps in that direction, and the space that was once occupied by the head becomes part of the "body".
+--------------------+
| # @# |
| @ |
| |
| |
| |
| |
| @ |
| @# # |
+--------------------+
The round ends as soon as one or more bots crash into a wall, or into the head or body of another bot (including its own body).
*CRASH*
+-----------@--------+
| # ##### |
| ### |
| # |
| @ @ |
| # |
| # @# |
| # ### |
| ## # |
+--------------------+
The bot(s) that crashed into the wall will be eliminated, and a new round will start with new starting positions. Bots are eliminated each round, until only 1 bot remains.
The leaderboard rankings are based on the order that the bots are eliminated.
Code / API
For ease of judging and creating the judge website, submissions will be restricted to javascript.
A bot is a javascript function with the following API:
(state) => {
// state is an object with access to information about the game
// bots can use the state to make decisions
// bots return one of "N", "E", "S", "W"
// e.g.:
return "N";
}
The state
parameter contains the following API calls:
state.getDim()
: Returns a[w, h]
tuple of the width and height of the arena. e.g.[20, 10]
state.getSelf()
: Returns a[x, y]
tuple of the current bot's head. e.g.[3, 7]
state.get(x, y)
: Given integersx
andy
, returns a string corresponding to what is currently on the map at (x, y)"#"
- body of a bot, or out-of bounds of the map ("wall")"@"
- head of a bot" "
- empty cell
state.getBoard()
: Returns a 2d array of the entire map.state.getBoard()[x][y]
is equivalent tostate.get(x, y)
Coordinates: (0, 0) is the bottom-left corner of the playfield with x increasing to the right and y upwards.
Code Submission
To make a bot submission, add your bot code to this GitHub repository with a pull request, in addition to posting an answer.
Edit: Opening a PR in GitHub is no longer necessary, simply post your submission here.
Each user may only make one submission, however you may freely edit your submission after posting.