A KoTH programming game host for the Esolangs Discord server.

Snakes: Round 1

The challenge is played on a 32x16 board. Two AIs are placed in opposite corners of the map - (0, 0) and (31, 15). The board data consists of five unique ASCII characters:

  • X - the territory of player X
  • O - the territory of player O
  • * - the player X
  • @ - the player O
  • . - empty space

The game is played in turns. The game ends after 1024 turns, and the player who holds more territory at the end of turn 1024 wins. The game yields the winning side a point, while the losing side keeps their amount of points intact. A draw gives both players half a point.

Each turn, either of the bots can move upwards, downwards, left or right. Moving outside of the board is considered a no-operation. After the move is completed, the new square is considered bot's territory. The corners (0, 0) and (31, 15) are considered respective player's territories. When a bot creates a closed curve either with its territory, or the board walls and the territory, the interior of it is marked as its territory. If the enemy bot was present inside of this territory, it loses instantly.

APIs

The code must not interfere with the event host, the opposing bot and may not declare, read or write global variables (except the ones defined by the C standard) or explicitly modify the board. Any signal sent by the bot (SIGSEGV, SIGFPE) counts as a loss for the said bot.

Your code will be compiled and ran on x86_64 Debian Linux.

Create a function called bot which takes a 2-D, 32x16 array of characters as it's input representing the board and the character it plays. Return either 'L', 'R', 'U', or 'D'. Define a string constant containing the name of your bot:

int bot(int board[16][32], char player) {
    ...
}

char * bot_name = ...;

Examples

random_vs_random.txt contains a log printed by the host while playing a game of two bots making random moves.

The game starts.

*...............................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
[email protected]

After 10 turns, both players have moved 5 times up/down and 5 times left/right.

X...............................
X...............................
X...............................
X...............................
X...............................
XXXXX*..........................
................................
................................
................................
................................
[email protected]
..........................O.....
..........................O.....
..........................O.....
..........................O.....
..........................OOOOOO

After 4 more turns, both of the players move 4 times towards the wall.

X...............................
X....*..........................
X....X..........................
X....X..........................
X....X..........................
XXXXXX..........................
................................
................................
................................
................................
[email protected]
..........................O.....
..........................O.....
..........................O.....
..........................O.....
..........................OOOOOO

Now, when they make one more move towards the wall, the area is theirs.

XXXXX*..........................
XXXXXX..........................
XXXXXX..........................
XXXXXX..........................
XXXXXX..........................
XXXXXX..........................
................................
................................
................................
................................
[email protected]
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

A few more moves later:

XXXXXXXXXXX*....................
XXXXXX..........................
XXXXXX..........................
XXXXXX..........................
[email protected]
XXXXXX.........................O
...............................O
...............................O
...............................O
...............................O
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

XXXXXXXXXXXX....................
XXXXXX.....X....................
XXXXXX.....X....................
XXXXXX.*XXXX....................
XXXXXX......................OOOO
XXXXXX......................O..O
............................O..O
[email protected]
...............................O
...............................O
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

The players are about to mark another bit of territory:

XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXX*XXXXX....................
XXXXXX......................OOOO
XXXXXX......................OOOO
............................OOOO
[email protected]
...............................O
...............................O
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

Let's witness player O committing suicide:

XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXXX.....................OOOO
XXXXXXXXXXXXXX*.............OOOO
............................OOOO
............................OOOO
[email protected]
...............................O
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
XXXXXXXXXXXX....................
[email protected]
XXXXXXXXXXXXXX...O..........OOOO
.............X...O...*......OOOO
.............XXXXXXXXX......OOOO
.................OOOOOOOOOOOOOOO
...............................O
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

XXXXXXXXXXXX....................
XXXXXXXXXXXX.........*..........
XXXXXXXXXXXX.........X..........
[email protected]
XXXXXXX..........O...X......OOOO
XXXXXXXXXXXXXX...O...X......OOOO
.............X...O...X......OOOO
.............XXXXXXXXX......OOOO
.................OOOOOOOOOOOOOOO
...............................O
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO
..........................OOOOOO

On the next move, player X moves up and ends the game, as player O will suffocate in X's territory.

Owner
Kamila Szewczyk
(she/her) mathematician, array lang & low level programming; 17
Kamila Szewczyk
Similar Resources

This is my record of practicing programming skills on LeetCode since 2021.

My_LeetCode_Road This is my record of practicing programming skills on LeetCode since 2021. No. Chinese Title Englist Title Acceptance Difficulty 1 两数

Jan 11, 2022

Problem solution of Quera's Problems with different programming language and approach.

Quera-Problem-Solution Problem solution of Quera's Problems with different programming language and approach. How to use Each folder is the category o

Jun 2, 2022

This repository contains some data structures implementation in C programming language

This repository contains some data structures implementation in C programming language. I wrote the tutorial posts about these data structures on my personal blog site in Bengali language. If you know Bengali then visit my site

Jun 1, 2022

Higher level programming in C

Cello Cello is a library that brings higher level programming to C. By acting as a modern, powerful runtime system Cello makes many things easy that w

Jun 20, 2022

A collection of hash tables for parallel programming, including lock-free, wait-free tables.

Hatrack Hash tables for parallel programming This project consisists of fast hash tables suitable for parallel programming, including multiple lock-fr

Jun 10, 2022

Its a game base on FamilyFeud and in the Argentinian version "100 argentinos dicen".

Its a game base on FamilyFeud and in the Argentinian version

Family Feud - 100 argentinos dicen Its a game base on FamilyFeud and in the Argentinian version "100 argentinos dicen". This program was made with SDL

Apr 28, 2022

✔️The smallest header-only GUI library(4 KLOC) for all platforms

✔️The smallest header-only GUI library(4 KLOC) for all platforms

Welcome to GUI-lite The smallest header-only GUI library (4 KLOC) for all platforms. 中文 Lightweight ✂️ Small: 4,000+ lines of C++ code, zero dependenc

Jun 17, 2022

Entertainment bot for Discord made with D++ - the C++ Discord library

Beerist-Bot Entertainment bot for Discord made with D++ - the C++ Discord library Invite Beerist to your Server here! GUIDE FOR BUILDING AND SELFHOSTI

Jun 16, 2022

Minimalistic server (written in C) and a python3 client to allow calling C function on a remote host

Minimalistic server (written in C) and a python3 client to allow calling C function on a remote host

Jun 1, 2022

A Discord Bot to protect your server from spam, invitations, fake nitro ads and more written in C++

Antispambot An efficient Discord Bot to prevent spam written in C++. Tested on a large discord server and mitigates around 90% spam. Its well commente

May 1, 2022

An OBS plugin that allows capture of independant application audio streams on Windows, in a similar fashion to OBS's game capture and Discord's application streaming.

An OBS plugin that allows capture of independant application audio streams on Windows, in a similar fashion to OBS's game capture and Discord's application streaming.

win-capture-audio An OBS plugin based on OBS's win-capture/game-capture that hooks WASAPI's audio output functions (rather than the various graphics A

Jun 24, 2022

Parsec Soda is a custom open-source game streaming app that integrates with Parsec API and is focused in Host experience.

Parsec Soda is a custom open-source game streaming app that integrates with Parsec API and is focused in Host experience.

Parsec Soda is a custom open-source game streaming app that integrates with Parsec API and is focused in Host experience.

Jun 22, 2022

PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLPv2b PLP Project Programming Language Programming Language for projects and computer science and research on computer and programming. What is PLP L

Apr 11, 2022

Header-only VMWare Backdoor API Implementation & Effortless VMX Patcher for Custom Guest-to-Host RPCs

Header-only VMWare Backdoor API Implementation & Effortless VMX Patcher for Custom Guest-to-Host RPCs

VmxHijack Header-only VMWare Backdoor API Implementation & Effortless VMX Patcher for Custom Guest-to-Host RPCs Sample // --- RPC Server Code (VmxHija

Jun 12, 2022

LAN Party VPN - Run VPN on top of Discord. No installation required.

LAN Party VPN - Run VPN on top of Discord. No installation required.

LAN Party VPN - VPN for Virtual LAN Parties Have you ever wanted to play a classic game with your friends but not able to because you or your friends

Jun 7, 2022

ESP32 software USB host through general IO pins. We can connect up to 4 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp32_usb_soft_host esp32 USB-LS pure software host thru general IO pins. Up to 4 HID devices simultaneously. board ~$3 :https://www.aliexpress.com/pr

Jun 16, 2022

The new Windows Terminal and the original Windows console host, all in the same place!

The new Windows Terminal and the original Windows console host, all in the same place!

Jun 16, 2022

D++ Extremely Lightweight C++ Discord Library

D++ An incredibly lightweight C++ Discord library This project is in alpha stages of development. Completed so far: Websocket connection with heartbea

Jun 18, 2022

Add extra features to Discord via patches!

DiscordExtras An iOS tweak that lets you apply patches the iOS Discord client. Available on my repo here. Components DiscordExtrasPrefs This includes

May 16, 2022
This is a beginner-friendly project aiming to build a problem-set on different data structures and algorithms in different programming languages.

DSAready Overview This is a beginner-friendly project that aims to create a problem-set for various Data Structures and Algorithms. Being a programmer

Jun 12, 2022
Templates, algorithms and data structures implemented and collected for programming contests.
Templates, algorithms and data structures implemented and collected for programming contests.

Templates, algorithms and data structures implemented and collected for programming contests.

Jun 17, 2022
This repository aims to contain solutions and explanations to various competitive programming problems, which may be important for interviews and online tests of different companies.
This repository aims to contain solutions and explanations to various competitive programming problems, which may be important for interviews and online tests of different companies.

Competitive Programming Solutions Compilation Hello everyone ?? This repository contains solutions and explanations to various competitive programming

Jun 18, 2022
Competitive Programming Solutions Compilation
 Competitive Programming Solutions Compilation

Competitive Programming Solutions Compilation Hello everyone ?? This repository contains solutions and explanations to various competitive programming

Jun 20, 2022
Collection of all the LeetCode problem solutions using different programming languages.

LeetCode Solutions Collection of all the LeetCode problem solutions using different programming languages. To contribute, you can make a file for the

Jun 2, 2022
Competitive Programming Problem Set

Competitive Programming Problem Set Please press ⭐ button if you like this repo ❤ . Your supports will encourage me a lot and help me put more my time

Jan 27, 2022
An open source initiative for implementing and testing algorithms in various programming languages.

Algorithms An open source initiative for implementing and testing algorithms in various programming languages. Contributing The idea here is to learn

Nov 28, 2021
FEMTIC is a 3-D magnetotelluric inversion code. FEMTIC is made by object-oriented programming with C++.

FEMTIC FEMTIC is a 3-D magnetotelluric inversion code based on the following studies. FEMTIC was made using object-oriented programming with C++. FEMT

Jun 7, 2022
Implementation of K-D tree in C++ programming language.
Implementation of K-D tree in C++ programming language.

KD_Trees Implementation of K-D tree in C++ programming language Demonstration Image What's in this repository anyway? This is a C++(PL) implementation

Dec 17, 2021
A tree-sitter grammar for the Gleam programming language

tree-sitter-gleam A tree-sitter grammar for the Gleam programming language This is, presently, very much a work-in-progress. DONE Parsing import state

Mar 30, 2022