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 , , , , , , , , ,

20 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.

  7. couchtomato87 says:

    Hi! For what it’s worth, a bunch of shogi variants are also available at http://www.pychess.org 🙂 Outside of Shogi, this also includes Minishogi, Kyoto Shogi, Gorogoro Shogi, Dobutsu Shogi, and Tori Shogi! These games are all available to either play with a top-notch engine (Stockfish) or play against other people.

    • Nice to see you have included Tori Shogi 🙂 I hope you will consider including some of the historical variants, like Chu Shogi, which are some of the most creative and fascinating Chess-like games ever constructed. Chu Shogi in particular is still played at a high level and still has an official organisation and tournaments in Japan.

      Speaking of modern variants, I have spent many months constructing some modern 11×11 Shogi variants (with drops) that use pieces from the ancient large variants. I’ll be posting about them here over the next couple of weeks, I hope you’ll check them out.

      • couchtomato87 says:

        Unfortunately we can’t add chu shogi because the engine we depend on is limited to 12 x 10. I look forward to seeing what you come up with!

  8. […] I’ve been working with Stephen Tavener and his Ai Ai software to slowly and laboriously bring Shogi and its modern variants to life as well as the fascinating historical variants, I’ve been inspired to build on what […]

  9. MY says:

    Hi! Having a question here. For pieces in Sho Shogi, do they promote like Chu/Dai, or like modern Shogi? For example, what does Lance promote to, White Horse or Gold? Thanks!

  10. MY T says:

    Hi, I’m here to report a problem about Chu Shogi in Ai AI. In almost every game (thinking time <=5s), AI trade some of its Bishops and/or Dragon Horses for my Pawn/Go-Between for no reason.

    • Chu Shogi is a very large game. At <5 seconds thinking time the engine is not seeing far enough ahead to pick good moves and is essentially playing randomly. If you want better play from the AI you should increase the thinking time substantially.

      Please note my advice at the top of my article from 13 May: "The AI is very much a work in progress! Some of these games are truly gigantic, and as a result getting strong play out of the Shogi engine in Ai Ai is really, really difficult. When you do play against the AI, be sure to give it plenty of thinking time; at an absolute minimum, give it 30 seconds per move for the 16×16/17×17 games, 1 minute for 19×19, and 2 minutes or more for 25×25. If you have an old computer with a slow CPU you may need to amp those times up significantly. If the thinking times are too low, you may find the AI repeats moves a lot as it struggles to find useful continuations."

Leave a comment

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