Skip to main content
edited to a stub
Source Link

Light-Cycle KotHLight-Cycle KotH

Basically the light-cycle game as a KotH competition.

The Game

Players will write bots that compete in a light-cycle arena. A round of light-cycle starts with bots randomly spaced out along the edge of a (tentatively 10x20) rectangular play area:

+--------------------+
|    @          @    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|    @          @    |
+--------------------+

Each turn, each bot simultaneously must choose one of 4 directions to step (N/E/S/W). A space that was once occupied by the "head" of the bot becomes part of the "body" of the bot.

+--------------------+
|    #         @#    |
|    @               |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|               @    |
|   @#          #    |
+--------------------+

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 head/body).

         *CRASH*
+-----------@--------+
|    #      #####    |
|    ###             |
|      #             |
|      @             |
|                    |
|   @                |
|   #                |
|   #            @#  |
|   #           ###  |
|   ##          #    |
+--------------------+

The bot(s) that crashed into the wall will be removed, and the game will start again with new starting positions. (If multiple bots crash on the same turn, the most-recently submitted bot will be eliminated and the others will survive) (Update: If multiple bots crash on the same turn, they will all be eliminated)

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 online platform, 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 variable 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 integers x and y, 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

(Coordinate system: The bottom-left-most cell of the play-field is (0, 0), with x increasing to the left and y upwards)

Code submission

I plan on making a GitHub repository containing the source code for the judge. The repo will include an HTML file so that it is possible.

Submissions will be made by making a PR to the repo to add their bot's source code (in addition to posting the submission as an answer, of course!)

Light-Cycle KotH

Basically the light-cycle game as a KotH competition.

The Game

Players will write bots that compete in a light-cycle arena. A round of light-cycle starts with bots randomly spaced out along the edge of a (tentatively 10x20) rectangular play area:

+--------------------+
|    @          @    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|    @          @    |
+--------------------+

Each turn, each bot simultaneously must choose one of 4 directions to step (N/E/S/W). A space that was once occupied by the "head" of the bot becomes part of the "body" of the bot.

+--------------------+
|    #         @#    |
|    @               |
|                    |
|                    |
|                    |
|                    |
|                    |
|                    |
|               @    |
|   @#          #    |
+--------------------+

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 head/body).

         *CRASH*
+-----------@--------+
|    #      #####    |
|    ###             |
|      #             |
|      @             |
|                    |
|   @                |
|   #                |
|   #            @#  |
|   #           ###  |
|   ##          #    |
+--------------------+

The bot(s) that crashed into the wall will be removed, and the game will start again with new starting positions. (If multiple bots crash on the same turn, the most-recently submitted bot will be eliminated and the others will survive) (Update: If multiple bots crash on the same turn, they will all be eliminated)

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 online platform, 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 variable 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 integers x and y, 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

(Coordinate system: The bottom-left-most cell of the play-field is (0, 0), with x increasing to the left and y upwards)

Code submission

I plan on making a GitHub repository containing the source code for the judge. The repo will include an HTML file so that it is possible.

Submissions will be made by making a PR to the repo to add their bot's source code (in addition to posting the submission as an answer, of course!)

added 103 characters in body
Source Link
thesilican
  • 551
  • 2
  • 6
  • 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 integers x and y, 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.getSelf(): Returns a [x, y] tuple of the current bot's head. e.g. [3, 7]
  • state.get(x, y): Given integers x and y, 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.getSelf(): Returns a [x, y] tuple of the current bot's head. e.g. [3, 7]
  • 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 integers x and y, 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
Change rules so that bots crash simultaneously
Source Link
thesilican
  • 551
  • 2
  • 6

The round ends as soon as a bot crashesone or more bots crash into a wall, or into the head or body of another bot (including its own head/body).

The bot(s) that crashed into the wall will be removed, and the game will start again with new starting positions. (If multiple bots crash on the same turn, the most-recently submitted bot will be eliminated and the others will survive) (IfUpdate: If multiple bots crash on the same turn, the most-recently submitted botthey will all be eliminated and the others will survive)

The round ends as soon as a bot crashes into a wall, or the head or body of another bot (including its own head/body).

The bot that crashed into the wall will be removed, and the game will start again with new starting positions. (If multiple bots crash on the same turn, the most-recently submitted bot will be eliminated and the others will survive)

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 head/body).

The bot(s) that crashed into the wall will be removed, and the game will start again with new starting positions. (If multiple bots crash on the same turn, the most-recently submitted bot will be eliminated and the others will survive) (Update: If multiple bots crash on the same turn, they will all be eliminated)

Source Link
thesilican
  • 551
  • 2
  • 6
Loading