🤖 Create Your Chess Bot with AI

Complete guide for non-programmers using ChatGPT or Claude

📖 You Don't Need to Code!

If you can have a conversation with ChatGPT or Claude, you can create a competitive chess bot. No programming experience needed.

✨ What you'll do:
  1. Tell AI what strategy you want
  2. Copy the code it generates
  3. Paste it here and register
  4. Watch your bot compete!

Time needed: 5-10 minutes
Difficulty: Easy (just copy-paste)
Required: Access to ChatGPT, Claude, or similar AI

⚡ CRITICAL RULES - Read This!

🕐 Rule #1: 20 Seconds Per Move (HARD LIMIT)

Your bot has ONLY 20 seconds to decide each move.

  • If timeout expires without calling reportMove() → Your bot LOSES the game
  • Fast simple moves beat slow perfect moves that timeout
  • Your bot should call reportMove() EARLY with a decent move, then keep improving
  • Call reportMove() multiple times - the LAST call before timeout is used

📏 Rule #2: Shorter Code Wins Draws

In a draw (stalemate, repetition, 50-move rule):

  • Shorter code gets 0.6 points (60% of a win)
  • Longer code gets 0.4 points (40% of a win)
  • This rewards elegant, compact solutions
  • Remove unnecessary comments and whitespace
  • Golf your code after it works!

💡 Smart Strategy

The "Anytime Algorithm" Approach:

  1. Call reportMove() immediately with ANY legal move (safety first!)
  2. Then search for better moves
  3. Call reportMove() again each time you find an improvement
  4. The server uses your LAST reported move before 20s timeout

This guarantees you never timeout while still finding the best move possible!

1 Choose Your AI Assistant

Use any of these AI tools (all work great):

🟢 ChatGPT (Recommended)

Free version works! Go to chat.openai.com

Best for beginners. Very easy to use.

🟣 Claude (Also Great)

Go to claude.ai

Often produces very clean code.

🔵 Other AI Tools

Gemini, Copilot, or any coding AI works!

As long as it can write JavaScript.

2 Copy This Prompt

Copy the text below and paste it into your AI assistant:

I want to create a chess bot for ChessArena.dev. Please write a JavaScript function following these CRITICAL rules:

🚨 CRITICAL RULES:
1. 20 SECOND TIME LIMIT PER MOVE - if we don't call reportMove() in time, we LOSE!
2. Use "anytime algorithm" pattern: call reportMove() EARLY, then keep improving
3. Shorter code wins in draws - keep it compact!

Function requirements:
- Named exactly: makeMove
- Takes 3 parameters: board, timeRemaining, reportMove
- Uses chess.js library (already provided)
- Must call reportMove(legalMove) IMMEDIATELY with first valid move
- Then can call reportMove() again with better moves as we find them
- Last call to reportMove() before timeout is used

Forbidden:
- NO fetch, eval, async/await, or network requests
- Maximum 30KB of code
- NO board modification methods (see below)

📚 API REFERENCE - Available Methods:

🚫 FORBIDDEN METHODS - Will cause validation to FAIL:

⛔ board.load(fen) - Modifies the board position (READ-ONLY board!)
⛔ board.reset() - Resets the board (READ-ONLY board!)
⛔ board.put(piece, square) - Places a piece (READ-ONLY board!)
⛔ board.remove(square) - Removes a piece (READ-ONLY board!)
⛔ board.clear() - Clears the board (READ-ONLY board!)
⛔ board.load_pgn(pgn) - Loads a game (READ-ONLY board!)

❌ Using any of these will immediately fail validation with error:
   "FORBIDDEN: board.xxx() is not allowed. The board is read-only."

✅ ALLOWED METHODS:

🎯 board.moves() → Returns array of legal moves
   Example: ["e4", "d4", "Nf3", "Nc3", ...]
   const moves = board.moves();
   reportMove(moves[0]); // Play first legal move

🔄 board.clone() → Create mutable copy for move exploration
   Example: Test moves without affecting the original board
   const clone = board.clone();
   clone.move("e4");  // Make move on clone
   const evaluation = evaluatePosition(clone);
   clone.undo();      // Undo on clone

   ⚠️ The original board is READ-ONLY. Use clone() to explore moves!
   ⚠️ DO NOT use board.move() + board.undo() on the original board

🔍 board.get(square) → Get piece at a square
   Example: board.get("e2") returns {type: 'p', color: 'w'} or null
   const piece = board.get("e4");
   if (piece && piece.type === 'q') {
       // There's a queen on e4
   }

⚪⚫ board.turn() → Whose turn is it?
   Returns: 'w' for white, 'b' for black
   if (board.turn() === 'w') {
       // It's white's turn
   }

🎯 board.fen() → Get board position as FEN string
   Example: "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

✅ board.in_check() → Is current player in check?
   if (board.in_check()) {
       // Must escape check!
   }

🏁 board.game_over() → Is game finished?
   Returns true if checkmate, stalemate, or draw

🧠 getMemory() → Monitor memory usage (in MB)
   Returns: {heapUsed: 45, heapTotal: 89, rss: 120, external: 2}
   const mem = getMemory();
   if (mem.heapUsed > 200) {
       return; // Stop to avoid crash!
   }

⏱️ timeRemaining → Milliseconds left (starts at 20000)
   if (timeRemaining < 1000) {
       return; // Less than 1 second left, stop searching
   }

Strategy pattern (IMPORTANT):
function makeMove(board, timeRemaining, reportMove, getMemory) {
    // 1. IMMEDIATELY report first legal move (safety!)
    const moves = board.moves();
    reportMove(moves[0]);

    // 2. Now search for better moves using clone()
    for (const move of moves) {
        const clone = board.clone(); // Create mutable copy
        clone.move(move);            // Test move on clone

        // Evaluate position, look ahead, etc.
        const score = evaluatePosition(clone);

        // No need to undo - just discard clone
        if (score > bestScore) {
            reportMove(move); // Found better move!
        }
    }

    // 3. Call reportMove() again each time we find better move
    // 4. Server uses LAST reported move before timeout

    // OPTIONAL: Monitor memory usage
    // const mem = getMemory();
    // if (mem.heapUsed > 200) {
    //     // Stop searching if using too much memory
    // }
}

Please write a competitive bot that follows this anytime algorithm pattern!
💡 Tip: The AI will generate a complete chess bot for you. You can ask it to make changes like "make it more aggressive" or "add piece-square tables" to improve it!

3 Get Your Bot Code

The AI will respond with JavaScript code. It should look something like this:

function makeMove(board, timeRemaining, reportMove, getMemory) {
    const moves = board.moves();

    // ⚡ CRITICAL: Report a move immediately (anytime algorithm!)
    reportMove(moves[0]);

    // Now we have 20 seconds to find something better
    // Each time we find improvement, call reportMove() again

    // Try to find captures using clone()
    for (const move of moves) {
        const clone = board.clone();  // Create mutable copy
        const result = clone.move(move);

        if (result && result.captured) {
            reportMove(move); // Found a capture, report it!
            break;
        }
        // No need to undo - clone is discarded
    }

    // Could add more sophisticated search here
    // Just keep calling reportMove() with better moves!
}

✅ Good to see in your code:

  • Calls reportMove() EARLY (first few lines) - this prevents timeout losses!
  • Function starts with function makeMove(
  • Has four parameters: board, timeRemaining, reportMove, getMemory
  • Calls reportMove() multiple times as it finds better moves
  • Optional: Use getMemory() to check memory usage and avoid OOM crashes
  • No fetch, eval, or await keywords
  • Compact code (remember: shorter wins in draws!)
⚠️ If AI makes a mistake: Just tell it "This function needs to call reportMove() at least once" or "Remove the async/await keywords" and it will fix it.

4 Register Your Bot

Now you're ready to register!

  1. Click the button below to go to registration
  2. Paste your bot code (copy everything the AI gave you)
  3. Give your bot a name (e.g., "Aggressive Knight")
  4. Enter your name (your username)
  5. Click "Register Bot"
✅ You'll receive:
  • A unique Bot ID
  • An Update Token (48 characters - SAVE THIS! You need it to update your bot later)
  • An Auth Code (legacy - kept for backwards compatibility)
  • Your starting ELO (1200)

🚀 Register Your Bot Now

🎯 Strategy Ideas to Try

Ask the AI to implement any of these strategies:

🗡️ Aggressive Attacker

"Make a bot that always tries to capture enemy pieces and checks the king whenever possible."

🛡️ Defensive Fortress

"Create a bot that protects its pieces and only attacks when safe."

🎲 Positional Player

"Build a bot that controls the center squares and develops pieces quickly."

🧠 Minimax Thinker

"Implement a minimax algorithm with alpha-beta pruning that looks 3 moves ahead. Use board.clone() to explore move sequences without affecting the original board."

⚡ Material Counter

"Make a bot that evaluates positions by counting piece values (pawn=1, knight=3, etc.) and picks moves that maximize material."

🎨 Your Custom Idea!

"Describe any chess strategy you can imagine - the AI will try to implement it!"

📈 Improving Your Bot

Your bot will start competing automatically. If it's losing too much:

Option 1: Ask AI to Improve It

My chess bot is losing. Can you improve this code to make better moves?

Current strategy: [describe what your bot does]

Suggestions:
- Look ahead more moves
- Better piece valuations
- Avoid leaving pieces undefended
- Control more center squares

Here's my current code:
[paste your bot code here]

Option 2: Try a Different Strategy

Go back to Step 2 and ask for a completely different approach!

Option 3: Combine Strategies

💡 Pro tip: Ask the AI to "Combine aggressive piece capturing with defensive king safety" or mix any strategies you like!

To update your bot:

  1. Get the new code from AI
  2. Go to registration page
  3. Scroll down to the "Update Existing Bot" section
  4. Enter your Bot Name (exact name, e.g., "grok 3")
  5. Enter your Update Token (48-character token you received when registering)
  6. Paste your new code
  7. Click "Update Bot"
⚠️ Important: You need the Update Token you received when you first registered your bot. If you lost it, you'll need to register a new bot with a different name.

Your ELO and stats are preserved when you update!

❓ Common Questions

Do I need to know JavaScript?

No! The AI writes all the code. You just copy and paste.

What if my bot doesn't work?

The platform will tell you exactly what's wrong when you try to register. Common fixes:

  • Make sure the function calls reportMove()
  • Remove any async or await keywords
  • Remove any fetch() or network calls

Just tell the AI what the error message says and it will fix it!

Can I see other bots' code?

No - bots are kept secret to keep the competition fair. But you can see the leaderboard and stats!

How often does my bot play?

It depends on your ELO. Higher-rated bots play more often (soft meritocracy). Everyone plays at least 2 games per day.

What if there's a draw?

Shorter code wins! In a draw (stalemate, repetition, 50-move rule):

  • Shorter code gets 0.6 points (60% of a win)
  • Longer code gets 0.4 points (40% of a win)
  • This rewards elegant, compact code

Pro tip: After your bot works, ask AI to "make this code shorter and more compact" to improve draw performance!

What happens if my bot times out?

You LOSE the game! Each bot has exactly 20 seconds per move. If you don't call reportMove() before the timeout, you automatically lose. This is why the "anytime algorithm" approach is critical - always report a move early, then improve it.

Can I see how much time is left?

Yes! The timeRemaining parameter shows milliseconds left. You can use it to decide when to stop searching: if (timeRemaining < 1000) return;

Can I have multiple bots?

Yes! Register as many as you want. Try different strategies and see which performs best.

Is this free?

Completely free! Both using the platform and using AI assistants like ChatGPT (free version works).

🎉 Ready to Create Your Bot?

You're just 5 minutes away from having your own chess AI competing!

Register Your Bot View Leaderboard

Need help? Check the full documentation