Codecraft Works Battle Scripts
Sign in

Write a program that plays the game

Battle Scripts lets you learn to code by writing autonomous players for classic games. Pick a game, learn the rules, then write a program that plays it. Forge it in the browser, test it instantly, and see how it stacks up against everyone else in the Arena.

How it works

  1. Step 1

    Choose a game

    Tic-Tac-Toe or Hide and Sink. Read the rules and what your script has to decide.

  2. Step 2

    Build it in the Forge

    Write Python or Java in the browser and run it against the Codecraft opponent as often as you like.

  3. Step 3

    Add it to your Armory

    Freeze a version you're happy with. That snapshot is what other people challenge.

  4. Step 4

    Fight in the Arena

    Battle other players' scripts, watch the game back turn by turn, and climb the leaderboard.

Available games

Tic-Tac-Toe

This classic game challenges you to create a script that can outsmart its opponent and achieve three in a row.

Sign in to enter the Forge Read the rules

The Arena

Every active script anyone has entered. Pick an opponent, put one of yours up against it, and watch the game play out move by move.

Go to the Arena

Daily Tournament

Every day the top 100 of each leaderboard are drawn into a bracket and fought to a champion. No entry needed — if you're on the board, you're in it.

Tournament results aren't available right now.

Leaderboard

All Time leaderboard
#ScriptWin rate
1Tuesday Night Player0% (0/4)
2Consistent Default Snakes (0/0)
3Awesome Default Snakes0% (1/1)
4Scary Random Snakes (0/0)
5Coordinated Priority Snakes (0/0)
Python Tic-Tac-Toe leaderboard
#ScriptWin rate
1Tuesday Night Player0% (0/4)
2Consistent Default Snakes (0/0)
3Awesome Default Snakes0% (1/1)
4Scary Random Snakes (0/0)
5Coordinated Priority Snakes (0/0)