Game of the Generals

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
Ferdy
Posts: 3645
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Game of the Generals

Post by Ferdy » Fri Apr 17, 2015 7:11 am

We have a board game here called Salpakan or game of the generals. HGM is this not difficult to implement in winboard? I would like to create such engine to play this game. This is a close piece type, at the start you don't know the rank (military) of the pieces, you need to challenge the opponent pieces, say his captain vs my major (both don't know the piece type initially, this is trial and error strategy), here I win so captain piece is removed from the board. But now I have to be careful because my opponent will remember my piece that defeat his captain, but he does not know exactly what rank my piece has defeated him, it can be a major, colonel, 1 star general and above. He can certainly challenge that piece with his spy for example, because a spy can defeat a sergeant up to 5 star general and flag except a private, where a spy is defeated.

Played on board with size 8 ranks and 9 files with pieces and functions.

Code: Select all

Pieces	No. of Pieces	Function
General of the Army (Five Stars)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
General (Four Stars)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Lieutenant General (Three Stars)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Major General (Two Stars)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Brigadier General (One Star)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Colonel (Three Magdalo 7-Ray Suns)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Lieutenant Colonel (Two Magdalo 7-Ray Suns)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Major (One Magdalo 7-Ray Sun)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
Captain (Three Magdalo Triangles)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
1st Lieutenant (Two Magdalo Triangles)	1	Eliminates any lower-ranking officer, the Private, and the Flag.
2nd Lieutenant (One Magdalo Triangle)	1	Eliminates the Sergeant, the Private, and the Flag.
Sergeant (Three Chevrons)	1	Eliminates the Private, and the Flag.
Private (One Chevron)	6	Eliminates the Spy, and the Flag.
Spy (Two Prying Eyes)	2	Eliminates all officers from the rank of Sergeant up to 5-Star General and the Flag.
Flag (Philippine Flag)	1	Eliminates the opposing Flag as long as it takes the aggressive action against the enemy Flag..
Image

Link:
http://en.wikipedia.org/wiki/Game_of_the_Generals

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Game of the Generals

Post by hgm » Fri Apr 17, 2015 7:40 am

The WinBoard Alien Edition should be able to do this as variant alien, at least in human-engine games. There the engine can send a setup command to the GUI after every move, to update the board position.

This assumes the engine would both be arbiter and player, however.

If WinBoard should be the arbiter it would require addition of a new variant that implements the capture rules, and takes care of setting up the initial position. This would probably require special handling in a lot of places. (E.g. notation, for loading and saving games. In the FEN included in a PGN you probably would want all pieces to be distinguishable, or you could not continue playing an adjourned game. In setboard commands to the engine you would robably want the FEN to just mark the occupied squares.)

Ferdy
Posts: 3645
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Game of the Generals

Post by Ferdy » Fri Apr 17, 2015 8:03 am

hgm wrote:The WinBoard Alien Edition should be able to do this as variant alien, at least in human-engine games. There the engine can send a setup command to the GUI after every move, to update the board position.

This assumes the engine would both be arbiter and player, however.

If WinBoard should be the arbiter it would require addition of a new variant that implements the capture rules, and takes care of setting up the initial position. This would probably require special handling in a lot of places. (E.g. notation, for loading and saving games. In the FEN included in a PGN you probably would want all pieces to be distinguishable, or you could not continue playing an adjourned game. In setboard commands to the engine you would robably want the FEN to just mark the occupied squares.)
This game requires a referee and should knew the victor whenever challenges occur. Just forget about it.

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Game of the Generals

Post by hgm » Fri Apr 17, 2015 8:38 am

Well, for human-engine the engine could double as referee. You would just have to trust that it doesn't cheat. But the AI could play entirely without knowledge of what the pieces are (other than what it can extract from the game history, in particular what managed to capture what). And when it attempts a capture at game level, you could invoke a referee routine to deside the victor, and update the engine's internal board accordingly (and send it to the GUI as a setup command).

The only problem is that you could not play engines against each other that way. This would require their referees to be in sync. Although this could be possible by using the normal setup mechanism for shuffle games, the referee part of the 1st engine sending a randomized position to the GUI, which would relay it in a setboard to the other engine. Which then should only use that information in its referee part.

To prevent cheating you could implement the referee parts as adapters. These should use the setboard commands only for themselves, and not pass it on to the AI part of the engine. (Or only in disguised form, representing each piece by the same ID.) And on receiving a move from the GUI they should decide the capture outcome, and reply with a setup command for the resulting position, while adapting the move sent to the engine so that it will be obvious who won the battle. (E.g. converting it to a multi-leg move via the captured enemy if it won, or making it promote to empty square if it lost.) And when the engine sent a move, it would need a reply from the adapter to tell the outcome. This way all engines for the game could use the same referee adapter, making cheating impossible.

Ferdy
Posts: 3645
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Game of the Generals

Post by Ferdy » Fri Apr 17, 2015 11:35 am

hgm wrote:Well, for human-engine the engine could double as referee.
In this game, each player is free to arrange his own pieces. So the occupied squares may not be the same for both sides.

User avatar
hgm
Posts: 22911
Joined: Fri Mar 10, 2006 9:06 am
Location: Amsterdam
Full name: H G Muller
Contact:

Re: Game of the Generals

Post by hgm » Fri Apr 17, 2015 1:43 pm

Ah, OK, I missed that. So it is a lot like the game of Stratego.

I guess games like that could be played like Sittuyin, starting with an empty board, and letting each player drop the piece on it before they can start moving them. The referee part of the engine should then strip off the piece type from the drop move the GUI sends it, before relaying it to the AI part. But at least the engines could each make their own initial setup clear to the GUI that way. (While with a 'setup' command the first engine would decide for both.)

The Wikipedia description is very unclear. Does this game have replacement capture, like Chess (except that it is not clear in advance whether the attacker will actually replace the original occupant, or just disappear)? Or is it enough to step next to a piece to challenge it?

I could add a variant in WinBoard with such 'conditional replacement capture', where the victim survives at the expense of the attacker when it is higher in rank. The GUI could send an 'infoboard' command in reply to eny engine 'move' command, to let the engine know the result of the challenge. This 'infoboard' command is already part of the Alien protocol. In the move notation there should be a suffix to captures specifying whether attacker or attacked survive the capture.

Ferdy
Posts: 3645
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Game of the Generals

Post by Ferdy » Fri Apr 17, 2015 2:48 pm

hgm wrote:Ah, OK, I missed that. So it is a lot like the game of Stratego.

I guess games like that could be played like Sittuyin, starting with an empty board, and letting each player drop the piece on it before they can start moving them.
Something like that, the player will drop a piece to a location they want.
The Wikipedia description is very unclear. Does this game have replacement capture, like Chess (except that it is not clear in advance whether the attacker will actually replace the original occupant, or just disappear)? Or is it enough to step next to a piece to challenge it?
It is like a capture, but only the lower rank piece is removed and will be returned to the owner. The victor of the challenge or capture is not informed of what piece he defeated, likewise the loser is not informed of what piece type defeated his piece. If the capturer loses, his piece will be removed. If he wins, the opponent piece is removed, only the referee knows the actual rank of those pieces involved.
I could add a variant in WinBoard with such 'conditional replacement capture', where the victim survives at the expense of the attacker when it is higher in rank.
That is a correct condition.
The GUI could send an 'infoboard' command in reply to eny engine 'move' command, to let the engine know the result of the challenge.
That is indeed a correct sequence, after a challenge, both engines will be informed of the result.
This 'infoboard' command is already part of the Alien protocol. In the move notation there should be a suffix to captures specifying whether attacker or attacked survive the capture.
I am not familiar with alien protocol, but that will work.

Ferdy
Posts: 3645
Joined: Sun Aug 10, 2008 1:15 pm
Location: Philippines

Re: Game of the Generals

Post by Ferdy » Fri Apr 17, 2015 3:16 pm

There are move perpetual rules here.

http://www.webcitation.org/query?url=ht ... 5+22:28:09

Post Reply