diff --git a/config/eschecs.eng b/config/eschecs.eng index 67903cd..00cb628 100644 --- a/config/eschecs.eng +++ b/config/eschecs.eng @@ -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 diff --git a/source/eschecs.pas b/source/eschecs.pas index 12d120c..8338489 100644 --- a/source/eschecs.pas +++ b/source/eschecs.pas @@ -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} @@ -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); @@ -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); @@ -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; diff --git a/source/version.inc b/source/version.inc index 20e496a..c5f4181 100644 --- a/source/version.inc +++ b/source/version.inc @@ -1,6 +1,6 @@ const - CVersion = '5.0.1'; + CVersion = '5.0.2'; CDefaultTitle = 'Eschecs'; {$if defined(cpu64) and defined(windows)} COsType = 'win64';