ChessDefs: CEDAR DEFINITIONS = { Piece: TYPE = { p0, p1, p2, p3, p4, p5, p6, p7, br, wn, bb, q, k, wb, bn, wr }; Pawn: TYPE = Piece[p0..p7]; NonPawn: TYPE = Piece[br..wr]; PieceColor: TYPE = {white, black, none}; WhiteBlack: TYPE = PieceColor[white..black]; ColoredPiece: TYPE = RECORD [color: PieceColor, piece: Piece]; noPiece: ColoredPiece = [none, p0]; Board: TYPE = ARRAY BoardIndex OF ColoredPiece; initialBoard: Board = [ [white, br], [white, wn], [white, bb], [white, q], [white, k], [white, wb], [white, bn], [white, wr], [white, p0], [white, p1], [white, p2], [white, p3], [white, p4], [white, p5], [white, p6], [white, p7], noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, noPiece, [black, p0], [black, p1], [black, p2], [black, p3], [black, p4], [black, p5], [black, p6], [black, p7], [black, wr], [black, bn], [black, wb], [black, q], [black, k], [black, bb], [black, wn], [black, br] ]; BoardIndex: TYPE = [0..64); Position: TYPE = RECORD [ SELECT OVERLAID * FROM rowCol => [row: [0..8), col: [0..8)], index => [index: BoardIndex], ENDCASE ]; Side: TYPE = {queen, king}; MoveList: TYPE = LIST OF Move; Move: TYPE = RECORD [ piece: ColoredPiece, from: Position, to: Position, alias: Piece _ p0, note: SpecialEffects _ [none[]], wasCheck: ARRAY WhiteBlack OF BOOL _ [FALSE, FALSE], material: INTEGER _ 0 ]; SpecialEffects: TYPE = RECORD [ SELECT kind: * FROM none => NULL, castle => [side: Side], remove => [victim: ColoredPiece, from: Position] ENDCASE ]; GameState: TYPE = REF GameStateRep; GameStateRep: TYPE = RECORD [ toMove: WhiteBlack _ white, history: MoveHistory _ NIL, future: MoveList _ NIL, board: Board _ initialBoard, material: ARRAY WhiteBlack OF INTEGER _ [0, 0], coverage: ARRAY WhiteBlack OF Coverage _ [NIL, NIL], inCheck: ARRAY WhiteBlack OF BOOL _ [FALSE, FALSE], positions: ARRAY WhiteBlack OF Positions _ [NIL, NIL], aliases: ARRAY WhiteBlack OF Aliases _ [NIL, NIL] ]; MoveHistory: TYPE = REF MoveHistoryRep; MoveHistoryRep: TYPE = RECORD [ current: NAT, last: NAT, elems: SEQUENCE max: NAT OF Move]; Aliases: TYPE = REF AliasesRep; AliasesRep: TYPE = ARRAY Pawn OF Piece; Positions: TYPE = REF PositionsRep; PositionsRep: TYPE = ARRAY Piece OF FullPosition; FullPosition: TYPE = RECORD [onOff: {on, off}, position: Position]; Coverage: TYPE = REF CoverageRep; CoverageRep: TYPE = ARRAY BoardIndex OF SquareCoverage; SquareCoverage: TYPE = PACKED ARRAY Piece OF BOOL; LookaheadStack: TYPE = REF LookaheadStackRep; LookaheadStackRep: TYPE = RECORD [ levels: SEQUENCE max: NAT OF GameState ]; }. ήChessDefs.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Russ Atkinson (RRA) November 8, 1985 2:32:46 pm PST If the board configuration or initial setup needs changing, please inform the International Chess Federation, who will be happy to oblige, I'm sure. Denotes piece being moved (the king for castling) Denotes source square of this move Denotes destination square of this move Denotes alias (pawns only) added in this move Special effects (like capture & castle) Used to save value of inCheck before the move Used to save value of material before the move Keeps track of the material weights for each side Keeps track of the squares covered by white/black Keeps track of moves by king/rook When a pawn has turned into another piece it has an alias. Normally it has itself as an alias. When a pawn has turned into another piece it has an alias. Normally it has itself as an alias. Coverage describes which squares on the board are covered by various pieces. ΚS˜šœ™Icodešœ Οmœ1™Kšœ#˜#K˜—šœžœžœ žœ˜/Kšœ”™”šœ˜K˜fK˜hKšœH˜HKšœH˜HKšœH˜HKšœH˜HK˜hK˜eK˜—Kšœ žœ ˜—K˜šœ žœžœ˜šžœžœž˜Kšœ%˜%Kšœ˜Kšž˜—Kšœ˜—K˜Kšœžœ˜K˜Kšœ žœžœžœ˜šœžœžœ˜šœ˜Kšœ1™1—šœ˜Kšœ"™"—šœ ˜ Kšœ'™'—˜Kšœ-™-—šœ ˜ Kšœ'™'—š œ žœ žœžœžœžœ˜4Kšœ-™-—šœ žœ˜Kšœ.™.—K˜—šœžœžœ˜šžœ ž˜Kšœžœ˜ K˜Kšœ0˜0Kšž˜—K˜—K˜Kšœ žœžœ˜#šœžœžœ˜Kšœ˜Kšœžœ˜Kšœžœ˜Kšœ˜šœ žœ žœžœ ˜/Kšœ1™1—š œ žœ žœ žœžœ˜4Kšœ1™1—š œ žœ žœžœžœžœ˜3Kšœ!™!—Kš œ žœ žœžœžœ˜6Kš œ žœ žœ žœžœ˜1K˜K˜—Kšœ žœžœ˜'šœžœžœ˜Kšœ žœ˜ Kšœžœ˜ Kšœžœžœžœ˜"K˜—Kšœ žœžœ ˜šœ žœžœžœ˜'Kšœ_™_K˜—Kšœ žœžœ˜#šœžœžœžœ˜1Kšœ_™_Kšœžœžœ(˜CK˜—Kšœ žœžœ ˜!šœ žœžœ žœ˜7KšœL™L—K˜š œžœžœžœžœžœ˜2K˜—Kšœžœžœ˜-šœžœžœ˜"Kšœžœžœžœ ˜&K˜K˜—Kšœ˜K˜—…— δ