home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / game / think / chaos / src / chaos.h < prev    next >
C/C++ Source or Header  |  1994-11-19  |  14KB  |  534 lines

  1. /*  Chaos:            The Chess HAppening Organisation System    V5.3
  2.     Copyright (C)   1993    Jochen Wiedmann
  3.  
  4.     This program is free software; you can redistribute it and/or modify
  5.     it under the terms of the GNU General Public License as published by
  6.     the Free Software Foundation; either version 2 of the License, or
  7.     (at your option) any later version.
  8.  
  9.     This program is distributed in the hope that it will be useful,
  10.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.     GNU General Public License for more details.
  13.  
  14.     You should have received a copy of the GNU General Public License
  15.     along with this program; if not, write to the Free Software
  16.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18.  
  19.     $RCSfile: Chaos.h,v $
  20.     $Revision: 3.3 $
  21.     $Date: 1994/11/19 19:32:01 $
  22.  
  23.     This is the include-file of the program. It defines the constants,
  24.     structures and prototypes.
  25.  
  26.     Computer:    Amiga 1200            Compiler:    Dice 2.07.54 (3.0)
  27.  
  28.     Author:    Jochen Wiedmann
  29.         Am Eisteich 9
  30.       72555 Metzingen
  31.         Tel. 07123 / 14881
  32.         Internet: wiedmann@mailserv.zdv.uni-tuebingen.de
  33. */
  34.  
  35.  
  36. #ifndef CHAOS_H
  37. #define CHAOS_H
  38.  
  39. #ifndef CHAOS_CAT_CATALOG_H
  40. #include "Chaos_Cat.h"
  41. #endif
  42.  
  43. #ifdef AMIGA
  44. #ifndef EXEC_LISTS_H
  45. #include <exec/lists.h>
  46. #endif
  47. #ifndef EXEC_MEMORY_H
  48. #include <exec/memory.h>
  49. #endif
  50. #ifndef EXEC_INTERRUPTS_H
  51. #include <exec/interrupts.h>
  52. #endif
  53. #ifndef DOS_DOS_H
  54. #include <dos/dos.h>
  55. #endif
  56. #ifndef DOS_EXALL_H
  57. #include <dos/exall.h>
  58. #endif
  59. #ifndef INTUITION_INTUITION_H
  60. #include <intuition/intuition.h>
  61. #endif
  62. #ifndef LIBRARIES_IFFPARSE_H
  63. #include <libraries/iffparse.h>
  64. #endif
  65. #ifndef MUI_H
  66. #include <libraries/mui.h>
  67. #endif
  68. #ifndef CLIB_EXEC_PROTOS_H
  69. #include <clib/exec_protos.h>
  70. #endif
  71. #ifndef CLIB_DOS_PROTOS_H
  72. #include <clib/dos_protos.h>
  73. #endif
  74. #ifndef CLIB_INTUITION_PROTOS_H
  75. #include <clib/intuition_protos.h>
  76. #endif
  77. #ifndef CLIB_MUIMASTER_PROTOS_H
  78. #include <clib/muimaster_protos.h>
  79. #endif
  80. #ifndef CLIB_ALIB_PROTOS_H
  81. #include <clib/alib_protos.h>
  82. #endif
  83. #ifndef CLIB_UTILITY_PROTOS_H
  84. #include <clib/utility_protos.h>
  85. #endif
  86. #ifndef CLIB_IFFPARSE_PROTOS_H
  87. #include <clib/iffparse_protos.h>
  88. #endif
  89.  
  90. #ifdef AZTEC_C
  91. #ifndef PRAGMAS_EXEC_LIB_H
  92. #include <pragmas/exec_lib.h>
  93. #endif
  94. #ifndef PRAGMAS_DOS_LIB_H
  95. #include <pragmas/dos_lib.h>
  96. #endif
  97. #ifndef PRAGMAS_INTUITION_LIB_H
  98. #include <pragmas/intuition_lib.h>
  99. #endif
  100. #ifndef PRAGMAS_MUIMASTER_LIB_H
  101. #include <pragmas/muimaster_lib.h>
  102. #endif
  103. #ifndef PRAGMAS_UTILITY_LIB_H
  104. #include <pragmas/utility_lib.h>
  105. #endif
  106. #ifndef PRAGMAS_IFFPARSE_LIB_H
  107. #include <pragmas/iffparse_lib.h>
  108. #endif
  109. #endif    /*  AZTEC_C    */
  110.  
  111. #if defined(_DCC)  ||  defined(__SASC)  ||  defined(__MAXON__)
  112. #ifndef PRAGMAS_EXEC_PRAGMAS_H
  113. #include <pragmas/exec_pragmas.h>
  114. #endif
  115. #ifndef PRAGMAS_DOS_PRAGMAS_H
  116. #include <pragmas/dos_pragmas.h>
  117. #endif
  118. #ifndef PRAGMAS_INTUITION_PRAGMAS_H
  119. #include <pragmas/intuition_pragmas.h>
  120. #endif
  121. #ifndef PRAGMAS_MUIMASTER_PRAGMAS_H
  122. #include <pragmas/muimaster_pragmas.h>
  123. #endif
  124. #ifndef PRAGMAS_UTILITY_PRAGMAS_H
  125. #include <pragmas/utility_pragmas.h>
  126. #endif
  127. #ifndef PRAGMAS_IFFPARSE_PRAGMAS_H
  128. #include <pragmas/iffparse_pragmas.h>
  129. #endif
  130. #endif    /*  _DCC  ||  __SASC  ||  __MAXON__  */
  131.  
  132. #ifdef __GNUC__
  133. #ifndef _INLINE_EXEC_H
  134. #include <inline/exec.h>
  135. #endif
  136. #ifndef _INLINE_DOS_H
  137. #include <inline/dos.h>
  138. #endif
  139. #ifndef _INLINE_INTUITION_H
  140. #include <inline/intuition.h>
  141. #endif
  142. #ifndef _INLINE_MUIMASTER_H
  143. #include <inline/muimaster.h>
  144. #endif
  145. #ifndef _INLINE_UTILITY_H
  146. #include <inline/utility.h>
  147. #endif
  148. #ifndef _INLINE_IFFPARSE_H
  149. #include <inline/iffparse.h>
  150. #endif
  151. #endif    /*  !__GNUC__            */
  152.  
  153. #include <stdlib.h>
  154. #include <string.h>
  155. #include <stdio.h>
  156. #include <time.h>
  157.  
  158. #else    /*  !AMIGA            */
  159. #include <stdio.h>
  160. #include <NonAmiga.h>
  161. #endif    /*  AMIGA            */
  162.  
  163.  
  164.  
  165. #define TRNFILENAME_LEN 512
  166. #define TRNNAME_LEN 60
  167.  
  168. #define TNMODEB_SWISS_PAIRING        0
  169. #define TNMODEB_ROUND_ROBIN        1
  170. #define TNMODEB_BUCHHOLZ        2
  171. #define TNMODEB_EXT_BUCHHOLZ        3
  172. #define TNMODEB_SONNEBORN_BERGER    4
  173. #define TNMODEB_SHIFT_SYSTEM        5
  174. #define TNMODEF_SWISS_PAIRING (1 << TNMODEB_SWISS_PAIRING)
  175. #define TNMODEF_ROUND_ROBIN (1 << TNMODEB_ROUND_ROBIN)
  176. #define TNMODEF_BUCHHOLZ (1 << TNMODEB_BUCHHOLZ)
  177. #define TNMODEF_EXT_BUCHHOLZ (1 << TNMODEB_EXT_BUCHHOLZ)
  178. #define TNMODEF_SONNEBORN_BERGER (1 << TNMODEB_SONNEBORN_BERGER)
  179. #define TNMODE_TABMASK (TNMODEF_BUCHHOLZ|TNMODEF_EXT_BUCHHOLZ| \
  180.             TNMODEF_SONNEBORN_BERGER)
  181. #define TNMODEF_SHIFT_SYSTEM (1 << TNMODEB_SHIFT_SYSTEM)
  182. #define SwissPairingTournament (TrnMode & TNMODEF_SWISS_PAIRING)
  183. #define RoundRobinTournament (TrnMode & TNMODEF_ROUND_ROBIN)
  184.  
  185.  
  186. /*
  187.     The struct Player holds all data of one participant.
  188. */
  189. #define NAMELEN 30
  190. #define BIRTHDAYLEN 10
  191. #define PHONENRLEN 20
  192. #define DWZLEN 10
  193. struct Player
  194.   { struct Node Tn_Node;        /*    This is used to build the alpha-
  195.                     betically sorted list of players.   */
  196.  
  197.     struct Player *LT_Succ;        /*    An internal list is builded when    */
  198.     struct Player *LT_Pred;        /*    pairing the games. These fields     */
  199.                     /*    are used for it.            */
  200.  
  201.     struct Player *RankNext;        /*    Next in list of internal rankings   */
  202.     struct Player *Opponent;        /*    Used for pairings            */
  203.     struct Player *Helpptr;        /*    Used for different things        */
  204.     struct Game *First_Game;        /*    List of games                */
  205.     int Flags;                /*    See below                */
  206.     short Nr;                /*    Used for pairings            */
  207.     short GFlags, BoardNr;        /*    Used for pairings            */
  208.     short Points, Buchholz;        /*    Points, Buchholzpoints and extended */
  209.     long  ExtBuchholz;            /*    Buchholzpoints                */
  210.     short HowMuchWhite;         /*    < 0 = Black; > 0 = White        */
  211.     short HowMuchWhiteLast;        /*    < 0 = Black; > 0 = White        */
  212.     short ELO;                /*    International ELO number        */
  213.     char DWZ[DWZLEN+1];         /*    German rating number            */
  214.     char Name[NAMELEN+1];        /*    Name and prename            */
  215.     char Street[NAMELEN+1];        /*    address                 */
  216.     char Village[NAMELEN+1];
  217.     char PhoneNr[PHONENRLEN+1];
  218.     char ChessClub[NAMELEN+1];        /*    Schachclub des Teilnehmers        */
  219.     char BirthDay[BIRTHDAYLEN+1];   /*    Geburtsdatum des Teilnehmers        */
  220.   };
  221. /*
  222.     Possible Flags in the player structure
  223. */
  224. #define TNFLAGSB_SENIOR 31
  225. #define TNFLAGSB_JUNIOR 30
  226. #define TNFLAGSB_WOMAN    29
  227. #define TNFLAGSB_JUNIORA 28
  228. #define TNFLAGSB_JUNIORB 27
  229. #define TNFLAGSB_JUNIORC 26
  230. #define TNFLAGSB_JUNIORD 25
  231. #define TNFLAGSB_JUNIORE 24
  232. #define TNFLAGSB_WITHDRAWN 0    /*  Player has withdrawn            */
  233. #define TNFLAGSB_HADFREE 1    /*  Player had a free round            */
  234. #define TNFLAGSB_NOTDOWN 2    /*  Internally used for pairings        */
  235. #define TNFLAGSB_SELECTED 3    /*  Internally used for player selections   */
  236. #define TNFLAGSF_SENIOR (1 << TNFLAGSB_SENIOR)
  237. #define TNFLAGSF_JUNIOR (1 << TNFLAGSB_JUNIOR)
  238. #define TNFLAGSF_WOMAN    (1 << TNFLAGSB_WOMAN)
  239. #define TNFLAGSF_JUNIORA (1 << TNFLAGSB_JUNIORA)
  240. #define TNFLAGSF_JUNIORB (1 << TNFLAGSB_JUNIORB)
  241. #define TNFLAGSF_JUNIORC (1 << TNFLAGSB_JUNIORC)
  242. #define TNFLAGSF_JUNIORD (1 << TNFLAGSB_JUNIORD)
  243. #define TNFLAGSF_JUNIORE (1 << TNFLAGSB_JUNIORE)
  244. #define TNFLAGSF_WITHDRAWN (1 << TNFLAGSB_WITHDRAWN)
  245. #define TNFLAGSF_HADFREE (1 << TNFLAGSB_HADFREE)
  246. #define TNFLAGSF_NOTDOWN (1 << TNFLAGSB_NOTDOWN)
  247. #define TNFLAGSF_SELECTED (1 << TNFLAGSB_SELECTED)
  248.  
  249.  
  250.  
  251. /*
  252.     The Game structure holds all data of one game. The games of one
  253.     participant build a linked list. Each game is therefore represented
  254.     by two game structures: One in the white players list and one in the
  255.     black players list.
  256. */
  257. struct Game
  258.   { struct Game *Next;        /*  Pointer to next game            */
  259.     struct Player *Opponent;    /*  Pointer to Opponent             */
  260.     short BoardNr;        /*  Board number                */
  261.     short Result;        /*  Result (-1 = Result is missing)         */
  262.     short Flags;        /*  See below                    */
  263.   };
  264. /*
  265.     Possible flags in the game structure
  266. */
  267. #define GMFLAGSB_NOFIGHT    0
  268. #define GMFLAGSB_POINTFORFREE    1
  269. #define GMFLAGSB_WITHDRAWN    2
  270. #define GMFLAGSB_WHITE        3
  271. #define GMFLAGSF_NOFIGHT (1 << GMFLAGSB_NOFIGHT)
  272. #define GMFLAGSF_POINTFORFREE (1 << GMFLAGSB_POINTFORFREE)
  273. #define GMFLAGSF_WITHDRAWN (1 << GMFL