[roland@localhost src]$ ./gumble
uci
id name Gumble 4723fd2
id author Romain "Artefact2" Dal Maso
uciok
position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
gumble: /home/roland/Documents/echecs/sources/gumble/src/gumble.c:174: main: Assertion `ret == CCH_OK' failed.
Abandon (core dumped)
[roland@localhost src]$ 

--------------------------------------------------------------------------------

https://gitlab.com/artefact2/gumble/-/work_items/3

Problème dans l'extraction de la chaîne FEN
Ouvert
  Issue créé 24 janv. 2023 par Roland Chastain
Le programme ne réagit pas correctement à la commande position fen....

[roland@localhost src]$ ./gumble
position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
gumble: /home/roland/Documents/echecs/sources/gumble/src/gumble.c:174: main: Assertion `ret == CCH_OK' failed.
Abandon (core dumped)
[roland@localhost src]$ 
En ajoutant ceci (pour comprendre ce qui se passe),

char fen[SAFE_FEN_LENGTH];
/* XXX: find prettier way to do this */
snprintf(fen, SAFE_FEN_LENGTH, "%s %s %s %s %s %s",
  strtok(0, delim), strtok(0, delim), strtok(0, delim),
  strtok(0, delim), strtok(0, delim), strtok(0, delim));
fprintf(stderr, "DEBUG fen [%s]\n", fen); // <--
voici ce qu'on peut voir :

[roland@localhost src]$ ./gumble
position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
DEBUG fen [1 0 - KQkq w rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR]
gumble: /home/roland/Documents/echecs/sources/gumble/src/gumble.c:174: main: Assertion `ret == CCH_OK' failed.
Abandon (core dumped)
[roland@localhost src]$ 


Voici une modification qui paraît fonctionner :

int ret, i;

/* ... */

/*
snprintf(fen, SAFE_FEN_LENGTH, "%s %s %s %s %s %s",
  strtok(0, delim), strtok(0, delim), strtok(0, delim),
  strtok(0, delim), strtok(0, delim), strtok(0, delim));
*/

for (i = 0; i < 6; i++) {
  strcat(fen, strtok(0, delim));
  if (i < 5) strcat(fen, " ");
}



[roland@localhost src]$ ./gumble
position fen rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
DEBUG fen [rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1]
go movetime 500
info depth 1 score cp -4 time 0 nodes 20 nps 444444 pv a2a3
info depth 2 score cp 6 time 0 nodes 171 nps 539285 pv e2e3 a7a5
info depth 3 score cp -5 time 3 nodes 2836 nps 772016 pv e2e3 e7e6 f1b5
info depth 4 score cp 8 time 10 nodes 7029 nps 593657 pv e2e3 g8f6 d1f3 f6e4
info depth 5 score cp 93 time 77 nodes 54667 nps 717083 pv e2e3 e7e6 d1g4 f7f5 g4g7
bestmove e2e3

