(vcbChess. Board. AbleToMove (CurrentPlayer)) ThenCurrentPlayer = sdWhite Then Result: = sdBlack Else Result: = sdWhite; Result <0 Then Exit;
// Game Over! (Self); Result Of: Application. MessageBox ('Перемогла команда В«БілихВ»', 'Перемогли Білі!', MB_OK + MB_ICONINFORMATION);
sdBlack: Application. MessageBox ('Перемогла команда В«ЧорнихВ»', 'Перемогли Чорні!', MB_OK + MB_ICONINFORMATION);
End;; TfmCheckers. Timer1Timer (Sender: TObject);
// Inc (PlayTime);
// stTimer. Caption: = Format ('% d:% .2 d:% .2 d', [PlayTime div 3600, (PlayTime mod 3600) div 60, (PlayTime mod 3600) mod 60]);. Caption: = TimeToStr (Now-StartTime);; TfmCheckers.miStartLocalGameClick (Sender: TObject);: = True;. ReadOnly: = True;. ReadOnly: = True;
// PlayTime: = 0;: = Now;: = sdWhite;: = sdBlack;: = False;: = False;. Board. Respawn;. Refresh;. Enabled: = True;. Enabled: = True;;; TfmCheckers.miCancelGameClick (Sender: TObject);. Enabled: = False;. Enabled: = False;. ReadOnly: = False;. ReadOnly: = False;. MessageBox ('Гра зкончена', 'Гра закінчена', MB_OK + MB_ICONINFORMATION);; TfmCheckers.miAboutClick (Sender: TObject);. ShowModal;;. p align="justify"> Draughts;; = Record, dY: Integer;; = 0; = 1; = 255; = 0; = 1; = 0; = 1; = 1; {} = 2; {} = 3; {} = 4; {}: Array [1 .. 4] Of TMove = ((dX: - 1; dY: 1), (dX: 1; dY: 1), (dX: - 1; dY : - 1), (dX: 1; dY: - 1)); = Set Of MoveNW .. MoveSE; = ^ TCellPosition; = Record, Y: Integer;; = Class (TObject)
_Side: Integer; {Бік: Біла/Чорна}
_Kind: Integer; {Тип: Проста/Дамка}: TPossibleMoves; {Можливі ходи} SetSide (Value: Integer); SetKind (Value: Integer); Create (sd: Integer); Destroy; Override ; Side: Integer read _Side write SetSide; Kind: Integer read _Kind write SetKind;; = Record: Integer;: TDraught;; = Class (TObject): Array [0 .. 9, 0 .. 9] Of TBoardCell; Create; Destroy; Override; AddDraught (x, y: Integer; Side: Integer; Kind: Integer = kdSimple): TDraught; DeleteDraught (x, y: Integer); GetDraught (x, y: Integer): TDraught; SetDraught (x, y : Integer; Const Draught: TDraught): Boolean; Clear; Respawn; MoveDraught (FromX, FromY, ToX, ToY: Integer): Boolean; FindMoves (x, y: Integer; Var Moves, Strikes, Strickens: TList); FindStrikingDraughts ( Side: Integer): TList; CountDraughts (Side: Integer): Integer; AbleToMove (Side: Integer): Boolean;; ClearMoves (Var Moves: TList); CheckPosition (x, y: Integer; Const Positions: TList): Integer; ClearMoves (Var Moves: TList);: Integer;: PCellPosition; Moves = nil Then Exit; i: = 0 To Moves. Count-1 Do: = Moves. Items [i]; (CP);;. Free;: = nil;; CheckPosition (x, y: Integer; Const Positions: TList): Integer;: Integer;: PCellPosition;: = -1; Positions = nil Then Exit; i: = 0 To Positions. Count-1 Do: = Position...