Can engines set up positions

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Can engines set up positions

Postby BrettVsop » 06 Nov 2007, 05:25

I am writing a chess engine for Winboard and I want the engine to be able to set up positions. I understand that Winboard wasn't written for this purpose, but I doubt I am the only one who has considered this. Is there a way to do this, or has anyone modified the code to give Winboard this functionality?

The reason I would like to do this is simple. I want to be able to test students on positions. Set up a mate in one, once they make the correct move the engine sets up another random position.

If Winboard cannot do this is there a similar program that can? Winboard is such a nice interface and I would not like to write my own.

Thanks
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby Pradu » 06 Nov 2007, 09:12

BrettVsop wrote:I am writing a chess engine for Winboard and I want the engine to be able to set up positions. I understand that Winboard wasn't written for this purpose, but I doubt I am the only one who has considered this. Is there a way to do this, or has anyone modified the code to give Winboard this functionality?

The reason I would like to do this is simple. I want to be able to test students on positions. Set up a mate in one, once they make the correct move the engine sets up another random position.

If Winboard cannot do this is there a similar program that can? Winboard is such a nice interface and I would not like to write my own.

Thanks
An engine cannot do this, but it is possible to make an application that generates positions and sends them to Winboard at startup.
User avatar
Pradu
 
Posts: 343
Joined: 12 Jan 2005, 19:17
Location: Chandler, Arizona, USA

Re: Can engines set up positions

Postby BrettVsop » 06 Nov 2007, 09:20

If I were to do that though the student would have to close and reopen the dialog box after every puzzle. That doesn't sound like it would work very well.

I am considering opening up Winboards source code and doing a little hacking. It seems like all I really need to do is add a few lines of code at the right spot. If I were to give the engine a command it can send called 'set up position'. I was really hoping someone did this already though.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby H.G.Muller » 06 Nov 2007, 09:41

I am not sure what your objection is. If you click a PGN file it automatically starts WinBoard with an extra 'game list' window, which stays open all the time, and where you can see a directory listing of all the games in the file. Just click on a game and it will load that game. Games are allowed to begin with a setup position, so you could put games of zero moves starting with the problem position in there. This all seems very convenient and user friendly. Your students could do the problems in any order they want, and switch back to those they already did before.

If you are going to change the code, keep in mind that I am just about to relase a version that is so heavily changed, that any derivatives you make from older sources will be dead branches from the start.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Can engines set up positions

Postby Uri Blass » 06 Nov 2007, 10:46

H.G.Muller wrote:I am not sure what your objection is. If you click a PGN file it automatically starts WinBoard with an extra 'game list' window, which stays open all the time, and where you can see a directory listing of all the games in the file. Just click on a game and it will load that game. Games are allowed to begin with a setup position, so you could put games of zero moves starting with the problem position in there. This all seems very convenient and user friendly. Your students could do the problems in any order they want, and switch back to those they already did before.

If you are going to change the code, keep in mind that I am just about to relase a version that is so heavily changed, that any derivatives you make from older sources will be dead branches from the start.


I think his objection is clear.

He want to have a program that teach humans to play chess and use winboard as an interface without writing a new interface and without caring about graphic.

I think that this is a good idea and here are some more ideas of what can be done if people only write the relavent code:

The program can show the human chess problems and can decide about the next problem based on the response of the human.

I can think about a program that work in console mode and give the human instructions what to do when the human can do the instructions using the winboard interface.

The human may see in the console mode something like
You are going to have problems of mate in 1.
You need to make the move in the winboard interface.

If the solution is wrong then you are going to get the same position again.
If the solution is right then you are going to see a new position.

The human can see in the console mode also different instructions.

Click on the pieces that are pinned to the white king and after finish clicking on these pieces click on the white king if you do it correctly you are going to get a different position.

If you have a mistake you will try again and if you want to see the solution you can click on the black king.

In that case winboard should be able to tell the engine the square that the user click on it and should be able to show specific squares that the engine ask it to show.

Uri
User avatar
Uri Blass
 
Posts: 727
Joined: 09 Oct 2004, 05:59
Location: Tel-Aviv

Re: Can engines set up positions

Postby BrettVsop » 06 Nov 2007, 17:29

H.G.Muller wrote:I am not sure what your objection is. If you click a PGN file it automatically starts WinBoard with an extra 'game list' window, which stays open all the time, and where you can see a directory listing of all the games in the file. Just click on a game and it will load that game. Games are allowed to begin with a setup position, so you could put games of zero moves starting with the problem position in there. This all seems very convenient and user friendly. Your students could do the problems in any order they want, and switch back to those they already did before.

If you are going to change the code, keep in mind that I am just about to relase a version that is so heavily changed, that any derivatives you make from older sources will be dead branches from the start.


I'm teaching 5 and 10 year olds and I am teaching between ten to thirty at a time.

I would really like to be able to drop them in front of the computer and not have to explain much or have to worry about them for ten or fifteen minutes. The more they can do on the computer without my help the more time I can spend with other kids.

Your idea could work, but I just see myself having alot to explain and alot of supervision. Maybe they will need to know why their move doesn't work, or they accidentally closed the game list and need me to reopen it for them. But mostly I see them staring at the screen having no idea what to do, even though I explained it to them twice.

If instead I could load up a testing engine (that I wrote), then the whole process could be alot more interactive. It loads up a position and they make a move. The engine shows why the mate isn't mate by escaping mate, waits five seconds and resets the puzzle. After several wrong answers it skips to the next puzzle. If they are taking too long I could even pop up hints to help them along. This way will also require me to watch them a little, but probably alot less. Also they will be able to go through alot more puzzles alot quicker.

I also think it would be alot more effective if the engine could randomly choose them rather then the student trying to remember where he left off last week. Also for the positions with multiple variations, this could handle moves not expected. Also maybe we want to make sure they are prepared to handle all of the variations. If it is a mate in three, after they get it right, take back a few moves and make sure they can mate if the opponent chooses another move instead.

I could see this ability being very useful to alot of people.

H.G.Muller wrote:If you are going to change the code, keep in mind that I am just about to relase a version that is so heavily changed, that any derivatives you make from older sources will be dead branches from the start.


Winboard seems to work pretty well already. What new features would I be missing?

Is this feature that I am talking about very difficult to implement? I am imagining that it would not take more then a few minutes to add (for someone very familiar with the code). Would you mind putting this in the next version?

I may end up doing this myself, but it would take me a considerable amount more time to do this. I would spend at least a week, probably more, just trying to get familiar enough with your code to know what to change. I would also spend a week just trying to compile it. For some reason my compiler refuses to compile code written in a earlier version of c++. I need to get the exact version or it gives me alot of errors. If you are making a new version anyway maybe you could just toss it in?

Think about the usefulness of this feature. How many people are writing programs that need a chess board besides chess engines. Alot. And if this feature will allow them to use Winboard instead of writing their own you will save that person alot of time.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby BrettVsop » 06 Nov 2007, 17:32

Uri Blass wrote:The human may see in the console mode something like
You are going to have problems of mate in 1.
You need to make the move in the winboard interface.


I think we could do even better then that. I haven't tried these commands yet, but it sounds like we could use them instead of communicating through the console.

tellusererror MESSAGE
xboard pops up an error dialog containing the message. MESSAGE consists of any characters, including whitespace, to the end of the line.

askuser REPTAG MESSAGE
Here REPTAG is a string containing no whitespace, and MESSAGE consists of any characters, including whitespace, to the end of the line. xboard pops up a question dialog that says MESSAGE and has a typein box. If the user types in "bar", xboard sends "REPTAG bar" to the engine. The user can cancel the dialog and send nothing.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby H.G.Muller » 07 Nov 2007, 00:22

BrettVsop wrote:Winboard seems to work pretty well already. What new features would I be missing?

Xiangqi. Shogi. Gothic Chess. Cannons, Nightriders and Grasshoppers. 10x8 board. 12x8 boards. 9x10 board. Piece holdings for drop games like Crazyhouse and Shogi. Automatic adjudication of legal draws in engine-engine games. Verification of engine claims. The list is very long.

I can not answer your question yet, as I am not sure what exactly you want. You want to add a command to the protocol that is the reverse of 'setboard', where the engine sends a FEN to WinBoard? How exactly do you want Winboard to react to this? Like when the user pasted a FEN from the clipboard (through the file menu)? That would indeed be easy, I think.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Can engines set up positions

Postby BrettVsop » 07 Nov 2007, 16:51

H.G.Muller wrote:
BrettVsop wrote:Winboard seems to work pretty well already. What new features would I be missing?

Xiangqi. Shogi. Gothic Chess. Cannons, Nightriders and Grasshoppers. 10x8 board. 12x8 boards. 9x10 board. Piece holdings for drop games like Crazyhouse and Shogi. Automatic adjudication of legal draws in engine-engine games. Verification of engine claims. The list is very long.

I can not answer your question yet, as I am not sure what exactly you want. You want to add a command to the protocol that is the reverse of 'setboard', where the engine sends a FEN to WinBoard? How exactly do you want Winboard to react to this? Like when the user pasted a FEN from the clipboard (through the file menu)? That would indeed be easy, I think.


Yeah if it reacted just like when a user pasted a position that would be great. It would also need to keep the computer settings though. So if it is computer White, it would need to remain that way. This way after the user makes a move, Winboard will send it to the engine for verification.

H.G.Muller wrote:
BrettVsop wrote:Winboard seems to work pretty well already. What new features would I be missing?

Xiangqi. Shogi. Gothic Chess. Cannons, Nightriders and Grasshoppers. 10x8 board. 12x8 boards. 9x10 board. Piece holdings for drop games like Crazyhouse and Shogi. Automatic adjudication of legal draws in engine-engine games. Verification of engine claims. The list is very long.


In this new version we will be able to use a 10x8 board for games other then chess? Gothic Chess, and Shogi, are those similiar games that can be played on a chess board? Basically what you are telling me is Winboard is going to expand from chess to several games that use a chess board or a different dimension chess board?

Verification of engine claims that sounds interesting. But if they are able to verify it, it sounds like the engine will not need to tell Winboard. Will you correct the EnPassant rule so that Winboard only allows you to do EnPassant when it is legal?
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby H.G.Muller » 07 Nov 2007, 19:17

BrettVsop wrote:Yeah if it reacted just like when a user pasted a position that would be great. It would also need to keep the computer settings though. So if it is computer White, it would need to remain that way. This way after the user makes a move, Winboard will send it to the engine for verification.

It is still not completely clear to me. Can you give me a detailed example of the protocol that you want implemented? I understand from your earlier remarks that the communication should happen when Winboard is in engine vs. human mode. But does the engine send the setboard during its own move, that of the opponent, or both? Should the action Winboard takes upon receiving the command depend on who has the move, or not?

If the setboard communicates a FEN, that FEN might change Winboard's idea of who has the move. Should it also automatically switch to the mode where the computer plays the side that does not have the move?

BrettVsop wrote:In this new version we will be able to use a 10x8 board for games other then chess? Gothic Chess, and Shogi, are those similiar games that can be played on a chess board? Basically what you are telling me is Winboard is going to expand from chess to several games that use a chess board or a different dimension chess board?

All these games are Chess: They are played on a board of squares, captures are made by taking the place of the victim, and the game is won by capturing a designated royal piece. They only differ in the rues for moving the pieces. Xiangqi is Chinese Chess, Shogi is Japanese Chess. You wouldn't be able to play games on it that are not Chess (say Checkers / Draughts), as Winboard would not realize that the chips that are jumped over should disappear.
Verification of engine claims that sounds interesting. But if they are able to verify it, it sounds like the engine will not need to tell Winboard. Will you correct the EnPassant rule so that Winboard only allows you to do EnPassant when it is legal?

Indeed, Winboard_F will only accept strictly legal moves, including e.p. and castling. This is essential for claim verification. The current Winboard already does do a mate test, for the purpose of generating the '#' sign in SAN, but it is not reliable because of the e.p. problem you pointed out. So I made Winboard_F fully castling and e.p. aware. And indeed the engine will no longer have to tell it. But this is not the reason to implement it, the reason is that many engines are buggy and claim draws and wins for themselves that are not draws (e.g. too few repetitions) or checkmate. Or refuse to accept the move of their opponent.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Can engines set up positions

Postby BrettVsop » 07 Nov 2007, 22:07

I know what you mean about incorrect claims. I am having fun with that problem atm. A engine I wrote is not working as well as I thought, and it claims a win or a draw incorrectly often.

Ok here is the protocol that I am talking about.

When it is the engines turn to move, he can send the command setboard. It would be followed by an argument containing the fen data.

Once winboard receives the position, it checks to see if it is the computers turn to move. If so, it reverses the color of the computer.

Lets say the computer is white and the player is black. It is the computers turn to move and the computer sends the setboard command.

If on the received fen data, it is whites turn to move: Then Winboard sets the computer to play black and the player to play white.

If on the received fen data, it is blacks turn to move: Then Winboard sets the computer to play white and the player to play black.

It may be beneficial to allow the engine to set the position during the players turn to move as well. Maybe give it the same effect. I am only interested atm on sending the command when it is the computers turn to move though.



Also may I make another suggestion as well. When I am using Winboard and I have set up a position to play where it is my move. After I set it up if I click computer Black. It gives me an error saying it is not blacks move. This is rather annoying. It would be nicer to be able to set the computer's color regardless of whose move it is.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby Dann Corbit » 07 Nov 2007, 23:46

Instead of using Winboard, use Arena.
You can give it a file of EPD positions and it will solve them, and you can watch on the screen as it processes the data.

From Winboard: just execute setboard <fen> and go.

Many Winboard engines have the ability to process a file of EPD records.

You could also make a script that takes EPD/FEN strings and creates games with [Fen tags in it to feed to Winboard. That's probably a lot easier than creating a protocol extension.

By the way, setboard gets a FEN or EPD which includes side to move and so it should not be necessary to change the side to move on your computer after giving your program a setboard command or you have a bug.
Dann Corbit
 

Re: Can engines set up positions

Postby BrettVsop » 08 Nov 2007, 00:20

Dann Corbit wrote:Instead of using Winboard, use Arena.
You can give it a file of EPD positions and it will solve them, and you can watch on the screen as it processes the data.

From Winboard: just execute setboard <fen> and go.

Many Winboard engines have the ability to process a file of EPD records.

You could also make a script that takes EPD/FEN strings and creates games with [Fen tags in it to feed to Winboard. That's probably a lot easier than creating a protocol extension.

By the way, setboard gets a FEN or EPD which includes side to move and so it should not be necessary to change the side to move on your computer after giving your program a setboard command or you have a bug.


I would like to be able to move through multiple positions without closing Winboard. Once the player solves the current position, move to the next one.

You are saying that if I send arena positions, it will solve them? I don't want the computer to solve them, I want my students to. This is not an effort to learn the answer but to practice with basic puzzles.

I don't think Arena will do what I am looking for.
BrettVsop
 
Posts: 50
Joined: 04 Nov 2007, 18:32

Re: Can engines set up positions

Postby Mike Scheidl » 12 Nov 2007, 01:11

If you want to display a position, discuss it with your students etc. (they could enter moves, variations, whatever...), and later switch to the next position with one mouse click, Arena is perfect for you. You only need to have all your positions as FEN or EPD lines, in a file. Arena can read this file and you are able to browse through it, one position after the other. There are toolbar buttons for it, to load the next or the previous position. You can hide or display the list (in text format), to select specific positions directly.

If you have the positions in a PGN file (database of games, which can also start with a position other than the starting position), you can switch from one game to the next in Arena, in just the same way.

For that, version 1.1 will be sufficient (1.99 are beta).

http://www.playwitharena.com/
Regards & mfg.
Michael Scheidl
User avatar
Mike Scheidl
 
Posts: 31
Joined: 27 Sep 2004, 15:42


Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 18 guests