Write code to solve Wordle Puzzles

Code Battleground lets you test your skill at solving puzzles. Compare your results against your own code, or against others to see how your code performs.

Code Battleground provide you an API that allows you to create a new game and submit your guesses. On each request, it responds with information about which characters are correct and incorrect, similar to the official New York Times puzzle. Use the data from the response to make subsequent guesses until you find the solution!

Return here to the dashboard to see how your code performed. The current top algorithms can solve puzzles in around 3.5 guesses. Can you do better?

Top Clients

Wordle Rules

Code Battleground's Wordle API mimics most of how the New York Times offical game works.

There are two lists of words. Together there are 12,972 valid words:

  1. Words that can be a solution (2,315 words)
  2. Words that are valid for guessing, but will never be a valid solution (10,657 words)

Download the list of valid words at dictionary-solutions.txt and dictionary-words.txt

Each guess must be a valid word (from the dictionary-words.txt) list.

You may not guess words you have already attempted in the current game.

Unlike the official game solutions are not pre-selected, and will be repeated. Each time you start a new game, it select a random word from the list of valid solutions. This provides a better measuring capability for how capable your Wordle-solving algorithm is.

Get Going

Getting started is simple. Enter a client name here and you'll receive an API Token.

Create your application token:

Or enter an existing token to see your results and statistics:

API Documentation

Authentication

CodeBattleground uses a common "Bearer" token for authorization. Simply include the authorization header in your HTTP request parameters in the format:
Authorization: Bearer your_api_key_goes_here

Starting a Game

Call the /v1/start endpoint to start a new game. This select a random word for your game and assigns you a game_id that you will use in attempts to solve the puzzle

curl --location 'https://wordle.codebattleground.com/api/v1/start' \
--header 'Authorization: Bearer your_api_key_here

Response:

{
    "game_id": "gm_your_game_id_here",
    "created_ts": "2023-08-01 01:02:03",
    "status": "started",
    "available": [
        "a", "b", "c", "d", "e", "f", "g", "h", "i", "j",
        "k", "l", "m", "n", "o", "p", "q", "r", "s", "t",
        "u", "v", "w", "x", "y", "z"
    ],
    "solved": {
        "1": "",
        "2": "",
        "3": "",
        "4": "",
        "5": ""
    },
    "needed": [],
    "wrong": {
        "1": [],
        "2": [],
        "3": [],
        "4": [],
        "5": []
    }
}

Note that the response contains the game_id which you will need for submitting solutions to this game. Also note that the available, solved, needed, and wrong nodes give you essential information about how your guess fits into the solution

Submitting Solutions

Call the /v1/solve submit a guess and see the results.

curl --location 'https://wordle.codebattleground.com/api/v1/solve' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer your_api_key_here' \
--data '{
    "game_id" : "gm_your_game_id_here",
    "guess" : "wacko"
}'

Response:

{
    "game_id": "gm_your_game_id_here",
    "status": "in_progress",
    "created_ts": "2023-07-31 02:31:21",
    "attempts": {
        "guess": "wacko",
        "created_ts": "2023-07-31 22:40:30"
    },
    "available": [
        "b", "d", "e", "f", "g", "h", "i", "j", "l", "m",
        "n", "o", "p", "q", "r", "s", "t", "u", "v", "x", "z"
    ],
    "solved": {
        "1": "",
        "2": "",
        "3": "",
        "4": "",
        "5": ""
    },
    "needed": [
        "o"
    ],
    "wrong": {
        "1": [],
        "2": [],
        "3": [],
        "4": [],
        "5": [
            "o"
        ]
    }
}

Note that this response indicates that the letters w, a, c, and k are not found in the solution because they have been removed from the "available" node. Also, the letter o is needed in the solution but it isn't in the 5th character position.