Delving into Tori Shogi

I have never played tori shogi. It’s a fascinating game written back about 200 years ago in Japan by an expert swordsman. As a game, several master shogi players have played tori shogi seriously, but not anywhere near as many as should have.

My personal journey towards tori shogi started decades ago. I’ve been playing shogi for many years. I actually picked up shogi from a Japanese friend of mine back in the early 1990’s. He was sick of me beating him in chess, so he pulled out a shogi board he had had his parents send him from Japan. He said, he could beat me a few times in shogi and even up the score.

He definitely beat me in shogi. We played many times after that, and when we parted ways, he gave me his shogi board as a gift. I still have that shogi board and taught all my children shogi using it.

Fast forward to the late 2010’s and I’ve written several versions of shogi AI’s. I wrote them mostly because it was so hard to find good opponents to play shogi against. I probably never would have written my first shogi AI if not for being completely unable to find opponents back in the 2000’s.

I actually snagged a lot of the old code from the shogi AI I wrote back then and put it into the online shogi prototype over at japanesechess.org. That one is really just a prototype I threw together from old code with a couple of weeks of work. The AI is a bit crippled by being rewritten in JavaScript. (Running a shogi AI in a web browser does not provide nearly the resources that running a shogi AI in a desktop app does.) Also, I didn’t use a good algorithm for the shogi AI, so I groan whenever I play it.

Now, I’m interested in learning tori shogi. I don’t have many options for opponents in my area, so I’m going to write a tori shogi game and AI. I’ve actually got a fair way along in writing my new tori shogi game. I’ve written the code for the tori shogi board and tokens. I’ve also hooked up the UI code to the ClojureScript code that will be the brains of the game and the AI.

One of the key piece of the tori shogi AI is called the Alpha-Beta Pruning library. I’m writing that today in ClojureScript for use in the tori shogi game I’m making for my funwebgames.net site. Alpha-Beta algorithms are used for most board games in the shogi and chess genres, so I can reuse this library for other games after I finish writing the tori shogi AI.

This piece of the shogi AI should look fairly elegant when I’m done writing it, but I’ll have to write quite a few tests to make sure I get it right. I should have the library working some time later today.

Wish me luck on my tori shogi AI!

Leave a Reply

Your email address will not be published. Required fields are marked *