Background: I've been working on a code challenge to write players for the game Thud, from Terry Pratchett's novel, Thud! This is nearing completion, to go live on StackExchange.
You can play my version of the game here: https://ajfaraday.github.io/Thud/dist/index.html
- Hover over a piece to see it's moves
- Yellow moves are safe
- Orange moves can be taken on the next turn
- Red (on mouse hover) moves take one or more pieces
- Click it to select it
- Click on one of the move options to move (and change to the next player's turn, where their moves will be highlighted)
I've tried to directly model these movement rules from Wikipedia:
On the dwarfs' turn, they may either move or hurl one dwarf:
- Move: any one dwarf is moved like a chess queen, any number of squares in any orthogonal or diagonal direction, but not onto or through any other piece, whether Thudstone, dwarf, or troll; or
- Hurl: anywhere there is a straight (orthogonal or diagonal) line of adjacent dwarfs on the board, they may hurl the front dwarf in the direction continuing the line, as long as the space between the lead dwarf and the troll is less than the number of dwarfs in the line. This is different from a normal move in that the dwarf is permitted to land on a square containing a troll, in which case the troll is removed from the board and the dwarf takes his place. This may only be done if the endmost dwarf can land on a troll by moving in the direction of the line at most as many spaces as there are dwarfs in the line. Since a single dwarf is a line of one in any direction, a dwarf may always move one space to capture a troll on an immediately adjacent square.
On the trolls' turn, they may either move or shove one troll:
- Move: one troll is moved like a chess king, one square in any orthogonal or diagonal direction onto an empty square. After the troll has been moved, any dwarfs on the eight squares adjacent to the moved troll may optionally be immediately captured and removed from the board, at the troll player's discretion; or
- Shove: anywhere there is a straight (orthogonal or diagonal) line of adjacent trolls on the board, they may shove the endmost troll in the direction continuing the line, up to as many spaces as there are trolls in the line. As in a normal move, the troll may not land on an occupied square, and any dwarfs in the eight squares adjacent to its final position may immediately be captured. Trolls may only make a shove if by doing so they capture at least one dwarf.
I know I've made one difference, trolls always capture all their neighbouring dwarfs.
Other than that, are there any further discrepancies between the presented moves and the movement rules from the instructions?