No, 10 to 100 times less posts since the chess GUI developers have less time for posting.Henk wrote:So in principle there should be 10 to 100 times more posts about chess GUI development.hgm wrote:Beware that writing a GUI is between 10 and 100 times more work than writing an engine.
In XBoard the games is stored as an array of positions. I added variation trees only later, by shelving the game tail in a similar array operated as a stack, any time you replace it with a variation. So that you can revert easily to the main line/previous variation by popping it.
Object model for chess GUI?
Moderator: Ras
-
- Posts: 4052
- Joined: Thu May 15, 2008 9:57 pm
- Location: Berlin, Germany
- Full name: Sven Schüle
Re: Object model for chess GUI?
-
- Posts: 7251
- Joined: Mon May 27, 2013 10:31 am
Re: Object model for chess GUI?
Perhaps mathematicians don't like GUI development. Also GUI has to look nice. And that's a matter of taste.Sven Schüle wrote:No, 10 to 100 times less posts since the chess GUI developers have less time for posting.Henk wrote:So in principle there should be 10 to 100 times more posts about chess GUI development.hgm wrote:Beware that writing a GUI is between 10 and 100 times more work than writing an engine.
In XBoard the games is stored as an array of positions. I added variation trees only later, by shelving the game tail in a similar array operated as a stack, any time you replace it with a variation. So that you can revert easily to the main line/previous variation by popping it.
-
- Posts: 389
- Joined: Wed Sep 26, 2012 1:29 pm
- Location: Hungary
Re: Object model for chess GUI?
I'v started as physicist (1year) but finished as mathematician (5 year)Henk wrote:Perhaps mathematicians don't like GUI development. Also GUI has to look nice. And that's a matter of taste.Sven Schüle wrote:No, 10 to 100 times less posts since the chess GUI developers have less time for posting.Henk wrote:So in principle there should be 10 to 100 times more posts about chess GUI development.hgm wrote:Beware that writing a GUI is between 10 and 100 times more work than writing an engine.
In XBoard the games is stored as an array of positions. I added variation trees only later, by shelving the game tail in a similar array operated as a stack, any time you replace it with a variation. So that you can revert easily to the main line/previous variation by popping it.

-
- Posts: 1262
- Joined: Wed Mar 08, 2006 8:28 pm
- Location: Florida, USA
Re: Object model for chess GUI?
Hi H.G.
Yes - I can believe it. But I think it'll be fun,
- Steve
Yes - I can believe it. But I think it'll be fun,
- Steve
http://www.chessprogramming.net - Maverick Chess Engine
-
- Posts: 1262
- Joined: Wed Mar 08, 2006 8:28 pm
- Location: Florida, USA
Re: Object model for chess GUI?
Thanks Sven,
That's helpful. I think the Arbitrator will only hold a basic representation of the position, along with clock times etc.
Thanks - Steve
That's helpful. I think the Arbitrator will only hold a basic representation of the position, along with clock times etc.
Thanks - Steve
http://www.chessprogramming.net - Maverick Chess Engine
-
- Posts: 686
- Joined: Thu Mar 03, 2011 4:57 pm
- Location: Germany
Re: Object model for chess GUI?
Hi Steve,
just as a source of inspiartion I post the declaration of my TGame class from my shaker GUI. This class controls the game between two engines.
The engines are from a class TEngine which is an interface class to an external engine. Of course the class needs a board, where the moves are executed so it keeps track of the progress. Then there are a lot of helper classes needed, e.g. to write a PGN file or to control the clock etc...
just as a source of inspiartion I post the declaration of my TGame class from my shaker GUI. This class controls the game between two engines.
The engines are from a class TEngine which is an interface class to an external engine. Of course the class needs a board, where the moves are executed so it keeps track of the progress. Then there are a lot of helper classes needed, e.g. to write a PGN file or to control the clock etc...
Code: Select all
TGame = class(TThread)
board : TBoard;
constructor Create(aEvent, aSite, aRound : String; aWhite, aBlack : TEngine; aClock : TChessClock; aAdjudicationRules : TAdjudicationRules; opPGN : TPGN; opMaxMoves : Integer);
destructor Free; virtual;
procedure StartGame;
procedure cancelGame;
procedure cancelGame(winFor : EColor);
function getGameStatus:EGAME_STATUS;
function createPGN:TPGN;
procedure savePGN(aFileName : string; format : EPGNMoveFormat);
procedure getIterations(side : EColor; var iterations : TIterationList);
protected
procedure Execute; override;
private
pgnCS : TCriticalSection;
debug : Boolean;
canceled : Boolean;
pgn : TPGN;
engines : Array[WHITE..BLACK] of TEngine;
gameStatus : EGAME_STATUS;
engineStatus : Array[WHITE..BLACK] of EENGINE_STATUS;
event, site : String;
round : String;
clock : TChessClock;
adjudicationRules : TAdjudicationRules;
openingMoves : TMoveList;
end;
-
- Posts: 1262
- Joined: Wed Mar 08, 2006 8:28 pm
- Location: Florida, USA
Re: Object model for chess GUI?
Thanks Thomas - this is also helpful.
Why does TGame need to be a separate thread? Is this just for engine communications?
Cheers - Steve
Why does TGame need to be a separate thread? Is this just for engine communications?
Cheers - Steve
http://www.chessprogramming.net - Maverick Chess Engine
-
- Posts: 686
- Joined: Thu Mar 03, 2011 4:57 pm
- Location: Germany
Re: Object model for chess GUI?
It doesn't have to, but for me it was the easiest way to keep the GUI responsive while a game is running eg. to allow the user to cancel it.Why does TGame need to be a separate thread? Is this just for engine communications?
Thomas...
-
- Posts: 28321
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: Object model for chess GUI?
In any case, make as few assumptions on the game as possible, e.g. avoid hard-coding the number of board files and ranks when using them in tests and loops, and avoid assuming the board is square. It doesn't take any extra effort to keep it general, but it would b a hell of a job to change anything if it was not set up in a general way.
-
- Posts: 411
- Joined: Thu Dec 30, 2010 4:48 am
Re: Object model for chess GUI?
to me it'd make sense to have the 'game' object modeled to parallel the features of pgn since writing/reading pgn is something you'll want eventually (and is even a good first function to write of the gui possibly (after of course a visible board)). After that i'd want a navigation object for said game object that allows one to move around the game tree to query information about the current position of the game tree as well as adding/deleting moves/subvariations - probably the simplest structure for it is for it to have a board and a pointer/offset to the location in your game object that the position on that board represents. the arbiter can then simply use said navigation object as the interface to run the game from and after it's over your game object can dump it into a pgn file for you.