Moderators: hgm, Andres Valverde
if (!ParseOneMove(machineMove, forwardMostMove, &moveType,
&fromX, &fromY, &toX, &toY, &promoChar)) {
/* Machine move could not be parsed; ignore it. */
snprintf(buf1, MSG_SIZ*10, _("Illegal move \"%s\" from %s machine"),
machineMove, _(cps->which));
DisplayMoveError(buf1);
snprintf(buf1, MSG_SIZ*10, "Xboard: Forfeit due to invalid move: %s (%c%c%c%c via %c%c) res=%d",
machineMove, fromX+AAA, fromY+ONE, toX+AAA, toY+ONE, killX+AAA, killY+ONE, moveType);
if (gameMode == TwoMachinesPlay) {
GameEnds(machineWhite ? BlackWins : WhiteWins,
buf1, GE_XBOARD);
}
ParseOneMove(machineMove, forwardMostMove, &moveType,
&fromX, &fromY, &toX, &toY, &promoChar)
SendToProgram("usermove", cps);
SendToICS("usermove");
if (!ParseOneMove(machineMove, forwardMostMove, &moveType,
&fromX, &fromY, &toX, &toY, &promoChar)) {
/* Machine move could not be parsed; ignore it. */
snprintf(buf1, MSG_SIZ * 10, _("Hey human you made an illegal move \"%s\"..."),
machineMove, _(cps->which));
DisplayMoveError(buf1);
/*snprintf(buf1, MSG_SIZ * 10, "Xboard: Forfeit due to invalid move: %s (%c%c%c%c via %c%c) res=%d",
machineMove, fromX + AAA, fromY + ONE, toX + AAA, toY + ONE, killX + AAA, killY + ONE, moveType);*/
if (gameMode == TwoMachinesPlay) {
/*GameEnds(machineWhite ? BlackWins : WhiteWins,
buf1, GE_XBOARD);*/
}
SendToProgram("usermove\n", cps); //added this to fake a usermove so that buddhichal could send a new move with "\n was necessary i think"
return;
}
ademkika wrote:I was able to compile WInboard and I was able to write messages that are printed above the board (which you mentioned) to a text file, which helps me to detect whether there is for example "check" (which means opponent should check his king cause its in danger). So far so good, the only thing left that I need is that on illegal move made by human (supposing human its playing for the first time) i want to warn user and allow him to remake his move (legal move). In file backend.c i founded code which check is message gotten by machine (in my case buddhichal) is "move" and if so winboard tries to execute that move. Inside this if statement ther is this codewhich checks for move legality. In this if statement if move is illegal game ends, but i dont want to end, I want to replace code for game ending with code which scans for a new move command by buddhichal (newest move) and till:
- Code: Select all
if (!ParseOneMove(machineMove, forwardMostMove, &moveType,
&fromX, &fromY, &toX, &toY, &promoChar)) {
/* Machine move could not be parsed; ignore it. */
snprintf(buf1, MSG_SIZ*10, _("Illegal move \"%s\" from %s machine"),
machineMove, _(cps->which));
DisplayMoveError(buf1);
snprintf(buf1, MSG_SIZ*10, "Xboard: Forfeit due to invalid move: %s (%c%c%c%c via %c%c) res=%d",
machineMove, fromX+AAA, fromY+ONE, toX+AAA, toY+ONE, killX+AAA, killY+ONE, moveType);
if (gameMode == TwoMachinesPlay) {
GameEnds(machineWhite ? BlackWins : WhiteWins,
buf1, GE_XBOARD);
}returns true, which means move is llegal (which since is a human move its supposed that second or third move must be legal). I hope i made my self clear. Any idea how to add this "recursivity" thing?
- Code: Select all
ParseOneMove(machineMove, forwardMostMove, &moveType,
&fromX, &fromY, &toX, &toY, &promoChar)
Return to WinBoard development and bugfixing
Users browsing this forum: No registered users and 16 guests