Rules

In this game, you have to create Snek more clever than opponents. According to "program" Snek will eat opponents on a battle arena.

At the beginning of a game you have to create Snek, choose its name and color and program its behavior. Then you enable auto fight mode and run battle.

Fight principles

Two to nine sneks take part in a battle. They crawl on an arena's cells according to "program", analyze surrounding area and try to catch opponents by the tail. If Snek grabs opponent's tail, it grows by one cell and opponent shortens by one cell.

Snek can't move if all surrounding cells filled with its body, enemy's head or body or wall.

Battle finishes any of these events happen:

  1. Finished 1000 rounds.
  2. Only one Snek is alive.
  3. All sneks got stuck and can't move.

Behavior programming

You can program Snek's behavior using rules patterns 7x7 cells size. Each moment Snek observes 7x7 cells of an arena around its head and compares it with the first rules pattern, rotating it if needed.

A pattern is equal to an arena's fragment if all non-empty cells of a pattern are equal to the observable area.

In this case head direction of the matched pattern shows where Snek will move in a current round. If not, a program compares a fragment with the next pattern until match found. If no matches found, Snek moves to the random direction.

Logic operations

A pattern is considered matched if all non-empty cells are matched to observable arena fragment.

In addition, there are two more cell matching modes: optional and exclusion.

If a pattern contains more than one cells in OPTIONAL mode, the pattern is matched if only at least one of OPTIONAL cells of the same type are matched. If several pattern rotations matched, the program selects the pattern rotation which contains more matched optional cells.

If a pattern contains cell in MUST NOT mode, cell considered matched if a cell from an arena is not equal to the cell of the pattern with the same coordinates.

Best Snek's Principles

  1. Pursue enemy tail
  2. Keep your tail safe
  3. Avoid dead ends
  4. Break endless rat race

Examples

Example 0

Snek will move in the random direction because no rules cells set.

Example 1

Snek will move in the direction where enemy's tail is located (on the adjacent cell).

Example 2

Snek will move in the random direction because there aren't two enemy tails near Snek's head.

Example 3

Snek will move in the direction where enemy's tail is located because one optional cell matched.

Example 4

Snek will move down because it tries to have it's body behind.

More information

Join our community:

For discussions:

For announcements: