You've already forked lazarus-ccr
fpchess: Had forgotten to make AI moves in its board
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1877 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -255,6 +255,8 @@ begin
|
|||||||
StartupInitialize();
|
StartupInitialize();
|
||||||
DefaultBoard();
|
DefaultBoard();
|
||||||
|
|
||||||
|
Game.GameFinished := false;
|
||||||
|
|
||||||
if vChessGame.FirstPlayerIsWhite then
|
if vChessGame.FirstPlayerIsWhite then
|
||||||
begin
|
begin
|
||||||
ComputerColor := C_BLACK;
|
ComputerColor := C_BLACK;
|
||||||
@ -277,6 +279,7 @@ var
|
|||||||
UserMovement, AIMovement: MoveType;
|
UserMovement, AIMovement: MoveType;
|
||||||
Escape: boolean;
|
Escape: boolean;
|
||||||
Score: Integer;
|
Score: Integer;
|
||||||
|
lMoved: Boolean;
|
||||||
begin
|
begin
|
||||||
// initialization
|
// initialization
|
||||||
Escape := False;
|
Escape := False;
|
||||||
@ -301,12 +304,16 @@ begin
|
|||||||
|
|
||||||
{ Now get the computer move }
|
{ Now get the computer move }
|
||||||
GetComputerMove(ComputerColor, False, AIMovement, Escape);
|
GetComputerMove(ComputerColor, False, AIMovement, Escape);
|
||||||
|
MakeMove(AIMovement, True, Score);
|
||||||
|
|
||||||
{ And write it to our board }
|
{ And write it to our board }
|
||||||
|
|
||||||
vChessGame.MovePiece(
|
lMoved := vChessGame.MovePiece(
|
||||||
Point(AIMovement.FromCol, AIMovement.FromRow),
|
Point(AIMovement.FromCol, AIMovement.FromRow),
|
||||||
Point(AIMovement.ToCol, AIMovement.ToRow));
|
Point(AIMovement.ToCol, AIMovement.ToRow));
|
||||||
|
|
||||||
|
if not lMoved then raise Exception.Create(Format('Moving failed from %s to %s',
|
||||||
|
[vChessGame.BoardPosToChessCoords(AFrom), vChessGame.BoardPosToChessCoords(ATo)]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
Reference in New Issue
Block a user