ChessV 2.0 - open source GUI and engine for chess variants

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

ChessV 2.0 - open source GUI and engine for chess variants

Post by Greg Strong »

After many years, ChessV is back with a new version, completely rewritten from scratch!

Image

Version 2 has many improvements over previous versions, including:
  • A vastly improved user interface with better graphics and more features
  • In addition to providing an AI you can play against, ChessV 2 can also be used as a GUI to control other engines that support XBoard protocol version 2
  • The program is now a .NET Framework application, written in C#, allowing better cross-platform support. It can run on non-Windows operating systems, such as Linux, using Mono
  • ChessV 2 is far more universal, allowing support for many more types of games. Here are some of the features with examples of games that are now supported:
  • A scripting language, providing limited support for defining custom variants without needing to recompile ChessV itself. This feature is in early development and subject to change. For examples, look in the Include directory.
The trade-off for all these improvements is that the internal engine is not as fast as original ChessV and the playing strength is somewhat weaker.
For really deep analysis, use of the old version, for games that it supports, may still be preferable. Fortunately, there are now more XBoard-compliant engines that support chess variants and can be controlled with ChessV. The Windows installer distribution includes Fairy-Max.

Please see the ChessV website to download the program and/or source code. Feedback is always welcome. Enjoy :D
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Ferdy »

Looks great, windows installation works fine under Windows 7. I am playing around the makruk game. I think Chess V does not support it.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Ferdy »

I experimented with makruk script.

Code: Select all

Game 'Makruk' : Chess
{
	Invented = "700";
	InventedBy = "Thais";
	
	AddPieceTypes
	{
		Queen.Enabled = false;
		Bishop.Enabled = false;
		AddPieceType( SilverGeneral, "Khon", "S", 260, 260 );
		AddPieceType( Ferz, "Met", "M", 150, 150 );
	}

	SetGameVariables
	{
		Array = "rnsmksnr/8/pppppppp/8/8/PPPPPPPP/8/RNSKMSNR";
		PromotionTypes = "MMMM";
	}
}
And I get this box.

Image

How to define a piece that moves like a silver general in shogi?
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Greg Strong »

Wow! That took almost no time for someone to jump in and add a new variant :lol: You're almost there - just change:

Code: Select all

AddPieceType( SilverGeneral, "Khon", "S", 260, 260 );
To:

Code: Select all

AddPieceType( 'Silver General', "Khon", "S", 260, 260 );
And in PromotionTypes, you probably only want to list the M once (although there may be no harm in listing it multiple times.)

Incidentally, the only reason Makruk isn't implemented already is because I haven't had time yet to implement the complex endgame move-count rules. I make it a point not to officially announce support for a game until it is 100%. Similarly, Xiangqi isn't available only because I haven't yet implemented the super-complex rules surrounding repetitions. But both games will be built-in in the near future.

Thanks for your interest!
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Ferdy »

Greg Strong wrote:Wow! That took almost no time for someone to jump in and add a new variant :lol: You're almost there - just change:

Code: Select all

AddPieceType( SilverGeneral, "Khon", "S", 260, 260 );
To:

Code: Select all

AddPieceType( 'Silver General', "Khon", "S", 260, 260 );
And in PromotionTypes, you probably only want to list the M once (although there may be no harm in listing it multiple times.)

Incidentally, the only reason Makruk isn't implemented already is because I haven't had time yet to implement the complex endgame move-count rules. I make it a point not to officially announce support for a game until it is 100%. Similarly, Xiangqi isn't available only because I haven't yet implemented the super-complex rules surrounding repetitions. But both games will be built-in in the near future.

Thanks for your interest!
That 'Silver General' works :).

That counting rule is indeed nasty. Perhaps just implement it without counting rule as most engines does not have it. Then later implement it gradually, perhaps start at - when no pawns left start the 64-move draw variable counting.

How to define to disable castling moves?
Also how to define that the promotion rank is only at the 6th rank?
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Greg Strong »

To disable castling, just add this line to the SetGameVariables handler:

Code: Select all

Castling.Value = "None";
Promotion on the 6th rank is more difficult. The script language is really young and does not directly allow what you want. BUT you can get mostly what you want, but only by luck :) Trick is, instead of deriving your game from Chess, derive it from 'Mecklenbeck Chess'.

Code: Select all

Game 'Makruk' : 'Mecklenbeck Chess'
This game has optional promotion at the 6th rank and mandatory at the 8th. This isn't exactly what you want since you would like mandatory promotion on the 6th, but really, the engine will want to promote as soon as it can, so this probably doesn't make much difference.

I should also mention a little more about the quotes - SilverGeneral vs. 'Silver General' and single quotes vs. double quotes. Text in double quotes is a string constant, as in any programming language. Text in single quotes are actual identifiers. You need not use the quotes if there are no spaces or otherwise illegal characters. But it allows spaces and other characters right inside actual language identifiers if you put them in single quotes. This probably seems strange from the perspective of a normal programming language. But this language is very specific to the task of defining pieces and games. The game of Omega Chess, for example, should always be displayed as "Omega Chess". But if you couldn't have spaces, you'd have to refer to it in code with a different name, like OmegaChess, and then we would need a facility to specify what the "real name" is for every piece and/or game. I decided instead to have only one name, the identifier, and the identifier is the "real name". Omega Chess is 'Omega Chess' and the Silver General is 'Silver General'.
Ferdy
Posts: 4833
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Ferdy »

Greg Strong wrote:To disable castling, just add this line to the SetGameVariables handler:

Code: Select all

Castling.Value = "None";
Promotion on the 6th rank is more difficult. The script language is really young and does not directly allow what you want. BUT you can get mostly what you want, but only by luck :) Trick is, instead of deriving your game from Chess, derive it from 'Mecklenbeck Chess'.

Code: Select all

Game 'Makruk' : 'Mecklenbeck Chess'
This game has optional promotion at the 6th rank and mandatory at the 8th. This isn't exactly what you want since you would like mandatory promotion on the 6th, but really, the engine will want to promote as soon as it can, so this probably doesn't make much difference.

I should also mention a little more about the quotes - SilverGeneral vs. 'Silver General' and single quotes vs. double quotes. Text in double quotes is a string constant, as in any programming language. Text in single quotes are actual identifiers. You need not use the quotes if there are no spaces or otherwise illegal characters. But it allows spaces and other characters right inside actual language identifiers if you put them in single quotes. This probably seems strange from the perspective of a normal programming language. But this language is very specific to the task of defining pieces and games. The game of Omega Chess, for example, should always be displayed as "Omega Chess". But if you couldn't have spaces, you'd have to refer to it in code with a different name, like OmegaChess, and then we would need a facility to specify what the "real name" is for every piece and/or game. I decided instead to have only one name, the identifier, and the identifier is the "real name". Omega Chess is 'Omega Chess' and the Silver General is 'Silver General'.
This one works.
Castling.Value = "None";
and this
'Mecklenbeck Chess'
After reaching the 6th rank there was a box that offer to promote or not to promote.

The engine works fine it plays good vs Fairy-Max.

I encountered an error later (triggered after moving Re2 to Re1). I do the test manually, Fairy-Max on Winboard.

Image

Output from winboard.

Code: Select all

[Event "?"]
[Site "?"]
[Date "2017.03.19"]
[Round "-"]
[White "Fairy-Max 5.0b"]
[Black "Chess V2.0"]
[Result "*"]
[TimeControl "60+1"]
[Variant "makruk"]
[Annotator "2. +0.07"]

1. f4 c5 2. Nd2 {+0.07/6 0.1} d5 3. Ngf3 {+0.10/6} Nc6 4. c4 {+0.01/6} Sd7
5. Sc2 {-0.02/6} Nge7 6. Mf2 {+0.02/6 0.2} Rc8 7. Se2 {+0.05/5} h5 8. e4
{+0.01/6 0.2} Sd6 9. Me3 {+0.03/6} d4 10. Mf2 {-0.15/7} e5 11. b4 {-0.06/7}
Rh6 12. b5 {-0.09/6} axb5 13. cxb5 {-0.01/7} Na5 14. Sb3 {-0.07/7 0.1} Mc7
15. Sc4 {-0.06/6} Sf7 16. Rc1 {-0.08/7 0.1} exf4 17. gxf4 {-0.08/7} h4 18.
Rg1 {+0.04/6} f5 19. Ng5 {-0.02/6 0.1} Rd8 20. e5 {+1.11/8} Sd5 21. Sxd5
{+0.52/8} Nxd5 22. e6=M {+0.45/8} Sxe6 23. Nxe6 {+0.56/8 0.1} Rd6 24. Ng5
{+0.53/8} Rh5 25. Sf3 {+0.71/6} Nc3+ 26. Kc2 {+0.62/6} Nxb5 27. Rce1+
{+1.00/7} Kd7 28. Nf7 {+0.98/8} Rf6 29. Ne5+ {+1.02/8} Kd8 30. a4 {+0.62/8}
Nc3 31. Rxg6 {+0.69/7} Rxg6 32. Nxg6 {+0.73/7} Nc6 33. Ne5 {+1.48/6} Nb4+
34. Kb3 {+1.39/6} Md6 35. Nf7+ {+0.87/7} Kd7 36. Se2 {+0.84/7} Nxe2 37.
Rxe2 {-0.02/8} Nxd3 38. Re1 {-0.31/8}
*
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Greg Strong »

Wow. You have not only configured ChessV to play Makruk, but you've also got it controlling Fairy-max to play a game that is not even built in. Thank you for testing this out. Although you've encountered a crash, this is very encouraging.

It's late here, and I have been drinking :D So I am not sure what is going on. I will look further into this tomorrow. It would help, however, if you told me the line of the error. Your screen-shot does not show me the line number of the error because it is to the right. To be most helpful, if the "Inner Exception" button is active, click that, maybe more than once. Then scroll to the right to see the line number of the error.

Probably I should add a button 'Export' that saves all the information when the Crash dialog box comes up. Then you could send me the file with all the information.
User avatar
Greg Strong
Posts: 388
Joined: Sun Dec 21, 2008 6:57 pm
Location: Washington, DC

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by Greg Strong »

Wait a minute - I'm confused. How do you have output from Winboard if you were using ChessV 2.0? How can you use two different GUIs at once?

EDIT: Ok, I see. You were running the two GUIs separately, and manually entering the moves from one to the other. Thank you, this is helpful. Winboard's output should help me determine what has gone wrong here.
User avatar
hgm
Posts: 27787
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: ChessV 2.0 - open source GUI and engine for chess varian

Post by hgm »

Congratulations!

Is the AI also a WB v2 engine, or is it built in like in the old ChessV?

I see you support multiple moves per turn. Can this also be controlled on a per-piece basis, so that you could handle the Chu-Shogi Lion?

If so, can you handle Chu Shogi, or does that fall outside the parameter limits for board size and/or number of piece types? (And can you handle promotion of more than one piece type in the first place?)

If Chu Shogi is too big, Mighty-Lion Chess and Elven Chess should be no problem, size-wise (if a Lion works). These also have no piece promotions.

(I don't dare to ask about Tenjiku Shogi :wink: )

Makruk counting rules should not be so difficult to implement when you implement the reversible-ply counter as a count-down. Then you can always declare draw when it reaches 0. Just when you reset it on a capture you would not always reset it to 100, like in Chess, but to a number that depends on the material present. (And then only if that makes it lower than the value it already has.)

For engines it is not really important to do the counting, as long as they are aware which end-games are made drawish by their move limit.