s. Items [i]; ((CP ^. X = x) And (CP ^. Y = y)) Then: = i;;;;; TDraught. Create (sd: Integer); Create;: = sd;: = kdSimple;; TDraught. Destroy; Destroy;; TDraught. SetSide (Value: Integer); Value = sdWhite Then
_Side: = sdWhite;: = [MoveNW, MoveNE] Begin
_Side: = sdBlack;: = [MoveSW, MoveSE];; Kind = kdKing Then PossibleMoves: = [MoveNW, MoveNE, MoveSW, MoveSE];; TDraught. SetKind (Value: Integer); Value = kdSimple Then
_Kind: = kdSimple
_Kind: = kdKing; (_Side);; TChessBoard. Create;, y: Integer; Create; y: = 0 To 9 Dox: = 0 To 9 Do ((x = 0) Or (y = 0) Or (x = 9) Or (y = 9)) Then [y , x]. CellType: = ctNone ((Odd (x) And Odd (y)) Or (Not (Odd (x)) And Not (Odd (y)))) Then [y, x]. CellType: = ctBlack [y, x]. CellType: = ctWhite; [y, x]. Draught: = nil;;;; TChessBoard. Destroy;; Destroy;; TChessBoard. AddDraught (x, y: Integer; Side: Integer; Kind: Integer = kdSimple): TDraught;: = nil; ((Cells [y, x]. CellType = ctNone) Or (Cells [y, x]. Draught <> ; nil)) Then Exit;: = TDraught. Create (Side);. Kind: = Kind; [y, x]. Draught: = Result;; TChessBoard. DeleteDraught (x, y: Integer); Cells [y, x]. Draught <> nil Then Cells [y, x]. Draught. Free; [y, x]. Draught: = nil;; TChessBoard. GetDraught (x, y: Integer): TDraught;: = Cells [y, x]. Draught;; TChessBoard. SetDraught (x, y: Integer; Const Draught: TDraught): Boolean;: = True; [y, x]. Draught: = Draught; Draught = nil Then Exit; (((Draught. Side = sdWhite) And (y = 8)) Or ((Draught. Side = sdBlack) And (y = 1))) Then. Kind: = kdKing;; TChessBoard. Clear;, y: Integer; y: = 0 To 9 Dox: = 0 To 9 Do (x, y);; TChessBoard. Respawn;: Integer;;
// Белиеx: = 1 To 8 DoOdd (x) Then (x, 2, sdWhite) Begin (x, 1, sdWhite); (x, 3, sdWhite);;
// Черниеx: = 1 To 8 DoNot (Odd (x)) Then (x, 7, sdBlack) Begin (x, 8, sdBlack); (x, 6, sdBlack);;; TChessBoard. MoveDraught (FromX, FromY, ToX, ToY: Integer): Boolean;: = False; ((Cells [FromY, FromX]. CellType = ctNone) Or (Cells [ToY, ToX]. CellType = ctNone)) Then Exit; ( (GetDraught (FromX, FromY) = nil) Or (GetDraught (ToX, ToY) <> nil)) Then Exit; (ToX, ToY, GetDraught (FromX, FromY)); (FromX, FromY, nil);: = True;; TChessBoard. FindMoves (x, y: Integer; Var Moves, Strikes, Strickens: TList);: Integer;, dY, dL: Integer;: PCellPosition;: Boolean;: = nil;: = nil;: = nil; Cells [y, x]. Draught = nil Then Exit;: = TList. Create;: = TList. Create;: = TList. Create; i: = 1 To 4 Do: = False;: = DraughtMoves [i]. DX;: = DraughtMoves [i]. DY;: = 0; (dL); Cells [y + dY * dL, x + dX * dL]. CellType <> ctNone Then// Чи можна вставати на цю клеткуCells [y + dY * dL, x + dX * dL]. Draught = nil Then// Якщо клітка порожня, то запишемо хід ...
// ... запишемо хід в тому випадку, якщо шашка може ходити в цю сторону
If (i In Cells [y, x]. Draught. PossibleMoves) T...