Log in

No account? Create an account

Taikyoku shogi

« previous entry | next entry »
Aug. 3rd, 2014 | 12:46 am

According to Wikipedia, taikyoku shogi is the largest (known) variant of shogi, the game sometimes called Japanese chess; it is played on a 36x36 board, with each player initially possessing 402 pieces of 209 types that can move in a total of 253 distinct ways.

Pieces can be promoted in this game, and when looking at the table that Wikipedia helpfully provides, I noticed that there are chains of promotions — conceptually, if not in the game itself (a piece can only be promoted once, naturally, just like in chess or checkers).

Nonetheless, my curiosity was piqued. What does the promotion graph look like?

I ended up copying and pasting the table from Wikipedia into a text file (from the rendered article, not its source!), and turned it into a DOT file with a short Perl script:


use strict;
use warnings;
use feature qw/say/;

say "digraph taikyokushogi {";

while(<>) {

    my @F = split/\t/, lc;
    $F[0] =~ s/^\*//;

    $F[$_] = join " ", map { ucfirst } split " ", $F[$_] for(0,3);

    say qq/    "$F[0]"/, ($F[3] ne "—") ? qq/ -> "$F[3]"/ : "";

say "}";

After manually fixing the two Mountain Eagles and Howling Dogs that Wikipedia unhelpfully combined into one in the table, I then fed the resulting file to Graphviz (specifically dot) to get a rendered graph:

$ perl taikyokushogi.pl taikyokushogi.txt >taikyokushogi.dot
$ joe taikyokushogi.dot
$ dot -Tpng taikyokushogi.dot -o taikyokushogi.png

It's fairly disconnected, as expected, but there's a few slightly larger components; here's a particularly neat one:

The largest "promotion chain" is that of the Pawn, BTW, whose hypothetical career path'd take him from Gold General to Rook to Dragon King to Soaring Eagle and finally Great Eagle. (Again, keep in mind that this cannot happen in the game.)

The full graph is available here (27630x539 PNG, 433 KiB), if you're curious. Other Graphviz engines (e.g. neato) will produce different files, but I thought dot's looked the best. All files can be found here.

The whole thing's just a bit of fun, of course. But I gotta say, it's nice to have tools available to do this sort of thing — and to know how to wield them.

Link | Leave a comment | | Flag

Comments {2}

Transitioning into liminal space

(no subject)

from: stormdog
date: Aug. 3rd, 2014 02:53 am (UTC)

This game is fascinating! I'd never heard of it or its relations before, but it certainly makes me think of modern "hobbyist" board games of the sort I and my friends like so much, with their myriad pieces and moves and rules. Yay!

Reply | Thread


(no subject)

from: schnee
date: Aug. 3rd, 2014 09:32 am (UTC)

Yeah, I'd not heard of it either, despite having been quite fascinated by (East) Asian chess variants many moons ago. Of course, Wikipedia notes that it was only rediscovered in 1997 — and that was in Japan, naturally, so who knows when it was first brought to the attention of a wider audience in the anglophone world.

Speaking of board games with myriad pieces and moves and rules, have you ever read this Donald Duck story? I think you'd like it; Scrooge and Glomgold get into an argument about how's brighter and end up making a bet that they can learn the world's most complicated board game in a mere 24 hours. :)

Reply | Parent | Thread