Shogi and some variants now available in Ai Ai — play against AI or online!

UPDATE (12 April): Stephen has updated Ai Ai to fix a bug with Chu Shogi’s Lion, and we also added several new variants including Goro Goro Shogi, Goro Goro Plus and Wa Shogi!  Grab the updated version here.

——-

For the last few weeks, Stephen Tavener and I have been collaborating to bring Shogi and several of its variants to his amazing Ai Ai software, a general game-playing program that lets you play hundreds of abstract strategy games against strong AI, or against human opposition online.

Last year Stephen added a general Chess-playing engine to Ai Ai, and has been steadily adding lots of great Chess variants to it such as Capablanca Chess, Chess960 and Grand Chess.  I had been embarking on a project to playtest some of the more promising large Chess variants — on 10×8 boards and larger — and so Stephen added a huge array of new piece types into Ai Ai so that these variants could be added in (more on these games in a future post).  Then we got started on Shogi, which turned into quite a project — Stephen had to cope with some incredible coding challenges throughout, from implementing drops to Chu Shogi’s complex Lion-trading rules.  On top of that there was lots of design work to do, because we wanted to offer multiple piece graphic sets to help people who have trouble learning Japanese kanji characters.

In the end we went with three sets of pieces: traditional pieces using a single kanji character for each piece; mnemonic pieces that combine the kanji with mnemonic diagrams designed by HG Muller; and diagrammatic pieces, where each piece is a simple square shape with a diagram of the piece’s move on it.  With these three options in place, these games should be accessible to a larger audience.

Modern Shogi

First and foremost in Ai Ai’s new Shogi assortment we have modern Shogi, played on a 9×9 board with ten different types of pieces.  For those who aren’t familiar with Shogi, it has several major differences from Western Chess:

  1. Pieces that are captured are truly captured — they become the property of the capturing side, and are placed on the side of the board under their control.  At any time, a player may ‘drop’ a captured piece to any empty square on the board in lieu of a normal move (with some restrictions).  Drops make Shogi a very dynamic and aggressive game, and drastically change the feel in comparison to Chess.  Because pieces keep coming back to life, the board stays mostly full of pieces throughout the game; endgames are often an exciting race to checkmate as both sides’ defences break down and they start launching brutal attacks back and forth.
  2. Nearly all pieces can promote — unlike in Chess, where only Pawns may promote upon reaching the opponent’s back rank, in Shogi nearly all pieces can promote when they reach the opponent’s starting area.  Pieces promote by flipping over and revealing a new piece on the opposite side, which is more powerful than the original.  Promoted pieces are demoted again once captured, though.
  3. Shogi is a bigger game than Chess, taking place on a 9×9 board with 81 squares as opposed to Chess’ 8×8 board with 64 squares.  Shogi also has ten types of pieces, significantly more than the six types present in Chess.

There’s a lot more to it than that, of course, but these three changes alone make Shogi stand out among the modern variants of Chess played around the world.  It’s a vibrant and exciting game and well worth trying if you’ve ever enjoyed a game of Chess.

Shogi games tend to take a bit longer than Chess; a typical Chess game lasts about 80 moves in total, whereas a Shogi game generally lasts around 120 moves.  Some small variants of Shogi have been designed to generate some quick-playing games that still capture the feel of the full game, and that serve as useful introductions for new players or children.  In Ai Ai we’ve added a couple of these:

In Minishogi, Shogi gets shrunken down to a tiny 5×5 board with just six pieces per player.  Surprisingly the game is still remarkably deep at this size, thanks to the complexities of drops.  Judkins Shogi is similar, but uses a 6×6 board with seven pieces per player, adding the Knight back into the mix.

Sho Shogi, Chu Shogi and Dai Shogi

As readers of this blog will know, I have a certain fascination with the ancient variations of Shogi, particularly the ambitious and gigantic ones.  I’m delighted to say that Stephen has implemented some of these variants in Ai Ai as well!

Back in the early days of Shogi, from the 13th-16th centuries or so, the game came in three sizes —  Sho Shogi on a 9×9 board (Small Shogi, which became modern Shogi), Chu Shogi (Middle Shogi) on a 12×12 board, and Dai Shogi (Large Shogi) on a 15×15 board.   At this time drops were not in the game, so pieces that are captured are removed from the game permanently.  Sho Shogi was considered a quick game, often played with children, while Chu Shogi was the most popular form and the enormous Dai Shogi was for a time the most prestigious variation.

Eventually drops entered the game sometime in the late 16th century, and this innovation suddenly catapulted Sho Shogi to the forefront of the Shogi world.  Today Chu Shogi still survives, and is considered by some to be the best large Chess game ever invented, whereas Dai Shogi is still played as well but much less frequently than Chu.

All three of Shogi’s closest ancestors are now playable in Ai Ai:

The eagle-eyed among you will notice that Sho Shogi sports an additional piece sat in front of the King.  This is the Drunk Elephant, a powerful defender that promotes to a Crown Prince, which functions as a second King!  If you manage to make a Crown Prince, your opponent must capture both your Prince and your King to win the game.  Both Chu and Dai Shogi have Drunk Elephants as well, and numerous other new pieces; Chu Shogi has 28 piece types, and Dai Shogi has 36!  As you might expect, the larger games are challenging for the AI to play well, so be sure to set the AI’s thinking times quite high if you’d like a challenge.

I highly recommend trying these historical variants, particularly Chu Shogi and Dai Shogi, which I’ve written about extensively before.  Chu and Dai are wonderful games, richly strategic and packed full of variety, and I hope some of you out there may try your hand at them now that they’re available in Ai Ai.

Tori Shogi

For those who prefer quicker and tighter gameplay, we also added a more recent historical variant of Shogi — Tori Shogi, or Bird Shogi.  Tori Shogi gets its name from the fact that all the pieces have names related to birds — even the Pawns are changed to Swallows.  Tori Shogi was invented by Toyota Genryu in 1799, and has the unique distinction of being one of only two historical variants for which we have recorded games played by professional players (the other being Chu Shogi).  Tori Shogi has gained a certain amount of popularity in the West, and there’s even a fine English-language book available on the game for those who want to learn to play well.

Tori Shogi is played on a 7×7 board with eight different types of pieces, two of which only appear by promotion.  The small 49-square board starts packed with 16 pieces for each player, making the early game quite claustrophobic!  The game uses drops as in modern Shogi, but with one major difference: in modern Shogi, you may never drop a Pawn to a file that already contains one of your Pawns, but in Tori Shogi you may have two Pawns on the same file at a time.  This small change hugely alters the game’s tactics and gives it a very different feel from standard Shogi.

Below you can see the initial position of the game, and a sample game in animated GIF form.

Next Moves

We are forging ahead with some additional variants for the next release.  First up we have Goro Goro Shogi, a modern small variant developed in 2012 as a way to help young kids in Japan to learn modern Shogi.  This game is played on a 5×6 board with a limited selection of pieces, but unlike Minishogi and Judkins Shogi, there are three Pawns per side instead of just one.  In my opinion this makes Goro Goro a much better introduction to Shogi, as the use of Pawns is essential in the full game (much as in Chess).

We have also added Goro Goro Plus, a fantastic little variant that takes Goro Goro and gives each player a Lance and Knight in hand at the start of the game, available for drops.  This addition really spices up the game and makes Goro Goro more than just a Shogi learning tool, and turns it into an exciting game in its own right.

On the historical variants side of things, we have Wa Shogi, an 11×11 game that shares with Tori Shogi a certain flair for exotic, animal-based piece names.  Unusually for a Shogi variant, Wa is playable both with and without drops, and is a great game either way!  I slightly prefer playing with drops, which gives the game an exciting pace and added tactical sharpness.  Without drops Wa Shogi becomes a delicate strategic affair, where players often try to establish coordinated invading legions that can escort the weaker pieces to the promotion zone (the weakest pieces in Wa have strong promotions).  The two faces of Wa play really differently, so it’s like having two games in one.

I highly recommend Wa Shogi for fans of modern Shogi; particularly when played with drops, it feels like a clever expansion of Shogi with a distinct feel due to its asymmetric starting position and unusual pieces.  I firmly believe that if a concerned effort were made to promote this game it could achieve a decent level of popularity!

So that’s a quick roundup of all the Shogi goodness now available in Ai Ai, and a little preview of what’s to come — please go give the games a try, and of course give me a shout if any of you out there fancy a game!

Sometime down the line I’ll be back with another roundup, in which we’ll be taking a look at the large Chess variants available in Ai Ai as well.  I’m also nearly done with an in-depth analysis of a Chu Shogi game, and an introduction to Tenjiku Shogi, so look out for those posts coming soon (-ish).

Tagged , , , , , , , , ,

12 thoughts on “Shogi and some variants now available in Ai Ai — play against AI or online!

  1. Ryan Kuo says:

    This is very exciting!

    Is it confirmed that the lion trading rules are fully working? I just tried a game of Chu Shogi and the white lion (two squares away) was able to capture my lion that was protected by both a pawn and a dragon horse. The AI made a first move to bring it next to my lion, and then decided that it could capture my lion on the second move because it was now adjacent. But this isn’t how the lion moves work, right? Both squares should be evaluated as one move.

  2. Ryan Kuo says:

    That’s fantastic, thanks to you both for fixing this so quickly! And for adding Wa Shogi too.

    • No problem! Let us know if you find any other issues… hopefully it’s all good now 🙂

      We’re working on even more variants, but we’re getting to the really big ones now so it’ll take a little while!

  3. […] of the many challenges of working on the large Shogi variants is the language barrier.  Not only are the historical documents explaining these games in […]

  4. […] my previous post on our addition of multiple variants of Shogi to the Ai Ai general game-playing software, Stephen and I have been hard at work implementing even […]

  5. Kristof says:

    Unfortunately, an engine implemented in AiAi is weak. I set thinking time at 15 seconds and easily won a Tori Shogi game after drinking two beers.

    • As I mentioned in the follow-up to this post, the AI is a work-in-progress.

      What would be helpful is if you provided some actual information. What is your Shogi rating? What sort of mistakes did the AI make? Did you try altering any of the AI parameters besides the thinking time? Can you send me the game save in .mgs format? Etc.

  6. elco2 says:

    Well, Ai Ai passes the Falcon trap for Tori Shogi. At 15 seconds it’s beatable for me, but quite a task. It’s exactly what I wanted… It is odd that it doesn’t show me how many of a piece I and my opponent have in hand.

    • Thanks for the feedback! Glad you’re enjoying it 🙂 Point taken on the unclear display of pieces in-hand — I’ll pass that on to Stephen and see if we can do something about that in a future release.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: