uci command - position...moves...

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

uci command - position...moves...

Post by Desperado »

Hello, everyone,

today i found a bug (i consider it as bug) with the uci protocol handling.

The "position...moves..." command

The Shredder GUI seems to send the "moves" with empty movelists like

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - moves

Not that it would be a big deal to fix that problem, but i wonder
if it makes sense that the "moves" part is sent without moves.

Shouldnt it be one of the 2 possibilities:

1: position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - -
2: position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - moves m1,m2,...,mN

At the moment i think, that "moves" isnt an essential part of the position
command, because "position startpos go depth n ", seems to be valid too.

What do you think ?

Michael
Ferdy
Posts: 4853
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: uci command - position...moves...

Post by Ferdy »

Desperado wrote:Hello, everyone,

today i found a bug (i consider it as bug) with the uci protocol handling.

The "position...moves..." command

The Shredder GUI seems to send the "moves" with empty movelists like

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - moves

Not that it would be a big deal to fix that problem, but i wonder
if it makes sense that the "moves" part is sent without moves.

Shouldnt it be one of the 2 possibilities:

1: position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - -
2: position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - moves m1,m2,...,mN

At the moment i think, that "moves" isnt an essential part of the position
command, because "position startpos go depth n ", seems to be valid too.

What do you think ?

Michael
It is essential. If there are no moves to do after fen or startpos then there is nothing to be moved in the internal chess board. This command has 2 parts, setting up a position and moving the moves if there are moves to be made.

Code: Select all

* position [fen <fenstring> | startpos ]  moves <move1> .... <movei>
	set up the position described in fenstring on the internal board and
	play the moves on the internal chess board.
	if the game was played  from the start position the string "startpos" will be sent
	Note: no "new" command is needed. However, if this position is from a different game than
	the last position sent to the engine, the GUI should have sent a "ucinewgame" inbetween.
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: uci command - position...moves...

Post by Desperado »

A:
===

ok, but why does nearly every Gui sends position commands without
the "moves" part (if there arent moves) ?

I know the quoted part from the uci protocol, but it does not
explicit mention, that "moves" has to be part of the string,
if there arent any moves.

B:
===

If you check normal log files, eg Arena:

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - 0 1
go wtime 246000 btime 240000 winc 6000 binc 6000

i dont see the _essential_ "moves" part of the position command.

C: and now ...
==============

debug log: "SHREDDER GUI" :!:

Code: Select all


### 1.: to Nemo 1.0.1 x64 (1): debug on
### 2.: to Nemo 1.0.1 x64 (1): ucinewgame
### 3.: to Nemo 1.0.1 x64 (1): isready
### from Nemo 1.0.1 x64 (1): readyok
### 4.: to Nemo 1.0.1 x64 (1): 

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - moves

### 5.: to Nemo 1.0.1 x64 (1): go movestogo 40 wtime 300000 btime 300000

arent there halfmoveClock and FullmoveNumber missing in front of moves ?

Michael
Ferdy
Posts: 4853
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: uci command - position...moves...

Post by Ferdy »

A:
===

ok, but why does nearly every Gui sends position commands without
the "moves" part (if there arent moves) ?

I know the quoted part from the uci protocol, but it does not
explicit mention, that "moves" has to be part of the string,
if there arent any moves.
The uci description also includes the following statements below. It uses the word ignore.

Code: Select all

* if the engine or the GUI receives an unknown command or token it should just ignore it and try to
  parse the rest of the string in this line.
  Examples: "joho debug on\n" should switch the debug mode on given that joho is not defined,
            "debug joho on\n" will be undefined however.

* if the engine receives a command which is not supposed to come, for example "stop" when the engine is
  not calculating, it should also just ignore it.
B:
===

If you check normal log files, eg Arena:

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - 0 1
go wtime 246000 btime 240000 winc 6000 binc 6000

i dont see the _essential_ "moves" part of the position command.

Here is a sample log from arena also where moves is essential for position command.

Code: Select all

112748 >first : position startpos moves d2d4 g8f6 c2c4 g7g6 b1c3 f8g7 e2e4 d7d6 g1f3 e8g8 f1e2 e7e5 c1e3 c7c6 d4d5 f6g4 e3g5 f7f6 g5h4 h7h5
112748 >first : go wtime 260000 btime 260000 winc 2000 binc 2000
User avatar
Desperado
Posts: 879
Joined: Mon Dec 15, 2008 11:45 am

Re: uci command - position...moves...

Post by Desperado »

Ferdy wrote:
A:
===

ok, but why does nearly every Gui sends position commands without
the "moves" part (if there arent moves) ?

I know the quoted part from the uci protocol, but it does not
explicit mention, that "moves" has to be part of the string,
if there arent any moves.
The uci description also includes the following statements below. It uses the word ignore.

Code: Select all

* if the engine or the GUI receives an unknown command or token it should just ignore it and try to
  parse the rest of the string in this line.
  Examples: "joho debug on\n" should switch the debug mode on given that joho is not defined,
            "debug joho on\n" will be undefined however.

* if the engine receives a command which is not supposed to come, for example "stop" when the engine is
  not calculating, it should also just ignore it.
B:
===

If you check normal log files, eg Arena:

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - 0 1
go wtime 246000 btime 240000 winc 6000 binc 6000

i dont see the _essential_ "moves" part of the position command.

Here is a sample log from arena also where moves is essential for position command.

Code: Select all

112748 >first : position startpos moves d2d4 g8f6 c2c4 g7g6 b1c3 f8g7 e2e4 d7d6 g1f3 e8g8 f1e2 e7e5 c1e3 c7c6 d4d5 f6g4 e3g5 f7f6 g5h4 h7h5
112748 >first : go wtime 260000 btime 260000 winc 2000 binc 2000
Ferdy, it looks like i dont express myself very well.

The _only_ question is, if there are not any moves in the movelist ,
is the "moves" command then redundant ?

(your example has 20 moves listed, no questions about how to handle that case :!: )

And do you at least agree that in the shown debug log snippet,
the FEN is invalid :?: , because of the missing parts:

1. halfmove clock
2. fullmove number
Ferdy
Posts: 4853
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: uci command - position...moves...

Post by Ferdy »

Desperado wrote:
Ferdy wrote:
A:
===

ok, but why does nearly every Gui sends position commands without
the "moves" part (if there arent moves) ?

I know the quoted part from the uci protocol, but it does not
explicit mention, that "moves" has to be part of the string,
if there arent any moves.
The uci description also includes the following statements below. It uses the word ignore.

Code: Select all

* if the engine or the GUI receives an unknown command or token it should just ignore it and try to
  parse the rest of the string in this line.
  Examples: "joho debug on\n" should switch the debug mode on given that joho is not defined,
            "debug joho on\n" will be undefined however.

* if the engine receives a command which is not supposed to come, for example "stop" when the engine is
  not calculating, it should also just ignore it.
B:
===

If you check normal log files, eg Arena:

position fen 8/8/8/8/1kB1q3/8/1PRb4/1K6 b - - 0 1
go wtime 246000 btime 240000 winc 6000 binc 6000

i dont see the _essential_ "moves" part of the position command.

Here is a sample log from arena also where moves is essential for position command.

Code: Select all

112748 >first : position startpos moves d2d4 g8f6 c2c4 g7g6 b1c3 f8g7 e2e4 d7d6 g1f3 e8g8 f1e2 e7e5 c1e3 c7c6 d4d5 f6g4 e3g5 f7f6 g5h4 h7h5
112748 >first : go wtime 260000 btime 260000 winc 2000 binc 2000
Ferdy, it looks like i dont express myself very well.

The _only_ question is, if there are not any moves in the movelist ,
is the "moves" command then redundant ?

(your example has 20 moves listed, no questions about how to handle that case :!: )

And do you at least agree that in the shown debug log snippet,
the FEN is invalid :?: , because of the missing parts:

1. halfmove clock
2. fullmove number
There is no point for that string "moves" to appear if there is no move following it of course. :D
The fen does not comply with the fen standard definitely.