If GopherKombat is not what it initially sounded like, you are not mistaken. Initially we wanted to make a platform for AI competition, much like Robocode( and Ants( but it was too much to swallow for a 2-day hackaton. So we scrapped half-way and reused the tech for something similar.

Knowing how Go Playground works, how it sandboxes execution of user-submitted code, we was more opportunities. Inspired by and, we created a sandbox execution engine with a purpose to execute two codes and compare their performances.

How it works

It is a web app, where users can execute two Go programs and compare their performance. It is decoupled in two modules - web module, responsible for static file serving and rest services, and sandbox module, running in a Docker container, responsible for sandboxed execution of user submitted code. Code is sent to sandbox, where it is temporarily saved to disk, compiled, and if its compiled successfully - executed as a standalone process. Validation messages and performance values are read from stdout and returned to the user.

Challenges I ran into

One of the main challenges was the time constraint. After the code submission interface and the sandboxing logic was ready we decided that there wasn't enough time to finish the initial project. The project was then changed to a performance comparator between two pieces of Go code.

Accomplishments that I'm proud of

We are mostly proud of the fact how we hooked up randomly on Slack and after a short chat easily decided what we want to do. That enabled us to quickly dissolve bigger problems into smaller pieces and work on them independently. Greatest accomplishment is probably the fact that we created a prototype of sandboxing engine that can have many purposes.

What I learned

We learned how to utilize Docker container for sandbox execution engine. How to use Go html templating. How to orchestrate and manipulate subprocesses. About great MongoDB driver for Go - mgo.

What's next for GopherKombat

GopherKombat will eventually become what it was intended to be - an AI competition. But with this sandboxing engine we already have several ideas how to put it to good use, and not just user-submitted code.

Share this project: