Codecraft Works 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.

See the latest results

Leaderboard

All Time leaderboard
#ScriptWin rate
1Swift Aqua Telescope100% (3/3)
2Smart?100% (3/3)
3TicTacToe-1100% (1/1)
4Zany Lavender Antelope100% (1/1)
5Gentle Magenta Robot100% (1/1)
6Thunderous Turquoise Ferret100% (1/1)
7Marta's Tic Tac Toe100% (1/1)
8Rugged Velvet Comet100% (1/1)
9Cozy Crimson Volcano100% (1/1)
10Honest Pink Noodle100% (3/3)
11Bombastic Random Boats99% (171/173)
12Happy Amber Pelican87% (13/15)
13Quirky Magenta Planet86% (6/7)
14Jumpy Lavender Telescope86% (6/7)
15Noble Apricot Walrus82% (9/11)
16Roaring Navy Planet80% (8/10)
17Thunderous Ruby Dragonfly75% (3/4)
18New Game74% (20/27)
19CCPC Blocky 🥷🏾 173% (194/265)
20final272% (13/18)
21Fancy Pearl Giraffe67% (2/3)
22Mellow Velvet Magnet67% (2/3)
23Eager Navy Yak67% (6/9)
24Gentle Emerald Satellite67% (2/3)
25Noble Azure Kite67% (4/6)
26Dreamy Jade Dolphin67% (2/3)
27Glitch60% (3/5)
28K.O.'s Player60% (3/5)
29Robsons Tic Tac to60% (3/5)
30Default Blocks but with Functions58% (341/593)
31Happy Ruby Quokka50% (1/2)
32Peppy Maroon Noodle50% (2/4)
33Speedy Peach Iguana50% (1/2)
34Sparkly Velvet Crayon50% (1/2)
35Loyal Copper Beetle50% (3/6)
36Gentle Cobalt Narwhal50% (1/2)
37Gib TicTacToe50% (2/4)
38final50% (1/2)
39Alyssa50% (1/2)
40Jumpy Maroon Galaxy50% (2/4)
41THIS50% (1/2)
42Merry Azure Blossom43% (3/7)
43Chaotic Random Toffees43% (3/7)
44Aaden's Tic Tac Toe42% (5/12)
45BattleBot41% (241/584)
46Cosmic Pink Robot33% (1/3)
47Cheerful Emerald Dragon33% (2/6)
48Zippy Scarlet Starfish33% (1/3)
49Bright Indigo Rainbow33% (1/3)
50marissa27% (3/11)
51Scary Random Snakes26% (65/248)
52Epic Emerald Falcon25% (1/4)
53Jazzy Ruby Pelican25% (2/8)
54Jumpy Silver Marble22% (2/9)
55Whimsical Olive Dragon20% (1/5)
56Galactic Violet Cactus17% (2/12)
57Lucky Tangerine Turtle14% (1/7)
58Rugged Mint Yak— (0/0)
59Friendly Maroon Gecko— (0/0)
60cheese— (0/0)
61Giant Apricot Seahorse— (0/0)
62Epic Crimson Bumblebee— (0/0)
63Final0% (0/1)
64Thunderous Periwinkle Cactus0% (0/1)
65Shiny Maroon Cricket0% (0/1)
66Shoot at 0, 0 <script>alert(1)</script>0% (0/1)
67Hopeful Crimson Beacon— (0/0)
68Witty Ivory Crayon— (0/0)
69Plucky Lavender Pangolin0% (0/2)
70Fluffy Periwinkle Planet0% (0/2)
71Twirly Violet Hedgehog— (0/0)
72Smart?— (0/0)
73Friendly Jade Seahorse— (0/0)
74Quirky Peach Parrot0% (0/1)
75Quiet Ruby Sequoia0% (0/1)
76Spiffy Silver Comet— (0/0)
77Mellow Apricot Meerkat0% (0/5)
78Lively Magenta Crayon— (0/0)
79An attempt 2— (0/0)
80Vivid Pink Giraffe0% (0/169)
81Glowing Bronze Jellyfish— (0/0)
82Smart? 20% (0/1)
83Jazzy Jade Lobster— (0/0)
84Snappy Golden Chipmunk— (0/0)
85Peppy Navy Waterfall— (0/0)
86Hopeful Lavender Jellyfish— (0/0)
87Electric Copper Heron— (0/0)
88Polished Cobalt Crayon— (0/0)
89Fearless Sapphire Meerkat0% (0/1)
90Cozy Peach Pinecone0% (0/1)
91Cozy Plum Falcon0% (0/3)
92Hasty Jade Meerkat0% (0/1)
93Whimsical Lemon Zeppelin— (0/0)
94Kind Ruby Gecko— (0/0)
95Helpful Indigo Comet0% (0/1)
96Soaring Velvet Octopus0% (0/2)
97Dazzling Lemon Lighthouse— (0/0)
98Bright Silver Tuba— (0/0)
99Plucky Peach Wombat0% (0/2)
100Gentle Navy Waterfall— (0/0)
Java Hide and Sink leaderboard
#ScriptWin rate
1Smart?100% (3/3)
2Bombastic Random Boats99% (171/173)
3Eager Navy Yak67% (6/9)
4Loyal Copper Beetle50% (3/6)
5Cheerful Emerald Dragon33% (2/6)
6Shoot at 0, 0 <script>alert(1)</script>0% (0/1)
7Smart?— (0/0)
8Lively Magenta Crayon— (0/0)
9Vivid Pink Giraffe0% (0/169)
10Smart? 20% (0/1)
11Actually, you know what, don't even put in a position0% (0/2)
Python Tic-Tac-Toe leaderboard
#ScriptWin rate
1Swift Aqua Telescope100% (3/3)
2TicTacToe-1100% (1/1)
3Gentle Magenta Robot100% (1/1)
4Thunderous Turquoise Ferret100% (1/1)
5Marta's Tic Tac Toe100% (1/1)
6Rugged Velvet Comet100% (1/1)
7Cozy Crimson Volcano100% (1/1)
8Happy Amber Pelican87% (13/15)
9Jumpy Lavender Telescope86% (6/7)
10Noble Apricot Walrus82% (9/11)
11Roaring Navy Planet80% (8/10)
12Thunderous Ruby Dragonfly75% (3/4)
13CCPC Blocky 🥷🏾 173% (194/265)
14final272% (13/18)
15Fancy Pearl Giraffe67% (2/3)
16Mellow Velvet Magnet67% (2/3)
17Gentle Emerald Satellite67% (2/3)
18Dreamy Jade Dolphin67% (2/3)
19K.O.'s Player60% (3/5)
20Happy Ruby Quokka50% (1/2)
21Peppy Maroon Noodle50% (2/4)
22Speedy Peach Iguana50% (1/2)
23Sparkly Velvet Crayon50% (1/2)
24Gentle Cobalt Narwhal50% (1/2)
25Gib TicTacToe50% (2/4)
26final50% (1/2)
27Alyssa50% (1/2)
28THIS50% (1/2)
29Merry Azure Blossom43% (3/7)
30Cosmic Pink Robot33% (1/3)
31Zippy Scarlet Starfish33% (1/3)
32Bright Indigo Rainbow33% (1/3)
33marissa27% (3/11)
34Scary Random Snakes26% (65/248)
35Epic Emerald Falcon25% (1/4)
36Jazzy Ruby Pelican25% (2/8)
37Jumpy Silver Marble22% (2/9)
38Whimsical Olive Dragon20% (1/5)
39Lucky Tangerine Turtle14% (1/7)
40Friendly Maroon Gecko— (0/0)
41cheese— (0/0)
42Giant Apricot Seahorse— (0/0)
43Epic Crimson Bumblebee— (0/0)
44Thunderous Periwinkle Cactus0% (0/1)
45Shiny Maroon Cricket0% (0/1)
46Hopeful Crimson Beacon— (0/0)
47Witty Ivory Crayon— (0/0)
48Plucky Lavender Pangolin0% (0/2)
49Fluffy Periwinkle Planet0% (0/2)
50Twirly Violet Hedgehog— (0/0)
51Friendly Jade Seahorse— (0/0)
52Quirky Peach Parrot0% (0/1)
53Quiet Ruby Sequoia0% (0/1)
54Spiffy Silver Comet— (0/0)
55Mellow Apricot Meerkat0% (0/5)
56An attempt 2— (0/0)
57Glowing Bronze Jellyfish— (0/0)
58Jazzy Jade Lobster— (0/0)
59Peppy Navy Waterfall— (0/0)
60Hopeful Lavender Jellyfish— (0/0)
61Electric Copper Heron— (0/0)
62Polished Cobalt Crayon— (0/0)
63Fearless Sapphire Meerkat0% (0/1)
64Cozy Peach Pinecone0% (0/1)
65Cozy Plum Falcon0% (0/3)
66Hasty Jade Meerkat0% (0/1)
67Whimsical Lemon Zeppelin— (0/0)
68Kind Ruby Gecko— (0/0)
69Helpful Indigo Comet0% (0/1)
70Soaring Velvet Octopus0% (0/2)
71Dazzling Lemon Lighthouse— (0/0)
72Plucky Peach Wombat0% (0/2)
73Gentle Navy Waterfall— (0/0)
74Jumpy Plum Snail— (0/0)
75Cheerful Jade Falcon— (0/0)
76Gentle Plum Salamander— (0/0)
77Proud Olive Galaxy— (0/0)
78Speedy Silver Meteor— (0/0)
79An attempt — (0/0)
80Daring Jade Cactus— (0/0)
81Polished Crimson Sparrow— (0/0)
82Rustic Coral Waffle— (0/0)
83Sunny Olive Heron— (0/0)
84Glowing Pink Dragonfly— (0/0)
85Sparkly Periwinkle Cricket— (0/0)
86Helpful Magenta Beacon0% (0/1)
87Toasty Cobalt Antelope— (0/0)
88Roaring Emerald Anchor0% (0/2)
89Lucky Lemon Blossom0% (0/3)
Java Tic-Tac-Toe leaderboard
#ScriptWin rate
1Zany Lavender Antelope100% (1/1)
2Honest Pink Noodle100% (3/3)
3Quirky Magenta Planet86% (6/7)
4Noble Azure Kite67% (4/6)
5Glitch60% (3/5)
6Robsons Tic Tac to60% (3/5)
7Jumpy Maroon Galaxy50% (2/4)
8Chaotic Random Toffees43% (3/7)
9Aaden's Tic Tac Toe42% (5/12)
10Galactic Violet Cactus17% (2/12)
11Rugged Mint Yak— (0/0)
12Final0% (0/1)
13Snappy Golden Chipmunk— (0/0)
14Bright Silver Tuba— (0/0)
15Peppy Pink Ukulele— (0/0)
Blockly Tic-Tac-Toe leaderboard
#ScriptWin rate
1New Game74% (20/27)
2Default Blocks but with Functions58% (341/593)
3BattleBot41% (241/584)