-- AUTHOR: E. Burke -- DATE: November, 1996 -- PURPOSE: Specification for generic boxes and stacks and operations -- needed to play Box Game -- Driver program is Boxgame with TEXT_IO; generic MAX_BOXES : POSITIVE; MAX_STACKS : POSITIVE; MAX_INPUT : POSITIVE; SCREEN_WIDTH : POSITIVE; SCREEN_HEIGHT : POSITIVE; package PLAY_FIELD is subtype BOX_ID is NATURAL range 0..MAX_BOXES; subtype STACK_ID is POSITIVE range 1..MAX_STACKS; subtype BOX_DIM is NATURAL range 0..16; subtype FIELD_DIM is POSITIVE range 1..80; type BOX_PROP is record ID : BOX_ID; Height : BOX_DIM; Radius : BOX_DIM; Color : CHARACTER; Cur_Stack : STACK_ID; Cur_Box_Below : BOX_ID; Cur_Height_Bottom : FIELD_DIM; end record; type STACK_PROP is record ID : STACK_ID; Center_Pos : FIELD_DIM; Base_Height : FIELD_DIM; Box_Id_Top : BOX_ID; end record; type BOXES is array (1..MAX_BOXES) OF BOX_PROP; type STACKS is array (1..MAX_STACKS) OF STACK_PROP; type SCREEN_DISPLAY is array (1..SCREEN_HEIGHT, 1..SCREEN_WIDTH) of CHARACTER; procedure Input (Play_Box : out BOXES; Play_Stack : out STACKS); procedure Move_Box (Play_Box : in out BOXES; Play_Stack : in out STACKS; Continue : out BOOLEAN); procedure Place_Box (Bid : in BOX_ID; Sid : in STACK_ID; Play_Box : in out BOXES; Play_Stack : in out STACKS); procedure Remove_Box (Bid : out BOX_ID; Sid : in STACK_ID; Play_Box : in BOXES; Play_Stack : in out STACKS); procedure Display (Play_Box : in BOXES; Play_Stack : in STACKS); procedure Output (Bid : in BOX_ID; Play_Box : in BOXES; Play_Stack : in STACKS; Box_Display : out SCREEN_DISPLAY); function Enquire return BOOLEAN; end PLAY_FIELD; -- comments by G. Levine -- Why are you putting all of these operations in the specification? -- The specification should contain only these capabilities that are -- to be exported. -- You might consider including an exception handler here.