Hi! This is my second project using Julia. I made a minishogi engine using bitboards. You can play at bitshogi.com It’s a chess-like game. You play as white.
There is code, rules, and bot information on different kinds of bots to play against. You can play against a basic minimax algorithm, greedy, random, and even Claude and see its reasoning behind its choice.
The pieces are designed so you can infer how they move from the way they are shaped. Building the engine was the fun part and designing the website reminded me why I don’t like designing websites so I had Claude do it.
Each day has a different board setup or you can play the classic version of minishogi. You can also input your own SFEN board setup. ex. “r1k1r/pspsp/5/PSPSP/R1K1R w - 1”(board setup, white’s turn first, nothing in your hand, turn 1)
Here’s what it looks like:
I’d love to get any feedback at all!
23 Likes
Hi.. it’s surely very impressive !
Can you share a bit how you integrated/orchestrated the whole thing?
What happens when the user moves a piece? How do you handle multiple simultaneous users ?
Is the Julia code precompiled in a custom image ? Does it remain listening in the background?
1 Like
Wow! I didn’t even know you could do stuff like this with Julia. I am also very curious how this was built.
1 Like
Very cool! I think a large majority of the people here would love to write the engine in Julia and have an easier way to build a GUI (Claude etc.)
This reminded me of an effort from the very early days of Julia, which is where I first learnt about Shogi: GitHub - scc23/shogi: Shogi (Japanese chess game) written in Julia. With GUI, multiple variants and AI difficulties, and networking.
1 Like
I didn’t know this existed! Thanks for sharing, super cool.
Hi! I learned a lot about bitboards and Julia while building this. When a user moves a piece, the new board state is sent to a custom image hosted on Railwayapp as a string like “rbsgk/4p/5/P4/KGSBR w - 1”. From this a list of all legal moves are generated. For example a classic minishogi 5x5 board state with the 6 pieces per color can be represented with 12 UInt32 bitboards. Each number has a single flipped bit that encodes the position of each piece.
And by making some more bitboards, we can have a UInt32 number represent all black pieces, another one for all white pieces, one that encodes the positions each pawn can attack, if you are in check/checkmate… and so on. Then we can build a little list of all legal moves you/or the bot can make.
The app is split between HTTP.jl with a docker image hosted on Railway and using Vercel for the frontend. Each request to Railway has the full board state and pieces captured so it can be stateless. So independent requests can be made with no shared game state on Railway. With the free tier on railway I think it stops listening after 15min of inactivity but starts up again at the next request.
Please tell me if you can beat the minimax bot! I could beat it when it was calculating 4 moves ahead, but its set to 5 now and I haven’t beaten it ha. The claude bot gets confused a lot.
2 Likes
Hi, thanks! I replied with a short explanation down below but I think over the next couple weeks I’ll add another page on the website with a more in depth explanation of how the game engine works. In a similar style to the bots and rules page.
Very cool, thank you for sharing this.
designing the website reminded me why I don’t like designing websites so I had Claude do it.
Relatable 
A few pieces of feedback on the website:
- It would be nice to have an “Enable tooltips” checkbox so that people new to this can hover over a piece (friendly or enemy) and get a tooltip of what piece it is.
- Similarly, as a beginner, it would be nice to be able to click on an enemy piece and see what moves it can make, perhaps shown in red rather than the green used for our own possible moves.
- It seems like state isn’t maintained about the game i.e. if I click on Rules to check something and get back to the main page, the game is reset to the start and any moves made so far are undone.
- A subjective one: the board elements (circles and connecting lines) are too prominent and make the pieces not stand out so much; the whole board looks pretty busy because of that. Changing the dot colors to
#767676 and the line color to rgba(255, 255, 255, .2) (instead of 0.3 alpha) brings the pieces to better focus IMO.
(Railway looks pretty neat btw, thank you for mentioning it.)
2 Likes