Hnefatafl: the Game of the Vikings

Tackling Central Draw Forts

The king may move up and down indefinitely
The king may move up and down indefinitely

Wednesday, 2nd March 2016

Draw forts can be a big problem in serious hnefatafl play on boards of 11x11 squares upwards. A draw fort is a construction of pieces generally useful to the king's side. A typical draw fort has an impregnable outer shell of defenders, with space inside for the king to move safely back and forth.

Draw forts are an instinctive strategy for a defending player who considers their position lost. This can happen often in a game like The Viking Game or Fetlar hnefatafl, when the attacking player has learned the strategy of blocking the corner exits quickly but the defending player has not yet learned to counter this.

In casual games the problem is not too serious. But in tournament play it can be disastrous. Consider an average but devious player outmatched in general strategy by a former champion in the early rounds of a tournament. The devious player could avert the expected loss with a blatant spoiling strategy: construct a draw fort within the first few moves and nudge the king back and forth within it till a draw is declared.

There have been various attempts to counter this behaviour over the years. One simple proposal is that if the game is brought to a standstill by repetition, the king has lost, because he is never going to escape. He is unable to leave the battlefield and is effectively captured already. But this rule also rules in the attackers' favour if the king is in a strong position able to switch between two threats ad infinitum. This unintended consequence may have an effect on the balance of the game.

A more successful attempt to eliminate a blatant spoiling strategy is to award victory to the attackers if they completely surround all of the defending pieces. This was a feature of York Hnefatafl in 1980, and was revived in Copenhagen Hnefatafl.

Another idea against blatant spoiling strategies is that a draw can only be awarded if the game has been advanced to a certain stage, say a certain number of captures on each side. This has been used at Aage Nielsen's web site for games other than Copenhagen hnefatafl.

I think that the best solution is the one from York Hnefatafl: if the defending pieces are completely surrounded then they have lost, as they and their king are confined. This has the added bonus of elminating a long drawn-out end game against a novice or computer defender, where the attacker has to gradually constrict the defenders and pick them off one by one.


The 'surrounding is fatal' rule is an elegant solution, and the one I adopted for the computer tafl tournament, but there is a way to make threefold repetition work. Because it takes fewer steps, I'll discuss it in terms of twofold repetition; that is, the game ends in some way whenever a board state repeats for the first time. Consider: in any case where the best move leads to infinite repetition, there's one player who is forcing the repetition, and one who is responding. Here's a contrived example using Sea Battle rules, with the king on d8 and an attacking piece on d9: 1. Kd8-b8 d9-b9 The king begins to force a repetition. The state after both of these moves is the starting state: king on b8, attacker on b9. 2. Kb8-c8 b9-c9 3. Kc8-b8 c9-b9 The attacker has moved into the position for the second time here, which triggers the end of the game. The trick is to declare that the player who moves into a position for the second (or third) time either wins or loses, depending on what sort of play you want to reward. I haven't settled on which method I prefer: giving the player who makes the final repetition the win favors the attackers on the edges, in the little test games I've played out, but requires slightly more alert play from the attackers to score a repetition win in case of a draw fort: the attacker must move a piece to a non-repeated board position after the defender closes the fort, then the repetition rule belongs to him. Generally, I think giving the player who makes the terminating move the win makes a little more sense: it's easy to construct trivial examples where that provides the wrong result, where the side on the back foot is given the win. The example above is one, but I don't think it would ever arise in a game: if the king has that much freedom, he can certainly make a move to break the repetition, and can probably find a way to escape cleanly elsewhere on the board. In the only case I can think of where his move is actually, honestly forced... Sea Battle rules King on c5 Attackers on: a8, b7, c9, d8, e7 1. Kc5-c8 e7-c7 Now the king is in danger of being captured. 2. Kc8-b8 c9-b9 The king is still in danger of being captured. 3. Kb8-c8 b9-c9 The attacker's move repeats the board state for the second time, and the attacker wins. In other words, only if the king moves into a trap in the first place can he be *forced* to take a loss by repetition. In other cases, he can escape to try again, and I think there's greater value in requiring that the king's escape be clean. It more closely matches the mindset required to play the defenders: making a daring, incisive cut in the enemy lines to win convincingly. Losing by repetition, with this rule, requires getting mired in an enemy position, a poor recipe for escape in the best of times. Apologies for the lengthy and rambling comment! I had to convince myself I had the right rule in place for my tournament.

Jay Slater - 19:34, 05/04/2016

The problem I've encountered is the one you've solved: deciding exactly who is responsible for causing the ceaseless repetition, i.e. the one who has the freedom to vary the move without thereby immediately losing the game.  I suspect for an AI-vs-AI match I'd probably just disallow repeated positions, go-style, but I'm not sure what effect that would have on the balance of the game.

Damian Walker - 12:12, 09/04/2016

Your definition of the one forcing the repetition (the one who has the freedom to vary the move) is brilliantly concise. Thanks—it's certainly helpful for me as far as thinking about it goes.

As to your second point, OpenTafl's built-in AI actually does disallow repeated positions, as it stands—they present a horizon problem, in that it normally takes eight moves to play out a threefold repetition, and OpenTafl's AI normally only manages depth 5 and occasionally 6, for the 11x11 boards and ~30-second thinking times. (This is mitigated somewhat by its horizon-extending function; it reserves some time to do a deeper search on the five best moves, and will usually get from the start of a repetition past the end, again, given ~30-second thinking times.)

As far as balance goes, I can't say for sure, but that is a topic I can research—now that OpenTafl correctly handles threefold repetitions, I can have the AI play a hundred or so games against itself with repetitions forbidden, then have it play with repetitions allowed, and see if the win percentages are different. I'll need a few hours some evening or another to let that run in the background. When I have results, I hope to post about them.

Jay Slater - 15:02, 14/04/2016

New Comment

Yes No