home *** CD-ROM | disk | FTP | other *** search
- {$A+,B-,D-,F+,G+,I+,K+,L-,N-,P-,Q-,R-,S+,T+,V-,W+,X+,Y-}
- unit MAGIC;
-
- { Program copyright (c) 1995 by Charles Calvert }
- { Project Name: TTT }
-
-
- { File: MAGIC.PAS
- Author: Bob Swart (bobs@dragons.nest.nl)
-
- From the article entitled 'Tic-tac-toe, Borland Pascal, C++ and
- Visual Basic make it so'
- written by Bob Swart, Jeroen Pluimers and Hans van der Veeke to
- appear in a future issue of Dr.Dobbs (Algorithm Alley column).
- ----------------------------------------------------------------
- This file contains the interface code to the MAGIC.DLL (with the
- magic square tic-tac-toe algorithm).
- }
-
- interface
-
- const
- NoneID = 0;
- UserID = 1;
- CompID = 2;
-
- Type
- TPlayer = NoneID..CompID;
-
- Const
- NilPlace = 0; { move impossible }
- FirstPlace = 1;
- LastPlace = 9;
-
- Type
- TPlace = FirstPlace..LastPlace;
- TMove = NilPlace..LastPlace;
-
- Type
- HGame = Word; { Handle to a game }
-
- function NewGame: HGame;
- procedure EndGame(Game: HGame);
- procedure MakeMove(Game: HGame; ID: TPlayer; Place: TPlace);
- function NextMove(Game: HGame; ID: TPlayer): TMove;
- function IsWinner(Game: HGame): TPlayer;
- function GetValue(Game: HGame; Place: TPlace): TPlayer;
-
- implementation
-
- function NewGame; external 'MAGIC' index 1;
- procedure EndGame; external 'MAGIC' index 2;
- procedure MakeMove; external 'MAGIC' index 3;
- function NextMove; external 'MAGIC' index 4;
- function IsWinner; external 'MAGIC' index 5;
- function GetValue; external 'MAGIC' index 6;
-
- end.
-