Programá un bot. Que juegue por vos. Code a bot. Let it play for you.
Escribís un bot autónomo, lo conectás por WebSocket al servidor y juega partidas turno a turno contra los bots de otras personas. En el lenguaje que quieras. Hay desafíos uno a uno, torneos todos contra todos y campeonatos con final.
You write an autonomous bot, connect it to the server over a WebSocket, and it plays turn-based matches against everyone else's bots — in whatever language you like. There are one-on-one challenges, round-robin tournaments and championships with a final.
Gratis · Cualquier lenguaje con cliente WebSocket · Bot de ejemplo listo para clonar Free · Any language with a WebSocket client · Starter bot ready to clone
Un espacio para aprender jugandoA place to learn by playing
The Code Challenge es una plataforma educativa donde cualquier persona que programe puede demostrar su creatividad y su capacidad de adaptación. Estamos convencidos de que jugar es una de las mejores formas de aprender — y de mostrar lo que sabés mientras te divertís.
The Code Challenge is an educational platform where any developer can show their creativity and adaptability. We're convinced that playing is one of the best ways to learn — and to show what you know while having fun.
🧠 Vos ponés la estrategiaYou bring the strategy
La plataforma se encarga del emparejamiento, los turnos, el tiempo y el puntaje. Lo único que escribís es la parte interesante: qué jugada hacer.
The platform handles matchmaking, turns, timing and scoring. The only thing you write is the interesting part: which move to make.
🛠 Cualquier lenguajeAny language
El contrato es un WebSocket y mensajes JSON. Si tu lenguaje tiene un cliente WebSocket, podés competir. Los ejemplos están en Python.
The contract is a WebSocket and JSON messages. If your language has a WebSocket client, you can compete. The reference examples are in Python.
📈 Qué miramosWhat we look for
Más allá del resultado: calidad de código, tests, uso de patrones e integración continua. Ganar está bueno; escribir buen código está mejor.
Beyond the result: code quality, tests, patterns and continuous integration. Winning is nice; writing good code is better.
Cómo funciona una partidaHow a match works
Tu bot es un cliente WebSocket que corre en tu máquina. Del otro lado hay un servidor de partidas que orquesta los turnos y un backend por cada juego que aplica las reglas.
Your bot is a WebSocket client running on your machine. On the other side there's a match server orchestrating turns, and one backend per game applying the rules.
El recorrido de una partidaThe path of a match
web --POST /challenge | /tournament--> server
server --GET /games/config/<name> --> web # resuelve el backend del juego# resolve the game backend
server --POST /games, /games/{id}/actions--> game backend # crea la partida y juega turnos# create the game, play turns
server <--websocket ws://…/ws?token=…--> tus botsyour bots
server --POST /match --> web # guarda el resultado# store the result
Desafíos, torneos y campeonatosChallenges, tournaments and championships
Tres niveles de competencia, del más informal al más serio. Todos usan el mismo bot: no hay que cambiar nada del código para pasar de uno a otro.
Three levels of competition, from the most informal to the most serious. All of them use the same bot: you don't have to change a line of code to go from one to the next.
1 vs 1 DesafíoChallenge
Elegís tu bot, un rival que esté conectado y el juego. Tu bot recibe el evento
challenge, responde accept_challenge y arranca la partida.
El resultado queda en My Matches, con el log jugada por jugada.
Pick your bot, an opponent who's online and the game. Your bot gets a
challenge event, replies accept_challenge and the match starts.
The result lands in My Matches, with a move-by-move log.
Podés desafiarte a vos mismo para probar cambios sin molestar a nadie.
You can challenge yourself to test changes without bothering anyone.
Todos contra todosRound robin TorneoTournament
Te inscribís y, cuando arranca, se crea una partida por cada par de bots inscriptos. La tabla ordena por partidos ganados, después por puntaje total y después por empates.
You register, and when it starts one match is created for every pair of registered bots. The table ranks by matches won, then total score, then ties.
Ojo: vas a estar jugando varias partidas al mismo tiempo, cada una con su propio tablero. Tu bot tiene que ser asincrónico.
Heads up: you'll be playing several matches at once, each with its own board. Your bot needs to be asynchronous.
Con finalWith a final CampeonatoChampionship
Agrupa varios torneos más un torneo FINAL. Los primeros N de cada torneo clasifican, y la plataforma arma sola las inscripciones y todos los cruces de la final.
Groups several tournaments plus a FINAL tournament. The top N of each tournament qualify, and the platform builds the final's registrations and every pairing on its own.
Cada torneo pasa por pending → active → finish.
Each tournament goes pending → active → finish.
Qué se juegaWhat you play
Todos los juegos son de dos jugadores y por turnos, y hablan el mismo protocolo. El catálogo se administra desde la web, así que puede crecer sin tocar el servidor.
Every game is two-player and turn-based, and they all speak the same protocol. The catalogue is managed from the web, so it can grow without touching the server.
🐍 Snake
Cada quien maneja una serpiente en una grilla compartida. En tu turno mandás una
direction (up, down, left,
right) y avanzás una celda.
Each player drives a snake on a shared grid. On your turn you send a
direction (up, down, left,
right) and advance one cell.
- Comer
*te hace crecer y suma +100. - Eating
*grows you and scores +100. - Chocar contra una pared, tu cuerpo o el rival: −500 para vos, +1000 para el otro.
- Crashing into a wall, your own body or the rival: −500 for you, +1000 for them.
- Si nadie choca antes de que se acaben los movimientos, gana el de más puntaje.
- If nobody crashes before the moves run out, the higher score wins.
🔴 Connect 4
El clásico cuatro en línea. En tu turno mandás la columna donde soltás la ficha
(col). Es el juego del cliente de ejemplo, así que es el camino más corto
para tu primera partida.
The classic four-in-a-row. On your turn you send the column to drop your piece into
(col). It's the game the reference client plays, so it's the shortest path
to your first match.
✨ Y el próximo lo podés escribir vosAnd you can write the next one
Un juego es un servicio HTTP con cuatro endpoints. Arrancás desde codechallenge-game-template, que ya habla el protocolo, guarda el estado en Redis y se registra solo en la web al arrancar (con un token de registro que te da un admin).
A game is an HTTP service with four endpoints. Start from codechallenge-game-template, which already speaks the protocol, persists state in Redis and registers itself with the web on startup (using a registration token an admin gives you).
| Endpoint | Qué haceWhat it does |
|---|---|
POST /games | crea una partida para dos jugadorescreate a game for two players |
POST /games/{id}/actions | juega un turnoplay a turn |
POST /games/{id}/penalizes | penaliza al jugador de turno (timeout)penalize the current player (timeout) |
POST /games/{id}/abort | aborta la partidaabort the game |
Implementás las reglas en game/game.py, el nombre y la descripción en
game/__init__.py, y listo: aparece en los desplegables de desafíos y torneos.
Implement the rules in game/game.py, name and description in
game/__init__.py, and that's it — it shows up in the challenge and tournament
dropdowns.
Cómo desarrollar tu botHow to build your bot
De cero a tu primera partida en cinco pasos. Después, todo el trabajo está en un solo lugar: la función que decide la jugada.
From zero to your first match in five steps. After that, all the work happens in one place: the function that decides the move.
-
Conseguí tu tokenGet your token
Entrás con LinkedIn a codechallenge.net.ar: ya tenés un bot oficial creado con tu usuario. En My Bots, Show token y lo copiás. Ese token es tu identidad — no lo publiques.
Sign in with LinkedIn at codechallenge.net.ar: you already have an official bot named after your user. Go to My Bots, Show token and copy it. That token is your identity — never publish it.
-
Clonás el cliente de ejemploClone the starter client
git clone https://github.com/thecodechallenge/codechallenge-test-client.git cd codechallenge-test-client python -m venv .venv && source .venv/bin/activate pip install -r requirements.txtPara Snake hay otro de referencia: codechallenge-snake-dummy-client, que además dibuja el tablero en la terminal mientras juega.
For Snake there's another reference: codechallenge-snake-dummy-client, which also draws the board in your terminal while it plays.
-
Lo corrés con tu tokenRun it with your token
python run.py <YOUR_BOT_TOKEN>Se conecta, queda escuchando y acepta los desafíos que le lleguen. Ya estás en línea: el resto de los participantes te ven disponible.
It connects, waits and accepts incoming challenges. You're online now: everyone else sees you as available.
-
Cambiás la estrategiaChange the strategy
Todo lo demás ya está resuelto. Vos tocás la función que elige la jugada (
process_moveen el cliente de Connect 4,choose_directionen el de Snake) y la hacés más inteligente.Everything else is already handled. You touch the function that picks the move (
process_movein the Connect 4 client,choose_directionin the Snake one) and make it smarter. -
Desafiás a alguienChallenge someone
Desde Challenge en la web elegís rival y juego. Tu bot acepta solo, juega, y el resultado aparece en My Matches. Después, a inscribirte en un torneo.
From Challenge on the web pick an opponent and a game. Your bot accepts on its own, plays, and the result shows up in My Matches. Then go register for a tournament.
El protocolo, en dos tablasThe protocol, in two tables
Tu bot abre un WebSocket con su token y a partir de ahí todo es JSON. El servidor manda
eventos ({"event": …, "data": …}) y tu bot manda
acciones ({"action": …, "data": …}).
Your bot opens a WebSocket with its token and from there everything is JSON. The server sends
events ({"event": …, "data": …}) and your bot sends
actions ({"action": …, "data": …}).
wss://server.codechallenge.net.ar/ws?token=<YOUR_BOT_TOKEN>
→ Eventos que recibísEvents you receive
list_users | quiénes están conectadoswho's online |
challenge | te desafiaron: respondé con el challenge_idyou were challenged: reply with the challenge_id |
your_turn | es tu jugada: viene el estado, el game_id y un turn_tokenyour move: state, game_id and a turn_token |
game_over | terminó la partidathe match ended |
error | algo salió malsomething went wrong |
← Acciones que mandásActions you send
accept_challenge | aceptás un desafíoaccept a challenge |
move | tu jugada, con el turn_token de vueltayour move, echoing the turn_token |
challenge | desafiás a otro botchallenge another bot |
list_users | pedís la lista de conectadosask who's online |
abort_game | abandonás una partidaabort a match |
Un turno, de punta a puntaOne turn, end to end
< {"event": "your_turn", "data": {"board": "…", "side": "N", "score_1": 0, "score_2": 0,
"game_id": "g_9f", "turn_token": "t_01"}}
> {"action": "move", "data": {"game_id": "g_9f", "turn_token": "t_01", "col": 3}}
Hay un límite de tiempo por jugada. Un turn_token equivocado, una jugada
ilegal o un timeout te penalizan — así que conviene responder rápido y validar antes de mandar.
There's a time limit per move. A wrong turn_token, an illegal move or a timeout
gets you penalized — so answer fast and validate before sending.
Sin el cliente de ejemploWithout the starter client
No necesitás nuestro cliente: cualquier WebSocket sirve. El bot mínimo es esto.
You don't need our client: any WebSocket will do. The minimal bot is this.
import asyncio, json, sys, websockets
URI = "wss://server.codechallenge.net.ar/ws?token={}"
async def main(token):
async with websockets.connect(URI.format(token)) as ws:
async for raw in ws:
msg = json.loads(raw)
event, data = msg.get("event"), msg.get("data", {})
if event == "challenge":
await ws.send(json.dumps({
"action": "accept_challenge",
"data": {"challenge_id": data["challenge_id"]},
}))
elif event == "your_turn":
move = {"col": 3} # <- tu estrategia va acá<- your strategy goes here
await ws.send(json.dumps({
"action": "move",
"data": {"game_id": data["game_id"],
"turn_token": data["turn_token"], **move},
}))
asyncio.run(main(sys.argv[1]))
Levantar todo en tu máquinaRunning the whole thing locally
Si querés desarrollar contra tu propia instalación (o escribir un juego), cada repo trae su
start.sh y su venv:
If you'd rather develop against your own installation (or write a game), each repo ships its
own start.sh and venv:
| ServicioService | Port | Repo |
|---|---|---|
| Postgres + Redis | 5432 / 6379 | docker compose |
| Web | 8000 | codechallenge-web |
| Server | 5000 | codechallenge-server |
| Snake | 50052 | codechallenge-snake |
| Connect 4 | 50051 | codechallenge-connect4 |
Después registrás los backends desde /games/ y ya podés crear desafíos y torneos
locales. Documentación completa:
codechallenge.net.ar/documentation.
Then register the backends from /games/ and you can create local challenges and
tournaments. Full documentation:
codechallenge.net.ar/documentation.
Preguntas frecuentesFrequently asked questions
Lo que más nos preguntan antes de empezar.
What people ask us most before starting.
¿Qué necesito saber para participar?What do I need to know to take part?
Programar — en el lenguaje y el paradigma que prefieras — y WebSockets. Nada más.
Programming — in whatever language and paradigm you like — and WebSockets. Nothing else.
¿Puedo usar cualquier lenguaje?Can I use any language?
Sí. Cualquiera que tenga un cliente WebSocket. Los ejemplos están en Python, pero el contrato es JSON sobre WebSocket y no impone nada más.
Yes. Any language with a WebSocket client. The examples are in Python, but the contract is JSON over a WebSocket and imposes nothing else.
¿Tengo que implementar todas las reglas del juego?Do I have to implement all the game rules?
No. Las reglas las aplica el servidor; vos sólo mandás jugadas. Implementá lo que consideres necesario: cuanto más contemples, mejores resultados vas a tener — pero lo que nos importa es la calidad del código.
No. The server applies the rules; you just send moves. Implement what you consider necessary: the more you handle, the better your results — but what we care about is code quality.
¿Puedo jugar varias partidas a la vez?Can I play several matches at once?
Sí, y en un torneo es lo normal: cada partida tiene su propio tablero y sus propios turnos. Por eso tu bot tiene que manejar concurrencia (código asincrónico).
Yes, and in a tournament it's the norm: each match has its own board and its own turns. That's why your bot has to handle concurrency (async code).
¿Qué evalúan?What do you evaluate?
Buscamos código eficiente, orientado a objetos o funcional. Miramos:
We look for efficient object-oriented or functional code. We look at:
- Calidad de códigoCode quality
- TestsTests
- Uso de patronesUse of patterns
- Integración continuaContinuous integration
¿Cómo participo y qué pasa con mi código?How do I take part, and what about my code?
La participación es individual: entrás con LinkedIn y ya tenés tu bot oficial. Tu código vive en un repo privado tuyo; la organización puede pedirte acceso de lectura para revisarlo. Cada cuenta tiene un token oficial para torneos — podés crear bots extra para tus pruebas.
Participation is individual: sign in with LinkedIn and you already have your official bot. Your code lives in your own private repo; the organizers may ask for read access to review it. Each account has one official tournament token — create extra bots for your own testing.
Nunca compartas tu token públicamente.
Never share your bot token publicly.
Tu bot no se va a escribir soloYour bot won't write itself
Entrás con LinkedIn, copiás tu token y en cinco minutos estás jugando tu primera partida.
Sign in with LinkedIn, copy your token, and in five minutes you're playing your first match.