Skip to content

Commit

Permalink
Version 5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rchastain committed Dec 26, 2019
1 parent 214e416 commit f543320
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 84 deletions.
54 changes: 27 additions & 27 deletions config/eschecs.eng
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@

[engine0]
command=alouette64
command=alouette32.exe
name=Alouette
protocol=uci
workingdirectory=engines/linux/alouette/009/
workingdirectory=engines/windows/alouette/009/
canplaychess960=true

[engine1]
command=floyd0.9.linux.x86-64
name=Floyd
command=cheng4.exe
name=Cheng
protocol=uci
workingdirectory=engines/linux/floyd/09/
canplaychess960=false
workingdirectory=engines/windows/cheng/439/
canplaychess960=true

[engine2]
command=Fridolin300
name=Fridolin
command=floyd0.9.w32.exe
name=Floyd
protocol=uci
workingdirectory=engines/linux/fridolin/300/
canplaychess960=true
workingdirectory=engines/windows/floyd/09/
canplaychess960=false

[engine3]
command=galjoen_linux
name=Galjoen
command=Fridolin-v2.00-32.exe
name=Fridolin
protocol=uci
workingdirectory=engines/linux/galjoen/0401/
workingdirectory=engines/windows/fridolin/200/
canplaychess960=true

[engine4]
command=Monolith_1_x64
name=Monolith
command=galjoen_w32.exe
name=Galjoen
protocol=uci
workingdirectory=engines/linux/monolith/10/
workingdirectory=engines/windows/galjoen/040/
canplaychess960=true

[engine5]
command=moustique64
name=Moustique
command=Hermann.exe
name=Hermann
protocol=uci
workingdirectory=engines/linux/moustique/02/
canplaychess960=false
workingdirectory=engines/windows/hermann/28/
canplaychess960=true

[engine6]
command=sapeli
name=Sapeli
command=moustique32.exe
name=Moustique
protocol=uci
workingdirectory=engines/linux/sapeli/153/
canplaychess960=true
workingdirectory=engines/windows/moustique/03/
canplaychess960=false

[engine7]
command=senpai
name=Senpai
command=Pharaon.exe
name=Pharaon
protocol=uci
workingdirectory=engines/linux/senpai/20/
workingdirectory=engines/windows/pharaon/351/
canplaychess960=true
121 changes: 65 additions & 56 deletions source/eschecs.pas
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ TMainForm = class(TfpgForm)
procedure SaveGame(Sender: TObject);
procedure OnResized(Sender: TObject);
function LoadFrcPos(const ANumber: integer): string;
procedure DropPiece(const AMousePos: TPoint; const ABortMove: boolean = FALSE);
end;

{$I icon.inc}
Expand Down Expand Up @@ -606,18 +607,21 @@ procedure TMainForm.WidgetMouseMove(Sender: TObject; AShift: TShiftState; const
var
X, Y: integer;
LMousePos: TPoint;
LTolerance: integer;
begin
if FDragging then
begin
LMousePos := AMousePos;
if LMousePos.X - FDragPos.X < 0 then
LMousePos.X := FDragPos.X
else if LMousePos.X - FDragPos.X > 7 * LScale then
LMousePos.X := 7 * LScale + FDragPos.X;
if LMousePos.Y - FDragPos.Y < 0 then
LMousePos.Y := FDragPos.Y
else if LMousePos.Y - FDragPos.Y > 7 * LScale then
LMousePos.Y := 7 * LScale + FDragPos.Y;

LTolerance := LScale div 3;
if (LMousePos.X - FDragPos.X < 0 - LTolerance)
or (LMousePos.X - FDragPos.X > 7 * LScale + LTolerance)
or (LMousePos.Y - FDragPos.Y < 0 - LTolerance)
or (LMousePos.Y - FDragPos.Y > 7 * LScale + LTolerance) then
begin
DropPiece(LMousePos, TRUE);
Exit;
end;

FChessboard.RestorePieceBackground(FMousePos - FDragPos);
FChessboard.SavePieceBackground(LMousePos - FDragPos);
Expand All @@ -635,57 +639,10 @@ procedure TMainForm.WidgetMouseMove(Sender: TObject; AShift: TShiftState; const
end;

procedure TMainForm.WidgetMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
var
LType: TPieceType;
X, Y: integer;
LSkip: boolean;
begin
if not FDragging then
Exit;
FDragging := FALSE;
FChessboard.ScreenToXY(AMousePos, X, Y);
FUserMove := Concat(FUserMove, EncodeSquare(X, Y));

if (FUserMove = 'e1g1') and FGame.IsLegal('e1h1') and FGame.IsCastling('e1h1') then FUserMove := 'e1h1';
if (FUserMove = 'e1c1') and FGame.IsLegal('e1a1') and FGame.IsCastling('e1a1') then FUserMove := 'e1a1';
if (FUserMove = 'e8g8') and FGame.IsLegal('e8h8') and FGame.IsCastling('e8h8') then FUserMove := 'e8h8';
if (FUserMove = 'e8c8') and FGame.IsLegal('e8a8') and FGame.IsCastling('e8a8') then FUserMove := 'e8a8';

if FGame.IsLegal(FUserMove) then
begin
FChessboard.RestorePieceBackground(FMousePos - FDragPos);
if FGame.IsPromotion(FUserMove) then
begin
FChessboard.SavePieceBackground(FChessboard.XYToScreen(X, Y), TRUE);
FChessboard.RestorePieceBackground(FChessboard.XYToScreen(X, Y));
FChessboard.DrawPiece(FChessboard.XYToScreen(X, Y), FPieceIndex);
FChessboardWidget.Invalidate;
LType := SelectPieceType;
end else
LType := ptNil;
DoMove(FUserMove, LType, FALSE, LSkip);
if LType <> ptNil then
FChessboard.SetPieceType(FPieceIndex, LType);
if not LSkip then
begin
FChessboard.SetPieceXY(FPieceIndex, X, Y);
FChessboard.DrawPiece(FChessboard.XYToScreen(X, Y), FPieceIndex);
if FColoring then
begin
FChessboard.ScreenSave;
FChessboard.HighlightMove(FUserMove, FPieceIndex);
end;
end;
FChessboardWidget.Invalidate;
OnMoveDone(FMoveHist.GetString(FCurrPosIndex));
end else
begin
FChessboard.RestorePieceBackground(FMousePos - FDragPos);
FChessboard.DrawPiece(FInitPos, FPieceIndex);
FChessboardWidget.Invalidate;
if Copy(FUserMove, 3, 2) <> Copy(FUserMove, 1, 2) then
OnUserIllegalMove;
end;
DropPiece(AMousePos);
end;

procedure TMainForm.ItemExitClicked(Sender: TObject);
Expand Down Expand Up @@ -1088,6 +1045,58 @@ function TMainForm.LoadFrcPos(const ANumber: integer): string;
ShowMessage(Format('Fichier introuvable: %s', [LFile]));
end;

procedure TMainForm.DropPiece(const AMousePos: TPoint; const ABortMove: boolean);
var
LType: TPieceType;
X, Y: integer;
LSkip: boolean;
begin
FDragging := FALSE;
FChessboard.ScreenToXY(AMousePos, X, Y);
FUserMove := Concat(FUserMove, EncodeSquare(X, Y));

if (FUserMove = 'e1g1') and FGame.IsLegal('e1h1') and FGame.IsCastling('e1h1') then FUserMove := 'e1h1';
if (FUserMove = 'e1c1') and FGame.IsLegal('e1a1') and FGame.IsCastling('e1a1') then FUserMove := 'e1a1';
if (FUserMove = 'e8g8') and FGame.IsLegal('e8h8') and FGame.IsCastling('e8h8') then FUserMove := 'e8h8';
if (FUserMove = 'e8c8') and FGame.IsLegal('e8a8') and FGame.IsCastling('e8a8') then FUserMove := 'e8a8';

if FGame.IsLegal(FUserMove) and not ABortMove then
begin
FChessboard.RestorePieceBackground(FMousePos - FDragPos);
if FGame.IsPromotion(FUserMove) then
begin
FChessboard.SavePieceBackground(FChessboard.XYToScreen(X, Y), TRUE);
FChessboard.RestorePieceBackground(FChessboard.XYToScreen(X, Y));
FChessboard.DrawPiece(FChessboard.XYToScreen(X, Y), FPieceIndex);
FChessboardWidget.Invalidate;
LType := SelectPieceType;
end else
LType := ptNil;
DoMove(FUserMove, LType, FALSE, LSkip);
if LType <> ptNil then
FChessboard.SetPieceType(FPieceIndex, LType);
if not LSkip then
begin
FChessboard.SetPieceXY(FPieceIndex, X, Y);
FChessboard.DrawPiece(FChessboard.XYToScreen(X, Y), FPieceIndex);
if FColoring then
begin
FChessboard.ScreenSave;
FChessboard.HighlightMove(FUserMove, FPieceIndex);
end;
end;
FChessboardWidget.Invalidate;
OnMoveDone(FMoveHist.GetString(FCurrPosIndex));
end else
begin
FChessboard.RestorePieceBackground(FMousePos - FDragPos);
FChessboard.DrawPiece(FInitPos, FPieceIndex);
FChessboardWidget.Invalidate;
if Copy(FUserMove, 3, 2) <> Copy(FUserMove, 1, 2) then
OnUserIllegalMove;
end;
end;

var
LForm: TMainForm;

Expand Down
2 changes: 1 addition & 1 deletion source/version.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

const
CVersion = '5.0.1';
CVersion = '5.0.2';
CDefaultTitle = 'Eschecs';
{$if defined(cpu64) and defined(windows)}
COsType = 'win64';
Expand Down

0 comments on commit f543320

Please sign in to comment.