Shogun Board Game in QB64
.bas   Shogun.bas (Size: 16.45 KB / Downloads: 16)
Hello all,

Shogun is a 2 player board game. Each player has 7 pawns and 1 king piece. The object of the game is to either (1) capture your opponent's king or (2) capture 6 of your opponent's pawns. Pieces are captured by landing on them, like in chess. The pieces has a rotating disc inside with numbers from 1 to 4 on it. A window at the top of the piece reveals 1 of the digits on the disc. This number represents how many spaces that piece moves on that turn. There is a magnet located on the disc inside the piece and each positions on the board has a magnet in different locations. As the pieces move to different locations, the disc rotates an reveals a new number for that location. A piece can make 1 turn during it's move. There is a button at the bottom of the right hand side that allows the players to display the possible moves. This can be toggled on and off. When a player selects a piece, a white cursor surrounds that piece. If the player wishes to choose a different piece, they can select the same and the piece will be deselected. When the show moves is selected, gold cursors surround all then locations a piece can move to

I have included a photo which has a copy of the rules on it.

Hope you enjoy playing.

saturates the cpu.
got to put a sleep 1 or qb64 equivalent in the loop.
Very interesting! Board has nice look. Game... I wonder what an AI would be like because I can't think what would work as strategy, course at moment I can barely keep my eyes open...

Thank you Donald!
B += x

Thanks both of for trying out the game. I added a SLEEP 1 inside the loop and it locks the game up, you can't select any pieces. I don't know what will help the problem, but thanks for the input.

Hi Donald,

Yeah, I tried _Limit 10 in all the mouse loops, 3 places, and that also stopped responding to mouse clicks.
I am not sure those loops are "real" or just a psuedo loop to get mouse events.

I confess with all the gosub's it's hard to tell where the main loop is.

While it's true a program should not hog the CPU, it's not so bad if a person is supposed to be only focused on the game and not multi-tasking which it just so happens Windows has been optimized for doing. I wonder about all these people who wince whenever the CPU gets used. Seems to me a proper OS would not allow a CPU to burn out as part of it's job.
B += x
Not having played this game before, I had to rely on the 'instructions', which were - for me anyway - easy to follow... lol

The game played very well. No problems with the mouse or delay issues. I wondered if the 'numbers' on each piece were fixed or not. After a few moves it became obvious. Very clever game. But the game was too easy. I had no problem winning... mind you, I knew 'every' move my opponent planned to make, so a winning strategy was relatively easy to formulate... Perhaps it would not be so easy if the player was to compete against an AI... and NOT oneself... lol

Nicely done...

May your journey be free of incident.

Live long and prosper.

The main loop starts at label StartGame: and runs to just after comment ' Check for Winner. The 2 DO loops do check for mouse events. The game is intended to be played by 2 players sharing the same computer and alternating taking turns. 

The interesting thing about this game is that after you move your piece, the value on the piece may change, which gives that piece a different set locations to attack. It's almost like playing knight in chess and once the piece lands on it's new location, it becomes a bishop or a pawn.

The numbers that appear on the numbers are no random. The board can be rotated to any of the 4 sides when playing the game in real life. So I have the game choose a random board rotation. Next I have the computer choose a random location for the kings based on actual choices in the real game where to set up the kings. Each pawn and their patterns are numbered and randomly setup on each back row. I already have the position on each magnet in each location on the board for all 4 rotations. You'll find that info at the beginning of the code stored in strings as well as all the positions of the magnets in all of the pieces. So if you were to play the actual game, the numbers on the pieces would be exactly the same as on the computer during game play.

Thanks for trying my game and for the response.

By the way, to all readers: I have made some changes to the game like using the extra space on the right side to store the captured pieces. That version is found here.


Attached Files .bas   Shogun.bas (Size: 16.69 KB / Downloads: 8)