Skip to main content

Crate hnefatafl_copenhagen

Crate hnefatafl_copenhagen 

Source
Expand description

An AI, client, engine, and server for the game of Copenhagen Hnefatafl.

§Feature Flags

By default the client and server feature flags are enabled.

  • client - enable the hnefatafl-client binary
  • console - on Windows print output to the console
  • debug - enable iced debug mode, also log on the debug level
  • js - enable options for generating javascript code
  • runic - enable the icelandic-runic binary for translating Icelandic to Icelandic Runic
  • server - enable the hnefatafl-server-full binary

§Message Protocol

Get more information about the message protocol used by the engine.

§OpenTafl and TaflZero

If you want to adapt your AI for this server’s tournaments, have a look at the OpenTafl and TaflZero code. Following is the game format expected to be used by clients when they issue the command resume_game_json <game-id>\n. You will get back = resume_game_json <opentafl_game_json>\n. opentafl_game_json is below. The messages are newline delimited, but for ease of reading opentafl_game_json has been pretty printed.

§OpenTafl Game Format

{
  "id": 34253,
  "attackers": "david",
  "defenders": "ai-taflzero-10",
  "dim": 11,
  "start": "/3AAAAA3/5A5/11/A4D4A/A3DDD3A/AA1DDKDD1AA/A3DDD3A/A4D4A/11/5A5/3AAAAA3/",
  "time_control": {
    "main_time_seconds": 900,
    "increment_length": 10
  },
  "time_remaining_ms": {
    "attackers": 885694,
    "defenders": 911981,
    "last_move": "2026-06-24T19:57:38.07Z"
  },
  "moves": "d1-d3 e5-e2 d3-d2xe2 f8-c8",
  "rated": true,
  "messages": [
    {
      "username": "david",
      "timestamp": "2026-06-24T19:57:33.519700276Z",
      "content": "Hello!"
    }
  ]
}

Modules§

accounts
ai
board
characters
draw
email
game
game_tree
glicko
heat_map
locale
message
opentafl
This code handles converting to and from the OpenTafl format.
play
rating
role
server_game
space
status
time
tournament
tree
utils

Constants§

COPYRIGHT
HOME
LONG_VERSION
SERVER_PORT
SOCKET_PATH
SOFTWARE_ID
The software package that this is.
VERSION_ID

Functions§

invalid_username
read_response
Errors
tcp_keep_alive
write_command
Errors

Type Aliases§

Id