home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume13 / gnuchess4 / part07 < prev    next >
Internet Message Format  |  1992-08-03  |  57KB

  1. Path: uunet!zephyr.ens.tek.com!master!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v13i095:  gnuchess4 - GNU Chess 4.0, Part07/12
  5. Message-ID: <3062@master.CNA.TEK.COM>
  6. Date: 19 Jun 92 15:54:34 GMT
  7. Sender: news@master.CNA.TEK.COM
  8. Lines: 2008
  9. Approved: billr@saab.CNA.TEK.COM
  10.  
  11. Submitted-by: cracraft@rice-chex.ai.mit.edu (Stuart Cracraft)
  12. Posting-number: Volume 13, Issue 95
  13. Archive-name: gnuchess4/Part07
  14. Supersedes: gnuchess2: Volume 4, Issue 37-40
  15. Environment: 
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 7 (of 12)."
  26. # Contents:  misc/ChessFont src/ataks.h src/nuxdsp.c test/test12
  27. # Wrapped by billr@saab on Fri Jun 19 08:36:01 1992
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. if test -f 'misc/ChessFont' -a "${1}" != "-c" ; then 
  30.   echo shar: Will not clobber existing file \"'misc/ChessFont'\"
  31. else
  32. echo shar: Extracting \"'misc/ChessFont'\" \(28062 characters\)
  33. sed "s/^X//" >'misc/ChessFont' <<'END_OF_FILE'
  34. X%!PS-Adobe-1.0
  35. X%% This is my font for chess and similar pieces.  It is supplied "as is".
  36. X%% It works for me, I have no idea whether it will work for you;  you gets
  37. X%% what you pays for.  Before using it, you should read the Copyright
  38. X%% notice below and the "README" file which should accompany this file.
  39. X%%    -- ANW, March 1991.
  40. X
  41. X/Cfont 9 dict dup begin
  42. X
  43. X/FontMatrix [ 0.001 0 0 0.001 0 0 ] readonly def
  44. X/FontType 3 def
  45. X/FontBBox [ 0 0 0 0 ] readonly def
  46. X/Encoding 256 array def
  47. X/FontInfo 3 dict dup begin
  48. X  /Notice (
  49. X
  50. X    Copyright (c) 1991 A. N. Walker.  All rights reserved.
  51. X
  52. X    This notice must be preserved in all versions of this file, and
  53. X    any alterations which you make must be clearly marked as such.
  54. X    For further information, see the "README" file which should
  55. X    accompany this, or contact me at Dept of Mathematics, Nottingham
  56. X    Univ., UK, anw@maths.nott.ac.uk.
  57. X
  58. X     ) readonly def
  59. X  /FullName (ChessFont) readonly def
  60. X  /version (2.0) readonly def
  61. Xend def
  62. X/UniqueID 472474 def
  63. X
  64. XEncoding
  65. X0 1 255 { 2 copy /.notdef put pop } for
  66. Xdup 8#040 /Wsquare put        % ' '
  67. Xdup 8#042 /flap put        % '"'
  68. Xdup 8#043 /board put        % '#'
  69. Xdup 8#047 /flip put        % ''''
  70. Xdup 8#052 /Bsquare put        % '*'
  71. Xdup 8#055 /edge put        % '-'
  72. Xdup 8#056 /blobfig put        % '.'
  73. Xdup 8#057 /corner put        % '/'
  74. Xdup 8#060 /m0 put        % '0'
  75. Xdup 8#061 /Wsquare put        % '1'
  76. Xdup 8#062 /m2 put        % '2'
  77. Xdup 8#063 /m3 put        % '3'
  78. Xdup 8#064 /m4 put        % '4'
  79. Xdup 8#065 /m5 put        % '5'
  80. Xdup 8#066 /m6 put        % '6'
  81. Xdup 8#067 /m7 put        % '7'
  82. Xdup 8#070 /m8 put        % '8'
  83. Xdup 8#071 /m9 put        % '9'
  84. Xdup 8#073 /nextline put        % ';'
  85. Xdup 8#074 /m-1 put        % '<'
  86. Xdup 8#076 /Wsquare put        % '>'
  87. Xdup 8#100 /wblock put        % '@'
  88. Xdup 8#102 /WB put        % 'B'
  89. Xdup 8#103 /WC put        % 'C'
  90. Xdup 8#104 /WD put        % 'D'
  91. Xdup 8#105 /WE put        % 'E'
  92. Xdup 8#106 /WF put        % 'F'
  93. Xdup 8#107 /WG put        % 'G'
  94. Xdup 8#111 /blob put        % 'I'
  95. Xdup 8#113 /WK put        % 'K'
  96. Xdup 8#114 /WL put        % 'L'
  97. Xdup 8#115 /WM put        % 'M'
  98. Xdup 8#116 /WN put        % 'N'
  99. Xdup 8#117 /BO put        % 'O'
  100. Xdup 8#120 /WP put        % 'P'
  101. Xdup 8#121 /WQ put        % 'Q'
  102. Xdup 8#122 /WR put        % 'R'
  103. Xdup 8#123 /WS put        % 'S'
  104. Xdup 8#124 /WT put        % 'T'
  105. Xdup 8#125 /WU put        % 'U'
  106. Xdup 8#126 /WV put        % 'V'
  107. Xdup 8#130 /WX put        % 'X'
  108. Xdup 8#132 /WZ put        % 'Z'
  109. Xdup 8#133 /posstart put        % '['
  110. Xdup 8#135 /posfinish put    % ']'
  111. Xdup 8#137 /underbar put        % '_'
  112. Xdup 8#142 /BB put        % 'b'
  113. Xdup 8#143 /BC put        % 'c'
  114. Xdup 8#144 /BD put        % 'd'
  115. Xdup 8#145 /BE put        % 'e'
  116. Xdup 8#146 /BF put        % 'f'
  117. Xdup 8#147 /BG put        % 'g'
  118. Xdup 8#151 /blob put        % 'i'
  119. Xdup 8#153 /BK put        % 'k'
  120. Xdup 8#154 /BL put        % 'l'
  121. Xdup 8#155 /BM put        % 'm'
  122. Xdup 8#156 /BN put        % 'n'
  123. Xdup 8#157 /BO put        % 'o'
  124. Xdup 8#160 /BP put        % 'p'
  125. Xdup 8#161 /BQ put        % 'q'
  126. Xdup 8#162 /BR put        % 'r'
  127. Xdup 8#163 /BS put        % 's'
  128. Xdup 8#164 /BT put        % 't'
  129. Xdup 8#165 /BU put        % 'u'
  130. Xdup 8#166 /BV put        % 'v'
  131. Xdup 8#170 /BX put        % 'x'
  132. Xdup 8#172 /BZ put        % 'z'
  133. Xdup 8#174 /sidebar put        % '|'
  134. Xdup 8#240 /Wsquare put        % ' '+
  135. Xdup 8#241 /without put        % '!'+
  136. Xdup 8#242 /flap put        % '"'+
  137. Xdup 8#243 /board put        % '#'+
  138. Xdup 8#245 /infinityequals put    % '%'+
  139. Xdup 8#247 /flip put        % ''''+
  140. Xdup 8#252 /circledot put    % '*'+
  141. Xdup 8#253 /plus put        % '+'+
  142. Xdup 8#255 /minus put        % '-'+
  143. Xdup 8#272 /doubled put        % ':'+
  144. Xdup 8#273 /nextline put        % ';'+
  145. Xdup 8#274 /equalsplus put    % '<'+
  146. Xdup 8#275 /equal put        % '='+
  147. Xdup 8#276 /plusequals put    % '>'+
  148. Xdup 8#277 /infinity put        % '?'+
  149. Xdup 8#300 /circarrow put    % '@'+
  150. Xdup 8#302 /Bfig put        % 'B'+
  151. Xdup 8#303 /Cfig put        % 'C'+
  152. Xdup 8#304 /Dfig put        % 'D'+
  153. Xdup 8#305 /Efig put        % 'E'+
  154. Xdup 8#306 /Ffig put        % 'F'+
  155. Xdup 8#307 /Gfig put        % 'G'+
  156. Xdup 8#311 /blobfig put        % 'I'+
  157. Xdup 8#313 /Kfig put        % 'K'+
  158. Xdup 8#314 /Lfig put        % 'L'+
  159. Xdup 8#315 /Mfig put        % 'M'+
  160. Xdup 8#316 /Nfig put        % 'N'+
  161. Xdup 8#317 /Ofig put        % 'O'+
  162. Xdup 8#320 /Pfig put        % 'P'+
  163. Xdup 8#321 /Qfig put        % 'Q'+
  164. Xdup 8#322 /Rfig put        % 'R'+
  165. Xdup 8#323 /Sfig put        % 'S'+
  166. Xdup 8#324 /Tfig put        % 'T'+
  167. Xdup 8#325 /Ufig put        % 'U'+
  168. Xdup 8#326 /Vfig put        % 'V'+
  169. Xdup 8#330 /Xfig put        % 'X'+
  170. Xdup 8#332 /Zfig put        % 'Z'+
  171. Xdup 8#333 /minusorplus put    % '['+
  172. Xdup 8#335 /plusorminus put    % ']'+
  173. Xdup 8#336 /uparrow put        % '^'+
  174. Xdup 8#341 /rightarrow put    % 'a'+
  175. Xdup 8#342 /semicircle put    % 'b'+
  176. Xdup 8#343 /centre put        % 'c'+
  177. Xdup 8#344 /diags put        % 'd'+
  178. Xdup 8#345 /etc put        % 'e'+
  179. Xdup 8#346 /Phalo put        % 'f'+
  180. Xdup 8#347 /samebs put        % 'g'+
  181. Xdup 8#350 /edgefig put        % 'h'+
  182. Xdup 8#351 /triangle put        % 'i'+
  183. Xdup 8#352 /Bsquarefig put    % 'j'+
  184. Xdup 8#353 /kside put        % 'k'+
  185. Xdup 8#354 /line put        % 'l'+
  186. Xdup 8#355 /hash put        % 'm'+
  187. Xdup 8#356 /cornerfig put    % 'n'+
  188. Xdup 8#357 /square put        % 'o'+
  189. Xdup 8#360 /ending put        % 'p'+
  190. Xdup 8#361 /qside put        % 'q'+
  191. Xdup 8#362 /Pfill put        % 'r'+
  192. Xdup 8#363 /separated put    % 's'+
  193. Xdup 8#364 /tempo put        % 't'+
  194. Xdup 8#365 /united put        % 'u'+
  195. Xdup 8#366 /oppbs put        % 'v'+
  196. Xdup 8#367 /with put        % 'w'+
  197. Xdup 8#370 /weakpt put        % 'x'+
  198. Xdup 8#371 /bpair put        % 'y'+
  199. Xdup 8#372 /circlebolddot put    % 'z'+
  200. X    8#374 /botharrow put    % '|'+
  201. X
  202. X/CharProcs 200 dict dup begin
  203. X
  204. X% Miscellaneous:
  205. X    /.notdef { } bind def
  206. X    /Arcto  { arcto 4 { pop } repeat } bind def
  207. X    /Ddn3c  { dup dup neg 3 copy } bind def
  208. X    /Round  { dtransform round exch round exch idtransform } bind def
  209. X    /Rlineto { Round rlineto } bind def
  210. X    /Rmoveto { Round rmoveto } bind def
  211. X    /diamond { moveto dup neg 0 rmoveto dup dup neg rlineto
  212. X        dup dup rlineto dup neg exch rlineto closepath } bind def
  213. X    /dohalo { gsave 100 setlinewidth setW stroke grestore } bind def
  214. X    /dofill { gsave fill grestore } bind def
  215. X    /motion { 1000 mul exch 1000 mul exch setcharwidth } bind def
  216. X    /setW    { 1 setgray } bind def
  217. X    /setB    { 0 setgray } bind def
  218. X    /drawingB { 0 currentgray eq } bind def
  219. X    /setfig { 1000 0 0 -200 1000 800 setcachedevice 500 300 translate
  220. X        } bind def
  221. X    /setpce { 1000 0 setcharwidth 500 dup translate 0.95 dup scale
  222. X        } bind def
  223. X    /MiscStr (a) def
  224. X    /tofig  { 0 get 8#200 add MiscStr exch 0 exch put MiscStr } bind def
  225. X    /Tofig  { 1 0.95 div dup scale tofig } bind def
  226. X    /intext true def
  227. X    /flip    { 0 0 setcharwidth /intext intext not def } bind def
  228. X    /flap    { 0 0 setcharwidth /intext true def } bind def
  229. X    /Setfont { /ChessFont findfont 1000 scalefont setfont } bind def
  230. X    /Show    { rotate -500 dup moveto Setfont show } bind def
  231. X    /Showfig { rotate -500 -300 moveto Setfont show } bind def
  232. X    /LocStr (a) def
  233. X    /SetChar {
  234. X        dup 8#047 eq { pop flip stop } if
  235. X        dup 8#200 lt { intext {
  236. X            8#200 add LocStr exch 0 exch put
  237. X            Setfont LocStr dup stringwidth setcharwidth
  238. X            0 0 moveto show stop } if } if } bind def
  239. X    /DoChar { Encoding exch get cvx exec } bind def
  240. X
  241. X% Kings
  242. X    /WK {    setpce Kout dohalo setW dofill setB stroke Kin } bind def
  243. X    /BK {    setpce Kout dohalo dofill stroke setW Kin } bind def
  244. X    /Kfig { setfig Kout stroke Kin } bind def
  245. X
  246. X    /Kout {    2 setmiterlimit
  247. X        325 -100 moveto 600 100 350 400 125 250 curveto
  248. X        0 250 rlineto -250 0 rlineto 0 -250 rlineto
  249. X        -350 400 -600 100 -325 -100 curveto 0 -250 rlineto
  250. X        -100 -500 100 -500 325 -350 curveto closepath
  251. X        30 setlinewidth } bind def
  252. X    /Kin {    drawingB { 325 } { 275 } ifelse
  253. X        Ddn3c -350 moveto 0 -300 3 -1 roll -350 800 Arcto
  254. X        -350 lineto -100 moveto 0 -50 3 -1 roll
  255. X        -100 800 Arcto -100 lineto
  256. X        15 0 -185 diamond 15 -250 -210 diamond 15 250 -210 diamond
  257. X        drawingB { 125 } { 75 } ifelse
  258. X        Ddn3c dup dup 4 { 0 375 moveto rlineto } repeat
  259. X        drawingB { 0 -45 moveto 125 250 lineto -250 0 rlineto
  260. X            closepath } { 15 0 180 diamond 265 -95 moveto
  261. X            480 150 280 380 50 -50 curveto -265 -95 moveto
  262. X            -480 150 -280 380 -50 -50 curveto } ifelse
  263. X        stroke } bind def
  264. X
  265. X% Queens
  266. X    /WQ {    setpce Qout dohalo setW dofill setB stroke Qin } bind def
  267. X    /BQ {    setpce Qout dohalo dofill stroke setW Qin } bind def
  268. X    /Qfig { setfig Qout stroke Qin } bind def
  269. X
  270. X    /Qout {    2 setmiterlimit
  271. X        0 75 moveto -150 440 50 -80 280 arc -250 25 lineto
  272. X        -440 200 50 -60 300 arc -325 -100 lineto 0 -250 rlineto
  273. X        -100 -500 100 -500 325 -350 curveto 0 250 rlineto
  274. X        440 200 50 -120 240 arc 250 25 lineto 150 440 50 -100 260 arc
  275. X        closepath 30 setlinewidth } bind def
  276. X    /Qin {    drawingB { 325 } { 275 } ifelse
  277. X        Ddn3c -350 moveto 0 -300 3 -1 roll -350 800 Arcto -350 lineto
  278. X        -100 moveto 0 -50 3 -1 roll -100 800 Arcto -100 lineto
  279. X        15 0 -185 diamond 15 -250 -210 diamond 15 250 -210 diamond
  280. X        stroke } bind def
  281. X
  282. X% Rooks
  283. X    /WR {    setpce Rout dohalo setW dofill setB stroke Rin } bind def
  284. X    /BR {    setpce Rout dohalo dofill stroke setW Rin } bind def
  285. X    /Rfig { setfig Rout stroke Rin } bind def
  286. X
  287. X    /Rout { -325 -450 moveto 650 0 rlineto 0 50 rlineto -100 175 rlineto
  288. X        0 400 rlineto 50 75 rlineto 0 150 rlineto -86 0 rlineto
  289. X        -30 -100 rlineto -86 0 rlineto -30 100 rlineto -86 0 rlineto
  290. X        -30 -100 rlineto -86 0 rlineto -30 100 rlineto -86 0 rlineto
  291. X        0 -150 rlineto 50 -75 rlineto 0 -400 rlineto -100 -175 rlineto
  292. X        closepath 30 setlinewidth } bind def
  293. X    /Rin {    drawingB { -225 } { -195 } ifelse
  294. X        dup -225 moveto dup -2 mul 0 rlineto
  295. X        dup 175 moveto -2 mul 0 rlineto stroke } bind def
  296. X
  297. X% Bishops
  298. X    /WB {    Bsetpce Bout setW dofill setB stroke Bin } bind def
  299. X    /BB {    Bsetpce Bout dofill stroke setW Bin } bind def
  300. X    /Bfig { Bsetfig Bout stroke Bin } bind def
  301. X
  302. X    /Bsetpce { /Binpce true def setpce } bind def
  303. X    /Bsetfig { /Binpce false def setfig } bind def
  304. X    /Bout {    2 setmiterlimit
  305. X        -400 -500 moveto 100 100 300 0 400 100 rcurveto
  306. X        100 -100 300 0 400 -100 rcurveto 0 100 rlineto
  307. X        -100 100 -300 0 -400 100 rcurveto
  308. X        -100 -100 -300 0 -400 -100 rcurveto closepath
  309. X        200 -350 moveto 0 200 rlineto
  310. X        200 0 150 215 0 325 curveto -75 420 40 -90 270 arc
  311. X        -340 100 -340 100 -200 -150 curveto 0 -200 rlineto
  312. X        200 50 rlineto closepath 30 setlinewidth
  313. X        gsave    0 325 moveto 150 215 200 0 200 -150 curveto
  314. X            340 100 340 100 75 380 curveto 75 420 40 -90 270 arc
  315. X            closepath Binpce { dohalo setW dofill setB } if stroke
  316. X        grestore } bind def
  317. X    /Bin {  15 0 -225 diamond
  318. X        drawingB { 200 } { 150 } ifelse Ddn3c
  319. X        -350 moveto 20 rlineto -20 rlineto -150 moveto
  320. X        30 rlineto -30 rlineto stroke } bind def
  321. X
  322. X% Knights
  323. X    /WN {    setpce Nout dohalo setW dofill setB stroke Nin } bind def
  324. X    /BN {    setpce Nout dohalo dofill stroke setW Nin } bind def
  325. X    /Nfig { setfig Nout stroke Nin } bind def
  326. X
  327. X    /Nout {    2 setmiterlimit
  328. X        450 -450 moveto 450 200 150 350 -50 400 curveto
  329. X        -25 100 rlineto -75 -200 rlineto -75 150 rlineto
  330. X        0 -150 rlineto -125 -125 -325 -400 -275 -450 rcurveto
  331. X        75 -75 rlineto 100 130 rlineto 0 -200 rlineto
  332. X        50 -25 150 100 100 150 rcurveto 50 -50 150 75 125 150 rcurveto
  333. X        125 -300 -250 -250 -250 -450 curveto
  334. X        closepath 30 setlinewidth } bind def
  335. X    /Nin {  15 -200 150 diamond stroke
  336. X        drawingB {
  337. X            [ 100 100 ] 0 setdash 410 -450 moveto
  338. X            410 200 130 330 -60 380 curveto 50 setlinewidth
  339. X            stroke } {
  340. X            430 -430 moveto 430 200 150 350 -30 370 curveto
  341. X            150 250 390 200 390 -430 curveto fill }
  342. X        ifelse } bind def
  343. X
  344. X% Pawns
  345. X    % Pawns are the only symbols which occur "frequently" in a chess
  346. X    % diagram, so we make a special effort to optimise their caching
  347. X    % behaviour.  Also, they are the only symbols for which this is
  348. X    % easy!
  349. X
  350. X    /WP { setpce Setfont setW 0 0 moveto (f) tofig show setB (P) tofig
  351. X        -500 -300 rmoveto show } bind def
  352. X    /BP { setpce Setfont setW 0 0 moveto (f) tofig show setB (r) tofig
  353. X        show } bind def
  354. X    /Pfig { setfig Pout stroke Pin } bind def
  355. X
  356. X    /Pout { 300 -450 moveto 200 -300  200 -300 75 -250 curveto
  357. X        125 -50 125 -50 75 150 curveto 125 150 100 0 90 arc
  358. X        0 300 100 -30 210 arc -125 150 100 90 180 arc
  359. X        150 0 rlineto -125 -50 -125 -50 -75 -250 curveto
  360. X        -200 -300 -200 -300 -300 -450 curveto
  361. X        closepath 50 setlinewidth } bind def
  362. X    /Pin { -75 150 moveto 150 0 rlineto stroke } bind def
  363. X
  364. X    /Phalo { 0 0 -350 -500 350 450 setcachedevice
  365. X        Pout gsave 100 setlinewidth stroke grestore fill } bind def
  366. X    /Pfill { 0 0 -325 -475 375 425 setcachedevice
  367. X        Pout gsave stroke grestore fill } bind def
  368. X
  369. X% Fous
  370. X    % There seem to be several styles of Fou (French Bishop) -- I have
  371. X    % selected the easiest to implement.  Anyone who *really* wants
  372. X    % this piece can do some work for themselves!
  373. X
  374. X    /WF {    setpce Fout dohalo setW dofill setB stroke Fin } bind def
  375. X    /BF {    setpce Fout dohalo dofill stroke setW Fin } bind def
  376. X    /Ffig { setfig Fout stroke Fin } bind def
  377. X
  378. X    /Fout { 2 setlinejoin
  379. X        -300 -400 moveto 150 300 rlineto -250 500 rlineto
  380. X        250 -125 rlineto 150 175 rlineto 150 -175 rlineto
  381. X        250 125 rlineto -250 -500 rlineto 150 -300 rlineto
  382. X        closepath 30 setlinewidth } bind def
  383. X
  384. X    /Fin {  0 -400 150 dup mul 675 dup mul add sqrt
  385. X        drawingB { 600 300 } { 30 sub 600 270 } ifelse
  386. X        atan dup 180 sub neg arc
  387. X        400 drawingB not { 15 5 sqrt mul add } if
  388. X        dup neg 400 moveto dup dup -2 mul rlineto dup 2 mul rlineto
  389. X        30 -100 150 diamond 30 100 150 diamond
  390. X        0 175 moveto 0 -200 rlineto currentpoint stroke
  391. X        75 210 330 arc stroke } bind def
  392. X
  393. X% Miscellaneous Fairy pieces
  394. X
  395. X    % Grasshopper
  396. X    /WG {    setpce (Q) 180 Show } bind def
  397. X    /BG {    setpce (q) 180 Show } bind def
  398. X    /Gfig { setfig (Q) tofig 180 Showfig } bind def
  399. X
  400. X    % Nightrider.  Real problemists use S for Knight and N for Nightrider;
  401. X    %        the weight of tradition forces N for Knight, hence S here.
  402. X    /WS {    setpce (N) 180 Show } bind def
  403. X    /BS {    setpce (n) 180 Show } bind def
  404. X    /Sfig { setfig (N) tofig 180 Showfig } bind def
  405. X
  406. X    % Zebra
  407. X    /WZ {    setpce (N) -90 Show } bind def
  408. X    /BZ {    setpce (n) -90 Show } bind def
  409. X    /Zfig { setfig (N) tofig -90 Showfig } bind def
  410. X
  411. X    % Mao.  Also Camel, but C is for Chameleon.
  412. X    /WM {    setpce (N) 90 Show } bind def
  413. X    /BM {    setpce (n) 90 Show } bind def
  414. X    /Mfig { setfig (N) tofig 90 Showfig } bind def
  415. X
  416. X    % Vao
  417. X    /WV {    setpce (B) 90 Show } bind def
  418. X    /BV {    setpce (b) 90 Show } bind def
  419. X    /Vfig { setfig (B) tofig 90 Showfig } bind def
  420. X
  421. X    % Equihopper
  422. X    /WE {    setpce (Q) -90 Show } bind def
  423. X    /BE {    setpce (q) -90 Show } bind def
  424. X    /Efig { setfig (Q) tofig -90 Showfig } bind def
  425. X
  426. X    % Leo.  Also Locust, Lion, Edgehog
  427. X    /WL {    setpce (Q) 90 Show } bind def
  428. X    /BL {    setpce (q) 90 Show } bind def
  429. X    /Lfig { setfig (Q) tofig 90 Showfig } bind def
  430. X
  431. X    % Pao.  Also Empress.  Sorry, all Uther mnemonics seemed to be used Up.
  432. X    /WU {    setpce (R) 90 Show } bind def
  433. X    /BU {    setpce (r) 90 Show } bind def
  434. X    /Ufig { setfig (R) tofig 90 Showfig } bind def
  435. X
  436. X    % Orphan -- NB, all Orphans are black!
  437. X    /BO {    setpce (p) 90 Show } bind def
  438. X    /Ofig { setfig 90 rotate Pout dofill stroke } bind def
  439. X
  440. X    % Rose.  Gardeners will know why T is mnemonic for this.
  441. X    /WT {    setpce Tout dohalo setW dofill setB stroke Tin } bind def
  442. X    /BT {    setpce Tout dohalo dofill stroke setW Tin } bind def
  443. X    /Tfig { setfig Tout stroke Tin } bind def
  444. X
  445. X    /Tout { 300 2 sqrt 1 sub mul
  446. X        8 { dup 300 exch dup -90 135 arc 45 rotate } repeat
  447. X        pop 50 setlinewidth } bind def
  448. X    /Tin {  drawingB { 270 } { 300 } ifelse
  449. X        8 { dup 0 0 moveto 0 lineto 45 rotate } repeat
  450. X        pop stroke } bind def
  451. X
  452. X    % Chameleon
  453. X    /WC {    setpce Cout dohalo setW dofill setB stroke } bind def
  454. X    /BC {    setpce Cout dohalo dofill stroke } bind def
  455. X    /Cfig { setfig Cout stroke } bind def
  456. X
  457. X    /Cout { 2 setmiterlimit 50 setlinewidth
  458. X        -250 -350 moveto 500 0 rlineto -500 700 rlineto
  459. X        500 0 rlineto closepath } bind def
  460. X
  461. X    % Blob [for marking squares], also for Imitator
  462. X    /blob { setpce 0 0 250 0 360 arc dohalo dofill } bind def
  463. X    /blobfig { setfig 0 200 250 0 360 arc dofill } bind def
  464. X
  465. X% Draughts/Dame/Checkers pieces
  466. X
  467. X    % Man
  468. X    /WD {    setpce Dout dohalo setW dofill setB stroke Din } bind def
  469. X    /BD {    setpce Dout dohalo dofill stroke setW Din } bind def
  470. X    /Dfig { setfig Dout stroke Din } bind def
  471. X
  472. X    /Dout { 1 0.5 scale 0 0 350 0 180 arc 0 -400 350 180 0 arc
  473. X        closepath 50 setlinewidth } bind def
  474. X    /Din {  0 0 350 drawingB { 180 0 } { 210 -30 20 setlinewidth }
  475. X        ifelse arc stroke 20 setlinewidth 0 0 220 0 360 arc stroke
  476. X        0 0 80 0 360 arc stroke } bind def
  477. X
  478. X    % King.  The mnemonic for this is unknown.
  479. X    /WX {    setpce Xout dohalo setW dofill setB stroke Xin } bind def
  480. X    /BX {    setpce Xout dohalo dofill stroke setW Xin } bind def
  481. X    /Xfig { setfig Xout stroke Xin } bind def
  482. X
  483. X    /Xout { 1 0.5 scale 0 400 350 0 180 arc 0 -400 350 180 0 arc
  484. X        closepath 50 setlinewidth } bind def
  485. X    /Xin {  0 400 350 drawingB { 180 0 } { 210 -30 20 setlinewidth }
  486. X        ifelse arc stroke 0 0 350 drawingB { 180 0 } { 210 -30 }
  487. X        ifelse arc stroke 20 setlinewidth 0 400 220 0 360 arc stroke
  488. X        0 400 80 0 360 arc stroke } bind def
  489. X
  490. X% Board symbols
  491. X
  492. X    /Wsquare { 1 0 motion } bind def
  493. X    /Bsquare { setpce (j) Tofig 90 Show } bind def
  494. X    /Bsquarefig { 1000 0 0 0 1000 1000 setcachedevice
  495. X        /xpix 62.5 dup dtransform /ypix exch def def
  496. X        /xpabs xpix abs def /ypabs ypix abs def
  497. X        xpabs ypabs lt {
  498. X            ypabs ceiling dup 4 lt { pop 4 } if
  499. X            dup ypix div xpix mul exch } {
  500. X            xpabs ceiling dup 4 lt { pop 4 } if
  501. X            dup xpix div ypix mul } ifelse
  502. X        idtransform pop abs dup 3 div setlinewidth dup 2 mul 2000
  503. X        { dup 1000 lt { dup 0 moveto 0 exch lineto }
  504. X            { 1000 sub dup 1000 moveto 1000 exch lineto }
  505. X            ifelse } for stroke } bind def
  506. X    /board { 10000 0 800 0 9200 8400 setcachedevice
  507. X%        Setfont intext /intext dup true def 1000 8200 moveto
  508. X%        4 { (hhhhhhhhn) show currentpoint translate -90 rotate } repeat
  509. X%        -90 rotate 0 7000 moveto
  510. X%    The above was the intention, but the borders sometimes fail to match
  511. X%    up by a pixel or two.  Hence the following!  However, the borders
  512. X%    work perfectly well for special purposes.
  513. X        Setfont intext /intext dup true def
  514. X        20 setlinewidth 940 140 moveto 8120 0 Rlineto 0 8120 Rlineto
  515. X        -8120 0 Rlineto closepath stroke
  516. X        80 setlinewidth 840 40 moveto 8320 0 Rlineto 0 8320 Rlineto
  517. X        -8320 0 Rlineto closepath stroke
  518. X        2000 200 moveto 90 rotate
  519. X        4 { (j j j j ; j j j j;) show } repeat exch def } bind def
  520. X    /nextline { -8 -1 motion } bind def
  521. X    /edge { setpce (h) Tofig 0 Show } bind def
  522. X    /edgefig { 1000 0 0 0 1000 200 setcachedevice
  523. X        20 setlinewidth 0 60 moveto 1000 0 rlineto stroke
  524. X        80 setlinewidth 0 160 moveto 1000 0 rlineto stroke } bind def
  525. X    /corner { setpce (n) Tofig 0 Show } bind def
  526. X    /cornerfig { 0 0 0 0 200 200 setcachedevice
  527. X        20 setlinewidth 0 60 moveto 60 0 rlineto 0 -60 rlineto stroke
  528. X        80 setlinewidth 0 160 moveto 160 0 rlineto 0 -160 rlineto
  529. X        stroke } bind def
  530. X    /posstart { -9 7.2 motion } bind def
  531. X    /posfinish { 1 -0.2 motion } bind def
  532. X    /m0 { 0.5 dup motion } bind def
  533. X    /m2 { 2 0 motion } bind def
  534. X    /m3 { 3 0 motion } bind def
  535. X    /m4 { 4 0 motion } bind def
  536. X    /m5 { 5 0 motion } bind def
  537. X    /m6 { 6 0 motion } bind def
  538. X    /m7 { 7 0 motion } bind def
  539. X    /m8 { 8 0 motion } bind def
  540. X    /m9 { 0 1 motion } bind def
  541. X    /m-1 { -1 0 motion } bind def
  542. X    /underbar { 1000 0 -40 -40 1040 40 setcachedevice 80 setlinewidth
  543. X        1 setlinecap 0 0 moveto 1000 0 lineto stroke } bind def
  544. X    /sidebar { 0 0 setcharwidth 80 setlinewidth
  545. X        1 setlinecap 0 0 moveto 0 1000 lineto stroke } bind def
  546. X    /wblock { 0 0 setcharwidth setW
  547. X        200 200 moveto 600 0 rlineto 0 600 rlineto -600 0 rlineto
  548. X        fill } bind def
  549. X
  550. X% Informant symbols
  551. X
  552. X    /plusequals { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  553. X        100 10 moveto 800 0 rlineto 0 140 Rmoveto -800 0 rlineto
  554. X        0 300 Rmoveto 800 0 rlineto 500 150 moveto 0 650 rlineto
  555. X        stroke } bind def
  556. X
  557. X    /equalsplus { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  558. X        100 790 moveto 800 0 rlineto 0 -140 Rmoveto -800 0 rlineto
  559. X        0 -300 Rmoveto 800 0 rlineto 500 0 moveto 0 650 rlineto
  560. X        stroke } bind def
  561. X
  562. X    /plusorminus { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  563. X        100 15 moveto 800 0 rlineto 0 385 Rmoveto -800 0 rlineto
  564. X        500 0 moveto 0 800 rlineto stroke } bind def
  565. X
  566. X    /minusorplus { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  567. X        100 785 moveto 800 0 rlineto 0 -385 Rmoveto -800 0 rlineto
  568. X        500 0 moveto 0 800 rlineto stroke } bind def
  569. X
  570. X    /plus { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  571. X        100 400 moveto 800 0 rlineto 500 0 moveto 0 800 rlineto
  572. X        stroke } bind def
  573. X
  574. X    /minus { 1000 0 100 385 900 415 setcachedevice 30 setlinewidth
  575. X        100 400 moveto 800 0 rlineto stroke } bind def
  576. X
  577. X    /equal { 1000 0 100 300 800 180 Round
  578. X        320 add exch 100 add exch setcachedevice 20 setlinewidth
  579. X        100 310 moveto 800 0 rlineto 0 180 Rmoveto -800 0 rlineto
  580. X        stroke } bind def
  581. X
  582. X    /infinity { 1000 0 95 60 905 540 setcachedevice 40 setlinewidth
  583. X        275 300 160 0 360 arc 660 300 225 -180 180 arc stroke
  584. X        } bind def
  585. X
  586. X    /infinityequals { 1000 0 95 10 905 750 setcachedevice 30 setlinewidth
  587. X        275 250 160 0 360 arc 660 250 225 -180 180 arc
  588. X        100 565 moveto 800 0 rlineto 0 180 Rmoveto -800 0 rlineto
  589. X        stroke } bind def
  590. X
  591. X    /circarrow {1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  592. X        500 400 385 0 30 arcn -200 0 rmoveto 200 0 rlineto
  593. X        0 200 rlineto stroke } bind def
  594. X
  595. X    /circledot { 900 0 100 0 800 700 setcachedevice 20 setlinewidth
  596. X        450 350 20 0 360 arc fill 450 350 340 0 360 arc stroke
  597. X        } bind def
  598. X
  599. X    /rightarrow { 1200 0 100 185 1115 615 setcachedevice 30 setlinewidth
  600. X        100 400 moveto 1000 0 rlineto -200 -200 rmoveto 200 200 rlineto
  601. X        -200 200 rlineto stroke } bind def
  602. X
  603. X    /uparrow { 500 0 35 0 465 915 setcachedevice 30 setlinewidth
  604. X        250 0 moveto 0 900 rlineto -200 -200 rmoveto 200 200 rlineto
  605. X        200 -200 rlineto stroke } bind def
  606. X
  607. X    /botharrow { 1200 0 100 70 1100 730 setcachedevice 20 setlinewidth
  608. X        100 280 moveto 990 0 rlineto -200 -200 rmoveto 200 200 rlineto
  609. X        -200 200 rlineto 1100 520 moveto -990 0 rlineto
  610. X        200 -200 rmoveto -200 200 rlineto 200 200 rlineto
  611. X        stroke } bind def
  612. X
  613. X    /circlebolddot { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  614. X        500 400 50 0 360 arc fill 500 400 390 0 360 arc stroke
  615. X        } bind def
  616. X
  617. X    /hash { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  618. X        100 280 moveto 800 0 rlineto 0 240 Rmoveto -800 0 rlineto
  619. X        380 0 moveto 0 800 rlineto 240 0 Rmoveto 0 -800 rlineto
  620. X        stroke } bind def
  621. X
  622. X    /triangle { 900 0 100 0 800 750 setcachedevice 30 setlinewidth
  623. X        100 15 moveto 350 735 rlineto 350 -735 rlineto
  624. X        closepath stroke } bind def
  625. X
  626. X    /square { 900 0 100 0 680 680 Round
  627. X        20 add exch 120 add exch setcachedevice 20 setlinewidth
  628. X        110 10 moveto 680 0 Rlineto 0 680 Rlineto
  629. X        -680 0 Rlineto closepath stroke } bind def
  630. X
  631. X    /semicircle { 1000 0 50 0 950 465 setcachedevice 30 setlinewidth
  632. X        500 15 435 0 180 arc closepath stroke } bind def
  633. X
  634. X    /line { 1000 0 100 190 900 610 setcachedevice 20 setlinewidth
  635. X        220 300 moveto 560 0 rlineto 0 200 Rmoveto -560 0 rlineto
  636. X        310 200 moveto -200 200 rlineto 200 200 rlineto
  637. X        690 200 moveto 200 200 rlineto -200 200 rlineto
  638. X        stroke } bind def
  639. X
  640. X    /diags { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  641. X        110 120 moveto 670 dup rlineto 110 -110 Rmoveto
  642. X        -670 dup rlineto 640 790 moveto 250 0 rlineto
  643. X        0 -250 rlineto stroke } bind def
  644. X
  645. X    /centre { 1000 0 100 0 780 780 Round
  646. X        20 add exch 120 add exch setcachedevice 20 setlinewidth
  647. X        110 10 moveto 780 0 Rlineto 0 780 Rlineto -780 0 Rlineto
  648. X        closepath 110 400 moveto 780 0 rlineto 500 10 moveto
  649. X        0 780 Rlineto stroke } bind def
  650. X
  651. X    /kside { 700 0 100 0 600 800 setcachedevice 20 setlinewidth
  652. X        110 10 moveto 300 390 rlineto -300 390 rlineto
  653. X        180 0 Rmoveto 300 -390 rlineto -300 -390 rlineto
  654. X        stroke } bind def
  655. X
  656. X    /qside { 700 0 100 0 600 800 setcachedevice 20 setlinewidth
  657. X        590 10 moveto -300 390 rlineto 300 390 rlineto
  658. X        -180 0 Rmoveto -300 -390 rlineto 300 -390 rlineto
  659. X        stroke } bind def
  660. X
  661. X    /weakpt { 700 0 100 0 600 500 setcachedevice 30 setlinewidth
  662. X        110 10 moveto 480 480 rlineto 590 10 moveto -480 480 rlineto
  663. X        stroke } bind def
  664. X
  665. X    /ending { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  666. X        100 15 moveto 800 0 rlineto 500 0 moveto 0 800 rlineto
  667. X        stroke } bind def
  668. X
  669. X    /bpair { 1200 0 100 0 980 580 Round
  670. X        20 add exch 120 add exch setcachedevice 20 setlinewidth
  671. X        110 10 moveto 570 0 Rlineto 0 370 Rlineto -570 0 Rlineto
  672. X        closepath 110 10 moveto 980 580 Rmoveto -570 0 Rlineto
  673. X        0 -370 Rlineto 570 0 Rlineto closepath stroke } bind def
  674. X
  675. X    /oppbs { 1200 0 100 0 1100 600 setcachedevice 20 setlinewidth
  676. X        110 10 moveto 570 0 Rlineto 0 370 Rlineto -570 0 Rlineto
  677. X        closepath stroke 1100 600 moveto -590 0 rlineto
  678. X        0 -390 rlineto 590 0 rlineto fill } bind def
  679. X
  680. X    /samebs { 1200 0 100 0 1100 600 setcachedevice
  681. X        100 0 moveto 590 0 rlineto 0 390 rlineto -590 0 rlineto
  682. X        closepath 1100 600 moveto -590 0 rlineto 0 -390 rlineto
  683. X        590 0 rlineto fill } bind def
  684. X
  685. X    /united { 1210 0 50 0 1160 530 setcachedevice 30 setlinewidth
  686. X        315 265 250 0 360 arc stroke 895 265 250 0 360 arc
  687. X        stroke } bind def
  688. X
  689. X    /separated { 1550 0 50 0 1500 530 setcachedevice 30 setlinewidth
  690. X        315 265 250 0 360 arc stroke 1235 265 250 0 360 arc stroke
  691. X        665 30 60 0 360 arc fill 885 30 60 0 360 arc fill } bind def
  692. X
  693. X    /doubled { 730 0 100 0 630 1160 setcachedevice 30 setlinewidth
  694. X        365 265 250 0 360 arc stroke 365 895 250 0 360 arc
  695. X        stroke } bind def
  696. X
  697. X    /tempo { 1000 0 100 0 900 800 setcachedevice 20 setlinewidth
  698. X        110 400 moveto 500 400 390 0 360 arc 500 10 moveto
  699. X        0 790 rlineto stroke } bind def
  700. X
  701. X    /with { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  702. X        100 800 moveto 0 -785 rlineto 785 0 rlineto stroke } bind def
  703. X
  704. X    /without { 1000 0 100 0 900 800 setcachedevice 30 setlinewidth
  705. X        100 15 moveto 785 0 rlineto 0 785 rlineto stroke } bind def
  706. X
  707. X    /etc { 500 0 100 0 270 800 Round
  708. X        exch 130 add exch setcachedevice 30 setlinewidth
  709. X        115 0 moveto 0 800 rlineto 270 0 Rmoveto 0 -800 rlineto
  710. X        stroke } bind def
  711. Xend def
  712. X
  713. X/BuildChar { exch begin CharProcs begin
  714. X    { SetChar } stopped not { DoChar } if
  715. X    end end } bind def
  716. Xend def
  717. X
  718. X/ChessFont Cfont definefont pop
  719. X% Demo file to be appended to the Chess Font file & sent to your LaserWriter
  720. X%    (or whatever else you do with PostScript!).
  721. X
  722. X% Miscellaneous useful procedures:
  723. X
  724. X    % show string centred on the current point
  725. X/cshow { dup stringwidth -2 div exch -2 div exch rmoveto show } bind def
  726. X
  727. X    % Draw rank and file labels round a standard diagram
  728. X    %   On entry, the ChessFont must be currently selected,
  729. X    %   and the (properly scaled) font desired for the labels
  730. X    %   must be top of stack.  Uses "cshow", defined above
  731. X/dolabels {
  732. X    ('[<0) show            % position of top-left label
  733. X    (0) stringwidth -1.5 div    % 1/3-square offset
  734. X    0 exch rmoveto exch        % restore labelfont to top of stack
  735. X    [(8)(7)(6)(5)(4)(3)(2)(1)]    % rank labels
  736. X    { gsave exch            % stack == offset, label, labelfont
  737. X        dup setfont exch cshow
  738. X      grestore
  739. X      (8;) show            % move down a rank
  740. X    } forall
  741. X    [(a)(b)(c)(d)(e)(f)(g)(h)]    % file labels
  742. X    { (>) show            % move along a file
  743. X      gsave exch            % as before
  744. X        dup setfont exch cshow
  745. X      grestore
  746. X    } forall pop            % zap the labelfont
  747. X    (0]') show            % move to RHS of board
  748. X    1.5 div 0 exch rmoveto        % undo previous offset
  749. X} bind def
  750. X
  751. X    % Rotate a piece.  The piece [eg "(Q)"] and the desired rotation
  752. X    %   (in degrees, anticlockwise) should be on the stack
  753. X/twirl {
  754. X    gsave            % keep graphics state
  755. X        (0) show    % go to centre of square
  756. X        rotate        % no of degrees was on stack
  757. X        (07;) show    % back to bottom left of rotated square --
  758. X                % "0" takes us from centre to top right, "7"
  759. X                % advances 7 squares, ";" goes down one and
  760. X                % back 8
  761. X        show        % string was on stack
  762. X    grestore        % restore graphics state
  763. X    ( ) show        % advance to next square
  764. X} bind def
  765. X
  766. X    % Draw a neutral piece (for Fairy chess).  Expects two strings
  767. X    %   [eg. "(R) (r)"] on the stack;  the first will be drawn in
  768. X    %   the left half of the square, the second in the right half.
  769. X/neutral {
  770. X    2 dict begin            % small dictionary for xinc, yinc
  771. X    gsave                % keep graphics state
  772. X        (0) stringwidth        % distance to centre of square
  773. X        /yinc exch 2 mul def
  774. X        /xinc exch def
  775. X        currentpoint
  776. X        xinc 0 rlineto        % draw clipping rectangle round
  777. X        0 yinc rlineto        % left half of square
  778. X        xinc neg 0 rlineto clip
  779. X        moveto show        % show left half-piece
  780. X    grestore gsave            % cancel clip
  781. X        currentpoint
  782. X        xinc 0 rmoveto
  783. X        xinc 0 rlineto        % clip right half of square
  784. X        0 yinc rlineto
  785. X        xinc neg 0 rlineto clip
  786. X        moveto show        % show right half-piece
  787. X    grestore            % restore graphics state
  788. X    ( ) show            % advance to next square
  789. X    end                % close small dictionary
  790. X} bind def
  791. X
  792. X% End of generally useful procedures.
  793. X
  794. X% Quick hack definitions for this file:
  795. X
  796. X% Miscellaneous definitions:
  797. X
  798. X/ps 10.5 def        % point size
  799. X/vs 12.5 def        % vertical spacing
  800. X/V 11 72 mul def    % top margin
  801. X/L 40 def        % left margin
  802. X
  803. X/N { L V vs sub dup /V exch def moveto } bind def    % newline
  804. X/T { currentpoint exch L sub 6 add 36 div ceiling 36 mul L add exch moveto }
  805. X    bind def    % tab
  806. X
  807. X    % Switch into Chess/Times/Courier/Bold
  808. X/C { /ChessFont findfont ps scalefont setfont } bind def
  809. X/R { /Times-Roman findfont ps scalefont setfont } bind def
  810. X/H { /Courier findfont ps scalefont setfont } bind def
  811. X/B { /Times-Bold findfont ps 1.25 mul scalefont setfont } bind def
  812. X
  813. X    12345        % pseudo-random item on stack, as check
  814. END_OF_FILE
  815. if test 28062 -ne `wc -c <'misc/ChessFont'`; then
  816.     echo shar: \"'misc/ChessFont'\" unpacked with wrong size!
  817. fi
  818. # end of 'misc/ChessFont'
  819. fi
  820. if test -f 'src/ataks.h' -a "${1}" != "-c" ; then 
  821.   echo shar: Will not clobber existing file \"'src/ataks.h'\"
  822. else
  823. echo shar: Extracting \"'src/ataks.h'\" \(2354 characters\)
  824. sed "s/^X//" >'src/ataks.h' <<'END_OF_FILE'
  825. X/*
  826. X * ataks.h - Header source for GNU CHESS
  827. X *
  828. X * Copyright (c) 1988,1989,1990 John Stanback
  829. X * Copyright (c) 1992 Free Software Foundation
  830. X *
  831. X * This file is part of GNU CHESS.
  832. X *
  833. X * GNU Chess is free software; you can redistribute it and/or modify
  834. X * it under the terms of the GNU General Public License as published by
  835. X * the Free Software Foundation; either version 2, or (at your option)
  836. X * any later version.
  837. X *
  838. X * GNU Chess is distributed in the hope that it will be useful,
  839. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  840. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  841. X * GNU General Public License for more details.
  842. X *
  843. X * You should have received a copy of the GNU General Public License
  844. X * along with GNU Chess; see the file COPYING.  If not, write to
  845. X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  846. X */
  847. Xinline
  848. Xstatic
  849. Xint
  850. XSqAtakd (register short int sq, short int side)
  851. X
  852. X/*
  853. X * See if any piece with color 'side' ataks sq.  First check pawns then
  854. X * Queen, Bishop, Rook and King and last Knight.
  855. X */
  856. X
  857. X{
  858. X  register short u;
  859. X  register unsigned char *ppos, *pdir;
  860. X  short xside;
  861. X
  862. X  xside = side ^ 1;
  863. X  pdir = nextdir[ptype[xside][pawn]][sq];
  864. X  u = pdir[sq];            /* follow captures thread */
  865. X  if (u != sq)
  866. X    {
  867. X      if (board[u] == pawn && color[u] == side)
  868. X    return (true);
  869. X      u = pdir[u];
  870. X      if (u != sq && board[u] == pawn && color[u] == side)
  871. X    return (true);
  872. X    }
  873. X  /* king capture */
  874. X  if (distance (sq, PieceList[side][0]) == 1)
  875. X    return (true);
  876. X  /* try a queen bishop capture */
  877. X  ppos = nextpos[bishop][sq];
  878. X  pdir = nextdir[bishop][sq];
  879. X  u = ppos[sq];
  880. X  do
  881. X    {
  882. X      if (color[u] == neutral)
  883. X    u = ppos[u];
  884. X      else
  885. X    {
  886. X      if (color[u] == side && (board[u] == queen || board[u] == bishop))
  887. X        return (true);
  888. X      u = pdir[u];
  889. X    }
  890. X  } while (u != sq);
  891. X  /* try a queen rook capture */
  892. X  ppos = nextpos[rook][sq];
  893. X  pdir = nextdir[rook][sq];
  894. X  u = ppos[sq];
  895. X  do
  896. X    {
  897. X      if (color[u] == neutral)
  898. X    u = ppos[u];
  899. X      else
  900. X    {
  901. X      if (color[u] == side && (board[u] == queen || board[u] == rook))
  902. X        return (true);
  903. X      u = pdir[u];
  904. X    }
  905. X  } while (u != sq);
  906. X  /* try a knight capture */
  907. X  pdir = nextdir[knight][sq];
  908. X  u = pdir[sq];
  909. X  do
  910. X    {
  911. X      if (color[u] == side && board[u] == knight)
  912. X    return (true);
  913. X      u = pdir[u];
  914. X  } while (u != sq);
  915. X  return (false);
  916. X}
  917. END_OF_FILE
  918. if test 2354 -ne `wc -c <'src/ataks.h'`; then
  919.     echo shar: \"'src/ataks.h'\" unpacked with wrong size!
  920. fi
  921. # end of 'src/ataks.h'
  922. fi
  923. if test -f 'src/nuxdsp.c' -a "${1}" != "-c" ; then 
  924.   echo shar: Will not clobber existing file \"'src/nuxdsp.c'\"
  925. else
  926. echo shar: Extracting \"'src/nuxdsp.c'\" \(20989 characters\)
  927. sed "s/^X//" >'src/nuxdsp.c' <<'END_OF_FILE'
  928. X/*
  929. X * nuxdsp.c - (new)  ALPHA interface for CHESS
  930. X *
  931. X * Copyright (c) 1988,1989,1990 John Stanback
  932. X * Copyright (c) 1992 Free Software Foundation
  933. X *
  934. X * This file is part of GNU CHESS.
  935. X *
  936. X * GNU Chess is free software; you can redistribute it and/or modify
  937. X * it under the terms of the GNU General Public License as published by
  938. X * the Free Software Foundation; either version 2, or (at your option)
  939. X * any later version.
  940. X *
  941. X * GNU Chess is distributed in the hope that it will be useful,
  942. X * but WITHOUT ANY WARRANTY; without even the implied warranty of
  943. X * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  944. X * GNU General Public License for more details.
  945. X *
  946. X * You should have received a copy of the GNU General Public License
  947. X * along with GNU Chess; see the file COPYING.  If not, write to
  948. X * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  949. X */
  950. X#include <ctype.h>
  951. X#include <signal.h>
  952. X#ifdef MSDOS
  953. X#include <dos.h>
  954. X#include <conio.h>
  955. X#include <stdlib.h>
  956. X#include <string.h>
  957. X#include <time.h>
  958. X
  959. X#define ESC 0x1B
  960. X#define refresh() fflush(stdout)
  961. X
  962. Xint mycntl1, mycntl2;
  963. Xstatic void param (short n);
  964. X
  965. X#else
  966. X#include <sys/param.h>
  967. X#include <sys/types.h>
  968. X#include <sys/file.h>
  969. X#include <curses.h>
  970. X
  971. X/* <stdlib.h> */
  972. Xextern void *malloc (size_t);
  973. Xextern void exit (int);
  974. Xextern short int sscore[];
  975. X
  976. X/* <string.h> */
  977. Xextern char *strcat (char *, const char *);
  978. Xextern int strcmp (const char *, const char *);
  979. Xextern char *strcpy (char *, const char *);
  980. X
  981. X/* <time.h> */
  982. Xextern long int time (long int *);
  983. X
  984. X#endif /* MSDOS */
  985. X
  986. X#include "gnuchess.h"
  987. X
  988. Xextern short int pscore[2];
  989. X
  990. X#define TAB (43)
  991. X/* coordinates within a square for the following are ([1,5],[1,3]) */
  992. X#define SQW (5)
  993. X#define SQH (3)
  994. X#define VIR_C(s)  ((flag.reverse) ? 7-column(s) : column(s))
  995. X#define VIR_R(s)  ((flag.reverse) ? 7-row(s) : row(s))
  996. X#define VSQ_X(x)  ((flag.reverse) ? SQW + 1 - (x) : (x))
  997. X#define VSQ_Y(y)  ((flag.reverse) ? SQH + 1 - (y) : (y))
  998. X#define Vblack(s) (!((VIR_C(s) + VIR_R(s)) % 2))
  999. X/* Squares swapped */
  1000. X#define Vcoord(s,x,y) \
  1001. X    ((SQW)*(VIR_C(s)))+(x),((SQH)*(7-VIR_R(s))+(y))
  1002. X/* Squares and internal locations swapped */
  1003. X#define VcoordI(s,x,y) \
  1004. X    ((SQW)*(VIR_C(s)))+(VSQ_X(x)),((SQH)*(7-VIR_R(s))+(VSQ_Y(y)))
  1005. X/* Squares and internal rows swapped */
  1006. X#define VcoordR(s,x,y) \
  1007. X    ((SQW)*(VIR_C(s)))+(x),((SQH)*(7-VIR_R(s))+(VSQ_Y(y)))
  1008. Xchar Analysis[128] = "";
  1009. Xunsigned short int MV[MAXDEPTH];
  1010. Xint MSCORE;
  1011. Xchar *DRAW;
  1012. Xchar mvstr[4][6];
  1013. Xshort PositionFlag = 0;
  1014. X
  1015. X#if defined(MSDOS) && !defined(SEVENBIT)
  1016. Xstatic void ONormal (void);
  1017. Xstatic void OReverse (void);
  1018. X
  1019. X#endif /* MSDOS && !SEVENBIT */
  1020. X
  1021. Xextern char *getenv (const char *);
  1022. Xvoid TerminateSearch (int), Die (int);
  1023. X
  1024. Xvoid
  1025. XInitialize (void)
  1026. X{
  1027. X  signal (SIGINT, Die);
  1028. X#ifndef MSDOS
  1029. X  signal (SIGQUIT, Die);
  1030. X  initscr ();
  1031. X  crmode ();
  1032. X#else
  1033. X  mycntl1 = mycntl2 = 0;
  1034. X#endif /* MSDOS */
  1035. X}
  1036. X
  1037. Xvoid
  1038. XExitChess (void)
  1039. X{
  1040. X  ListGame ();
  1041. X  gotoXY (1, 24);
  1042. X#ifndef MSDOS
  1043. X  nocrmode ();
  1044. X  endwin ();
  1045. X#endif /* MSDOS */
  1046. X  exit (0);
  1047. X}
  1048. X
  1049. Xvoid
  1050. XDie (int Sig)
  1051. X{
  1052. X  char s[80];
  1053. X
  1054. X  signal (SIGINT, SIG_IGN);
  1055. X#ifdef MSDOS
  1056. X  Sig++;            /* shut up the compiler */
  1057. X#else
  1058. X  signal (SIGQUIT, SIG_IGN);
  1059. X#endif /* MSDOS */
  1060. X  ShowMessage (CP[31]);        /*Abort?*/
  1061. X  scanz ("%s", s);
  1062. X  if (strcmp (s, CP[210]) == 0)    /*yes*/
  1063. X    ExitChess ();
  1064. X  signal (SIGINT, Die);
  1065. X#ifndef MSDOS
  1066. X  signal (SIGQUIT, Die);
  1067. X#endif /* MSDOS */
  1068. X}
  1069. X
  1070. Xvoid
  1071. XTerminateSearch (int Sig)
  1072. X{
  1073. X  signal (SIGINT, SIG_IGN);
  1074. X#ifdef MSDOS
  1075. X  Sig++;            /* shut up the compiler */
  1076. X#else
  1077. X  signal (SIGQUIT, SIG_IGN);
  1078. X#endif /* MSDOS */
  1079. X  if (!flag.timeout)
  1080. X    flag.musttimeout = true;
  1081. X  flag.bothsides = false;
  1082. X  signal (SIGINT, Die);
  1083. X#ifndef MSDOS
  1084. X  signal (SIGQUIT, Die);
  1085. X#endif /* MSDOS */
  1086. X}
  1087. Xvoid
  1088. XShowLine (short unsigned int *bstline)
  1089. X{
  1090. X}
  1091. X
  1092. Xvoid
  1093. Xhelp (void)
  1094. X{
  1095. X  ClrScreen ();
  1096. X  /*printz ("CHESS command summary\n");*/
  1097. X  printz (CP[40]);
  1098. X  printz ("----------------------------------------------------------------\n");
  1099. X  /*printz ("g1f3      move from g1 to f3      quit      Exit Chess\n");*/
  1100. X  printz (CP[158]);
  1101. X  /*printz ("Nf3       move knight to f3       beep      turn %s\n", (flag.beep) ? "off" : "on");*/
  1102. X  printz (CP[86]);
  1103. X  /*printz ("a7a8q     promote pawn to queen\n");*/
  1104. X  printz (CP[128], (flag.material) ? CP[92] : CP[93]);
  1105. X  /*printz ("o-o       castle king side        easy      turn %s\n", (flag.easy) ? "off" : "on");*/
  1106. X  printz (CP[173], (flag.easy) ? CP[92] : CP[93]);
  1107. X  /*printz ("o-o-o     castle queen side       hash      turn %s\n", (flag.hash) ? "off" : "on");*/
  1108. X  printz (CP[174], (flag.hash) ? CP[92] : CP[93]);
  1109. X  /*printz ("bd        redraw board            reverse   board display\n");*/
  1110. X  printz (CP[130]);
  1111. X  /*printz ("list      game to chess.lst       book      turn %s used %d of %d\n", (Book) ? "off" : "on", bookcount, BOOKSIZE);*/
  1112. X  printz (CP[170], (Book) ? CP[92] : CP[93], bookcount, BOOKSIZE);
  1113. X  /*printz ("undo      undo last ply           remove    take back a move\n");*/
  1114. X  printz (CP[200]);
  1115. X  /*printz ("edit      edit board              force     enter game moves\n");*/
  1116. X  printz (CP[153]);
  1117. X  /*printz ("switch    sides with computer     both      computer match\n");*/
  1118. X  printz (CP[194]);
  1119. X  /*printz ("white     computer plays white    black     computer plays black\n");*/
  1120. X  printz (CP[202]);
  1121. X  /*printz ("depth     set search depth        clock     set time control\n");*/
  1122. X  printz (CP[149]);
  1123. X  /*printz ("hint      suggest a move         post      turn %s principle variation\n", (flag.post) ? "off" : "on");*/
  1124. X  printz (CP[177], (flag.post) ? CP[92] : CP[93]);
  1125. X  /*printz ("save      game to file            get       game from file\n");*/
  1126. X  printz (CP[188]);
  1127. X  /*printz ("random    randomize play          new       start new game\n");*/
  1128. X  printz (CP[181]);
  1129. X  /*printz ("coords    show coords            rv        reverse video\n");*/
  1130. X  printz (CP[144]);
  1131. X#if !defined(MSDOS) || defined(SEVENBIT)
  1132. X  printz (CP[192]);
  1133. X#endif /* !MSDOS || SEVENBIT */
  1134. X  gotoXY (10, 20);
  1135. X  printz (CP[47], ColorStr[computer]);
  1136. X  gotoXY (10, 21);
  1137. X  printz (CP[97], ColorStr[opponent]);
  1138. X  gotoXY (10, 22);
  1139. X  printz (CP[79], Level);
  1140. X  gotoXY (10, 23);
  1141. X  printz (CP[59], (flag.easy) ? CP[93] : CP[92]);
  1142. X  gotoXY (40, 20);
  1143. X  printz (CP[52], MaxSearchDepth);
  1144. X  gotoXY (40, 21);
  1145. X  printz (CP[100], (dither) ? CP[93] : CP[92]);
  1146. X  gotoXY (40, 22);
  1147. X  printz (CP[112], (flag.hash) ? CP[93] : CP[92]);
  1148. X  gotoXY (40, 23);
  1149. X  printz (CP[73]);
  1150. X  gotoXY (10, 24);
  1151. X  printz (CP[110], (TCflag) ? CP[93] : CP[92],
  1152. X      TimeControl.moves[white], TimeControl.clock[white] / 100, OperatorTime, MaxSearchDepth);
  1153. X  refresh ();
  1154. X  fflush (stdin);
  1155. X  getchar ();
  1156. X  ClrScreen ();
  1157. X  UpdateDisplay (0, 0, 1, 0);
  1158. X}
  1159. X
  1160. Xvoid
  1161. XEditBoard (void)
  1162. X
  1163. X/*
  1164. X * Set up a board position. Pieces are entered by typing the piece followed
  1165. X * by the location. For example, Nf3 will place a knight on square f3.
  1166. X */
  1167. X
  1168. X{
  1169. X  short a, r, c, sq, i;
  1170. X  char s[80];
  1171. X
  1172. X  flag.regularstart = false;
  1173. X  Book = false;
  1174. X  ClrScreen ();
  1175. X  UpdateDisplay (0, 0, 1, 0);
  1176. X  gotoXY (TAB, 3);
  1177. X  printz (CP[29]);
  1178. X  gotoXY (TAB, 4);
  1179. X  printz (CP[28]);
  1180. X  gotoXY (TAB, 5);
  1181. X  printz (CP[136]);
  1182. X  gotoXY (TAB, 7);
  1183. X  printz (CP[64]);
  1184. X  a = white;
  1185. X  do
  1186. X    {
  1187. X      gotoXY (TAB, 6);
  1188. X      printz (CP[60], ColorStr[a]);    /*Editing %s*/
  1189. X      gotoXY (TAB + 24, 7);
  1190. X      ClrEoln ();
  1191. X      scanz ("%s", s);
  1192. X      if (s[0] == CP[28][0])    /*#*/
  1193. X    {
  1194. X      for (sq = 0; sq < 64; sq++)
  1195. X        {
  1196. X          board[sq] = no_piece;
  1197. X          color[sq] = neutral;
  1198. X          DrawPiece (sq);
  1199. X        }
  1200. X    }
  1201. X      if (s[0] == CP[136][0])    /*c*/
  1202. X    a = otherside[a];
  1203. X      c = s[1] - 'a';
  1204. X      r = s[2] - '1';
  1205. X      if ((c >= 0) && (c < 8) && (r >= 0) && (r < 8))
  1206. X    {
  1207. X      sq = locn (r, c);
  1208. X      for (i = king; i > no_piece; i--)
  1209. X        if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
  1210. X          break;
  1211. X      board[sq] = i;
  1212. X      color[sq] = ((board[sq] == no_piece) ? neutral : a);
  1213. X      DrawPiece (sq);
  1214. X    }
  1215. X  } while (s[0] != CP[29][0]);
  1216. X
  1217. X  for (sq = 0; sq < 64; sq++)
  1218. X    Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);
  1219. X  GameCnt = 0;
  1220. X  Game50 = 1;
  1221. X  ZeroRPT ();
  1222. X  Sdepth = 0;
  1223. X  InitializeStats ();
  1224. X  ClrScreen ();
  1225. X  UpdateDisplay (0, 0, 1, 0);
  1226. X}
  1227. X
  1228. Xvoid
  1229. XShowPlayers (void)
  1230. X{
  1231. X  gotoXY (TAB, ((flag.reverse) ? 23 : 2));
  1232. X  printz ("%s", (computer == black) ? CP[218] : CP[74]);
  1233. X  gotoXY (TAB, ((flag.reverse) ? 2 : 23));
  1234. X  printz ("%s", (computer == white) ? CP[218] : CP[74]);
  1235. X}
  1236. X
  1237. Xvoid
  1238. XShowDepth (char ch)
  1239. X{
  1240. X  gotoXY (TAB, 4);
  1241. X  printz (CP[53], Sdepth, ch);    /*Depth= %d%c*/
  1242. X  ClrEoln ();
  1243. X}
  1244. X
  1245. Xvoid
  1246. XShowScore (short score)
  1247. X{
  1248. X  gotoXY (TAB, 5);
  1249. X  printz (CP[104], score);
  1250. X  ClrEoln ();
  1251. X}
  1252. X
  1253. Xvoid
  1254. XShowMessage (char *s)
  1255. X{
  1256. X  gotoXY (TAB, 6);
  1257. X  printz ("%s", s);
  1258. X  ClrEoln ();
  1259. X}
  1260. X
  1261. Xvoid
  1262. XClearMessage (void)
  1263. X{
  1264. X  gotoXY (TAB, 6);
  1265. X  ClrEoln ();
  1266. X}
  1267. X
  1268. Xvoid
  1269. XShowCurrentMove (short int pnt, short int f, short int t)
  1270. X{
  1271. X  algbr (f, t, false);
  1272. X  gotoXY (TAB, 7);
  1273. X  printz ("(%2d) %4s", pnt, mvstr[0]);
  1274. X}
  1275. X
  1276. Xvoid
  1277. XShowHeader (void)
  1278. X{
  1279. X  gotoXY (TAB, 10);
  1280. X#ifdef MSDOS
  1281. X  printz (CP[67]);
  1282. X#else
  1283. X  printz (CP[68]);
  1284. X#endif /* MSDOS */
  1285. X}
  1286. X
  1287. Xvoid
  1288. XShowSidetoMove (void)
  1289. X{
  1290. X  gotoXY (TAB, 14);
  1291. X  printz ("%2d:   %s", 1 + GameCnt / 2, ColorStr[player]);
  1292. X  ClrEoln ();
  1293. X}
  1294. X
  1295. Xvoid
  1296. XShowPrompt (void)
  1297. X{
  1298. X  gotoXY (TAB, 19);
  1299. X  printz (CP[121]);        /*Your movwe is?*/
  1300. X  ClrEoln ();
  1301. X}
  1302. X
  1303. Xvoid
  1304. XShowNodeCnt (long int NodeCnt)
  1305. X{
  1306. X  gotoXY (TAB, 21);
  1307. X  printz (CP[90], NodeCnt, (et > 100) ? NodeCnt / (et / 100) : 0);
  1308. X  ClrEoln ();
  1309. X}
  1310. X
  1311. Xvoid
  1312. XShowResults (short int score, short unsigned int *bstline, char ch)
  1313. X{
  1314. X  unsigned char d, ply;
  1315. X
  1316. X  if (flag.post)
  1317. X    {
  1318. X      ShowDepth (ch);
  1319. X      ShowScore (score);
  1320. X      d = 7;
  1321. X      for (ply = 1; bstline[ply] > 0; ply++)
  1322. X    {
  1323. X      if (ply % 4 == 1)
  1324. X        {
  1325. X          gotoXY (TAB, ++d);
  1326. X          ClrEoln ();
  1327. X        }
  1328. X      algbr ((short) bstline[ply] >> 8, (short) bstline[ply] & 0xFF, false);
  1329. X      printz ("%5s ", mvstr[0]);
  1330. X    }
  1331. X      ClrEoln ();
  1332. X      while (d < 13)
  1333. X    {
  1334. X      gotoXY (TAB, ++d);
  1335. X      ClrEoln ();
  1336. X    }
  1337. X    }
  1338. X}
  1339. X
  1340. Xvoid
  1341. XSearchStartStuff (short int side)
  1342. X{
  1343. X  short i;
  1344. X
  1345. X  signal (SIGINT, TerminateSearch);
  1346. X#ifdef MSDOS
  1347. X  side++;            /* shut up the compiler */
  1348. X#else
  1349. X  signal (SIGQUIT, TerminateSearch);
  1350. X#endif /* MSDOS */
  1351. X  for (i = 4; i < 14; i++)
  1352. X    {
  1353. X      gotoXY (TAB, i);
  1354. X      ClrEoln ();
  1355. X    }
  1356. X}
  1357. X
  1358. Xvoid
  1359. XOutputMove (void)
  1360. X{
  1361. X  register int i;
  1362. X
  1363. X  UpdateDisplay (rootnode.f, rootnode.t, 0, (short) rootnode.flags);
  1364. X  gotoXY (TAB, 17);
  1365. X  printz (CP[84], mvstr[0]);    /*My move is %s*/
  1366. X  if (flag.beep)
  1367. X    putchar (7);
  1368. X  ClrEoln ();
  1369. X
  1370. X  gotoXY (TAB, 24);
  1371. X  if (rootnode.flags & draw)
  1372. X    printz (CP[56], DRAW);
  1373. X  else if (rootnode.score == -9999)
  1374. X    printz (CP[95]);
  1375. X  else if (rootnode.score == 9998)
  1376. X    printz (CP[44]);
  1377. X#ifdef VERYBUGGY
  1378. X  else if (rootnode.score < -9000)
  1379. X    printz (CP[96]);
  1380. X  else if (rootnode.score > 9000)
  1381. X    printz (CP[45]);
  1382. X#endif VERYBUGGY
  1383. X  ClrEoln ();
  1384. X
  1385. X  if (flag.post)
  1386. X    {
  1387. X      register short h, l, t;
  1388. X
  1389. X      h = TREE;
  1390. X      l = 0;
  1391. X      t = TREE >> 1;
  1392. X      while (l != t)
  1393. X    {
  1394. X      if (Tree[t].f || Tree[t].t)
  1395. X        l = t;
  1396. X      else
  1397. X        h = t;
  1398. X      t = (l + h) >> 1;
  1399. X    }
  1400. X
  1401. X
  1402. X      ShowNodeCnt (NodeCnt);
  1403. X      gotoXY (TAB, 22);
  1404. X
  1405. X      printz (CP[81], t);    /*Max Tree= %d*/
  1406. X      ClrEoln ();
  1407. X    }
  1408. X}
  1409. X
  1410. Xvoid
  1411. XUpdateClocks (void)
  1412. X{
  1413. X  short m, s;
  1414. X
  1415. X  m = (short) (et / 6000);
  1416. X  s = (short) (et - 6000 * (long) m) / 100;
  1417. X  if (TCflag)
  1418. X    {
  1419. X      m = (short) ((TimeControl.clock[player] - et) / 6000);
  1420. X      s = (short) ((TimeControl.clock[player] - et - 6000 * (long) m) / 100);
  1421. X    }
  1422. X  if (m < 0)
  1423. X    m = 0;
  1424. X  if (s < 0)
  1425. X    s = 0;
  1426. X  if (player == white)
  1427. X    gotoXY (60, (flag.reverse) ? 2 : 23);
  1428. X  else
  1429. X    gotoXY (60, (flag.reverse) ? 23 : 2);
  1430. X  printz ("%d:%02d   ", m, s);
  1431. X  if (flag.post)
  1432. X    ShowNodeCnt (NodeCnt);
  1433. X  refresh ();
  1434. X}
  1435. X
  1436. Xvoid
  1437. XgotoXY (short int x, short int y)
  1438. X{
  1439. X#ifdef MSDOS
  1440. X  putchar (ESC);
  1441. X  putchar ('[');
  1442. X  param (y);
  1443. X  putchar (';');
  1444. X  param (x);
  1445. X  putchar ('H');
  1446. X#else
  1447. X  move (y - 1, x - 1);
  1448. X#endif /* MSDOS */
  1449. X}
  1450. X
  1451. Xvoid
  1452. XClrScreen (void)
  1453. X{
  1454. X#ifdef MSDOS
  1455. X  putchar (ESC);
  1456. X  putchar ('[');
  1457. X  putchar ('2');
  1458. X  putchar ('J');
  1459. X#else
  1460. X  clear ();
  1461. X#endif /* MSDOS */
  1462. X  refresh ();
  1463. X}
  1464. X
  1465. Xvoid
  1466. XClrEoln (void)
  1467. X{
  1468. X#ifdef MSDOS
  1469. X  putchar (ESC);
  1470. X  putchar ('[');
  1471. X  putchar ('K');
  1472. X#else
  1473. X  clrtoeol ();
  1474. X#endif /* MSDOS */
  1475. X  refresh ();
  1476. X}
  1477. X
  1478. X#ifdef MSDOS
  1479. Xvoid
  1480. Xparam (short n)
  1481. X{
  1482. X  if (n >= 10)
  1483. X    {
  1484. X      register short d, q;
  1485. X
  1486. X      q = n / 10;
  1487. X      d = n % 10;
  1488. X      putchar (q + '0');
  1489. X      putchar (d + '0');
  1490. X    }
  1491. X  else
  1492. X    putchar (n + '0');
  1493. X}
  1494. X
  1495. X#endif /* MSDOS */
  1496. X
  1497. Xvoid
  1498. XOReverse ()
  1499. X{
  1500. X#ifdef MSDOS
  1501. X  putchar (ESC);
  1502. X  putchar ('[');
  1503. X  param (7);
  1504. X  putchar ('m');
  1505. X#else
  1506. X  standout ();
  1507. X  /* attron (A_REVERSE); */
  1508. X#endif /* MSDOS */
  1509. X}
  1510. X
  1511. Xvoid
  1512. XONormal ()
  1513. X{
  1514. X#ifdef MSDOS
  1515. X  putchar (ESC);
  1516. X  putchar ('[');
  1517. X  param (0);
  1518. X  putchar ('m');
  1519. X#else
  1520. X  standend ();
  1521. X  /* attroff (A_REVERSE); */
  1522. X#endif /* MSDOS */
  1523. X}
  1524. X
  1525. Xvoid
  1526. XDrawPiece (short int sq)
  1527. X{
  1528. X  gotoXY (VcoordR (sq, 2, 2));
  1529. X
  1530. X  switch (color[sq])
  1531. X    {
  1532. X    case black:
  1533. X      if (flag.rv)
  1534. X    OReverse ();
  1535. X#if defined(MSDOS) && !defined(SEVENBIT)
  1536. X      printz (" %c ", pxx[board[sq]]);
  1537. X#else
  1538. X      printz ((flag.stars ? "*%c*" : " %c "), pxx[board[sq]]);
  1539. X#endif /* MSDOS && !SEVENBIT */
  1540. X      ONormal ();
  1541. X      break;
  1542. X    case neutral:
  1543. X#if defined(MSDOS) && !defined(SEVENBIT)
  1544. X      if (flag.rv)
  1545. X    printz (Vblack (sq) ? "\262\262\262" : "\260\260\260");
  1546. X      else
  1547. X    printz (Vblack (sq) ? "\260\260\260" : "\262\262\262");
  1548. X#else
  1549. X      if (flag.shade)
  1550. X    printz (Vblack (sq) ? "///" : "   ");
  1551. X      else
  1552. X    {
  1553. X      if (Vblack (sq))
  1554. X        OReverse ();
  1555. X      printz ("   ");
  1556. X      ONormal ();
  1557. X    }
  1558. X#endif /* MSDOS && !SEVENBIT */
  1559. X      break;
  1560. X    case white:
  1561. X#if defined(MSDOS) && !defined(SEVENBIT)
  1562. X      if (!flag.rv)
  1563. X    OReverse ();
  1564. X      printz (" %c ", pxx[board[sq]]);
  1565. X      ONormal ();
  1566. X#else
  1567. X      printz (" %c ", pxx[board[sq]]);
  1568. X#endif /* MSDOS && !SEVENBIT */
  1569. X      break;
  1570. X    default:
  1571. X      ShowMessage (CP[55]);    /*Draw piece color[sq] err*/
  1572. X      break;
  1573. X    }
  1574. X}
  1575. X
  1576. Xvoid
  1577. XDrawSquare (short int sq)
  1578. X{
  1579. X#if defined(MSDOS) && !defined(SEVENBIT)
  1580. X  if (flag.rv)
  1581. X    {
  1582. X      gotoXY (Vcoord (sq, 1, 1));
  1583. X      printz (Vblack (sq) ? "\262\262\262\262\262" : "\260\260\260\260\260");
  1584. X      gotoXY (Vcoord (sq, 1, 2));
  1585. X      printz (Vblack (sq) ? "\262\262\262\262\262" : "\260\260\260\260\260");
  1586. X      gotoXY (Vcoord (sq, 1, 3));
  1587. X      printz (Vblack (sq) ? "\262\262\262\262\262" : "\260\260\260\260\260");
  1588. X    }
  1589. X  else
  1590. X    {
  1591. X      gotoXY (Vcoord (sq, 1, 1));
  1592. X      printz (Vblack (sq) ? "\260\260\260\260\260" : "\262\262\262\262\262");
  1593. X      gotoXY (Vcoord (sq, 1, 2));
  1594. X      printz (Vblack (sq) ? "\260\260\260\260\260" : "\262\262\262\262\262");
  1595. X      gotoXY (Vcoord (sq, 1, 3));
  1596. X      printz (Vblack (sq) ? "\260\260\260\260\260" : "\262\262\262\262\262");
  1597. X    }
  1598. X#else
  1599. X  if (flag.shade)
  1600. X    {
  1601. X      gotoXY (Vcoord (sq, 1, 1));
  1602. X      printz (Vblack (sq) ? "/////" : "     ");
  1603. X      gotoXY (Vcoord (sq, 1, 2));
  1604. X      printz (Vblack (sq) ? "/////" : "     ");
  1605. X      gotoXY (Vcoord (sq, 1, 3));
  1606. X      printz (Vblack (sq) ? "/////" : "     ");
  1607. X    }
  1608. X  else
  1609. X    {
  1610. X      if (Vblack (sq))
  1611. X    OReverse ();
  1612. X      gotoXY (Vcoord (sq, 1, 1));
  1613. X      printz ("     ");
  1614. X      gotoXY (Vcoord (sq, 1, 2));
  1615. X      printz ("     ");
  1616. X      gotoXY (Vcoord (sq, 1, 3));
  1617. X      printz ("     ");
  1618. X      ONormal ();
  1619. X    }
  1620. X#endif /* MSDOS && !SEVENBIT */
  1621. X}
  1622. X
  1623. Xvoid
  1624. XDrawCoords (void)
  1625. X{
  1626. X  short z;
  1627. X
  1628. X  for (z = 0; z <= 7; z++)
  1629. X    {
  1630. X      short sq;
  1631. X
  1632. X      sq = z << 3;
  1633. X      gotoXY (VcoordI (sq, 1, 1));
  1634. X#if !defined(MSDOS) || defined(SEVENBIT)
  1635. X      if ((Vblack (sq) || flag.shade) && flag.rv)
  1636. X#endif /* !MSDOS || SEVENBIT */
  1637. X    OReverse ();
  1638. X      printz ("%d", 1 + z);
  1639. X      ONormal ();
  1640. X    }
  1641. X
  1642. X  for (z = 0; z <= 7; z++)
  1643. X    {
  1644. X      short sq;
  1645. X
  1646. X      sq = z;
  1647. X      gotoXY (VcoordI (sq, SQW, SQH));
  1648. X#if !defined(MSDOS) || defined(SEVENBIT)
  1649. X      if ((Vblack (sq) || flag.shade) && flag.rv)
  1650. X#endif /* !MSDOS || SEVENBIT */
  1651. X    OReverse ();
  1652. X      printz ("%c", cxx[z]);
  1653. X      ONormal ();
  1654. X    }
  1655. X
  1656. X#if !defined(MSDOS) || defined(SEVENBIT)
  1657. X  for (z = 1; z <= (8 * SQH); z++)
  1658. X    {
  1659. X      gotoXY ((8 * SQW) + 1, z);
  1660. X      printz ("|");
  1661. X    }
  1662. X#endif /* MSDOS && !SEVENBIT */
  1663. X}
  1664. X
  1665. Xvoid
  1666. XShowPostnValue (short int sq)
  1667. X
  1668. X/*
  1669. X * must have called ExaminePosition() first
  1670. X */
  1671. X
  1672. X{
  1673. X  short score;
  1674. X
  1675. X  gotoXY (VcoordR (sq, 2, 1));
  1676. X  score = ScorePosition (color[sq]);
  1677. X#if !defined(MSDOS) || defined(SEVENBIT)
  1678. X  if (Vblack (sq) && !flag.shade)
  1679. X    OReverse ();
  1680. X#endif /* !MSDOS || SEVENBIT */
  1681. X
  1682. X  if (color[sq] != neutral)
  1683. X    printz ("%3d", svalue[sq]);
  1684. X  else
  1685. X#if defined(MSDOS) && !defined(SEVENBIT)
  1686. X    {
  1687. X      if (flag.rv)
  1688. X    printz (Vblack (sq) ? "\262\262\262" : "\260\260\260");
  1689. X      else
  1690. X    printz (Vblack (sq) ? "\260\260\260" : "\262\262\262");
  1691. X    }
  1692. X#else
  1693. X    printz (flag.shade && Vblack (sq) ? "///" : "   ");
  1694. X#endif /* MSDOS && !SEVENBIT */
  1695. X  ONormal ();
  1696. X}
  1697. X
  1698. Xvoid
  1699. XShowPostnValues (void)
  1700. X{
  1701. X  short sq, score;
  1702. X
  1703. X  ExaminePosition ();
  1704. X  for (sq = 0; sq < 64; sq++)
  1705. X    ShowPostnValue (sq);
  1706. X  score = ScorePosition (opponent);
  1707. X  gotoXY (TAB, 5);
  1708. X  printz (CP[103], score, mtl[computer], pmtl[computer], pscore[computer], sscore[computer],
  1709. X      mtl[opponent], pmtl[opponent], pscore[opponent], sscore[opponent]);
  1710. X  ClrEoln ();
  1711. X}
  1712. X
  1713. Xvoid
  1714. XUpdateDisplay (short int f, short int t, short int redraw, short int isspec)
  1715. X{
  1716. X  short sq;
  1717. X
  1718. X  if (redraw)
  1719. X    {
  1720. X      ShowHeader ();
  1721. X      ShowPlayers ();
  1722. X      for (sq = 0; sq < 64; sq++)
  1723. X    {
  1724. X      DrawSquare (sq);
  1725. X      DrawPiece (sq);
  1726. X    }
  1727. X      if (flag.coords)
  1728. X    DrawCoords ();
  1729. X    }
  1730. X  else
  1731. X    {
  1732. X      DrawPiece (f);
  1733. X      DrawPiece (t);
  1734. X      if (isspec & cstlmask)
  1735. X    if (t > f)
  1736. X      {
  1737. X        DrawPiece (f + 3);
  1738. X        DrawPiece (t - 1);
  1739. X      }
  1740. X    else
  1741. X      {
  1742. X        DrawPiece (f - 4);
  1743. X        DrawPiece (t + 1);
  1744. X      }
  1745. X      else if (isspec & epmask)
  1746. X    {
  1747. X      DrawPiece (t - 8);
  1748. X      DrawPiece (t + 8);
  1749. X    }
  1750. X    }
  1751. X  if (PositionFlag)
  1752. X    ShowPostnValues ();
  1753. X  refresh ();
  1754. X}
  1755. X
  1756. Xchar *InPtr;
  1757. Xvoid
  1758. Xskip ()
  1759. X{
  1760. X  while (*InPtr != ' ')
  1761. X    InPtr++;
  1762. X  while (*InPtr == ' ')
  1763. X    InPtr++;
  1764. X}
  1765. Xvoid
  1766. Xskipb ()
  1767. X{
  1768. X  while (*InPtr == ' ')
  1769. X    InPtr++;
  1770. X}
  1771. X
  1772. Xvoid
  1773. XChangeAlphaWindow (void)
  1774. X{
  1775. X  ShowMessage (CP[114]);
  1776. X  scanz ("%hd", &WAwindow);
  1777. X  ShowMessage (CP[34]);
  1778. X  scanz ("%hd", &BAwindow);
  1779. X}
  1780. X
  1781. Xvoid
  1782. XChangeBetaWindow (void)
  1783. X{
  1784. X  ShowMessage (CP[115]);
  1785. X  scanz ("%hd", &WBwindow);
  1786. X  ShowMessage (CP[35]);
  1787. X  scanz ("%hd", &BBwindow);
  1788. X}
  1789. X
  1790. Xvoid
  1791. XGiveHint (void)
  1792. X{
  1793. X  char s[40];
  1794. X  if (hint)
  1795. X    {
  1796. X      algbr ((short) (hint >> 8), (short) (hint & 0xFF), false);
  1797. X      strcpy (s, CP[198]);    /*try*/
  1798. X      strcat (s, mvstr[0]);
  1799. X      ShowMessage (s);
  1800. X    }
  1801. X  else
  1802. X    ShowMessage (CP[223]);
  1803. X}
  1804. X
  1805. Xvoid
  1806. XChangeHashDepth (void)
  1807. X{
  1808. X  ShowMessage (CP[163]);
  1809. X  scanz ("%hd", &HashDepth);
  1810. X  ShowMessage (CP[82]);
  1811. X  scanz ("%hd", &HashMoveLimit);
  1812. X}
  1813. X
  1814. Xvoid
  1815. XChangeSearchDepth (void)
  1816. X{
  1817. X  ShowMessage (CP[150]);
  1818. X  scanz ("%hd", &MaxSearchDepth);
  1819. X  TCflag = !(MaxSearchDepth > 0);
  1820. X}
  1821. X
  1822. Xvoid
  1823. XSetContempt (void)
  1824. X{
  1825. X  ShowMessage (CP[142]);
  1826. X  scanz ("%hd", &contempt);
  1827. X}
  1828. X
  1829. X
  1830. Xvoid
  1831. XSetAnalysis (void)
  1832. X{
  1833. X  ShowMessage (CP[159]);
  1834. X  scanz ("%s", Analysis);
  1835. X}
  1836. X
  1837. Xvoid
  1838. XChangeXwindow (void)
  1839. X{
  1840. X  ShowMessage (CP[208]);
  1841. X  scanz ("%hd", &xwndw);
  1842. X}
  1843. X
  1844. Xvoid
  1845. XSelectLevel (void)
  1846. X{
  1847. X  ClrScreen ();
  1848. X  gotoXY (32, 2);
  1849. X  printz (CP[41]);
  1850. X  gotoXY (20, 4);
  1851. X  printz (CP[18]);
  1852. X  gotoXY (20, 5);
  1853. X  printz (CP[19]);
  1854. X  gotoXY (20, 6);
  1855. X  printz (CP[20]);
  1856. X  gotoXY (20, 7);
  1857. X  printz (CP[21]);
  1858. X  gotoXY (20, 8);
  1859. X  printz (CP[22]);
  1860. X  gotoXY (20, 9);
  1861. X  printz (CP[23]);
  1862. X  gotoXY (20, 10);
  1863. X  printz (CP[24]);
  1864. X  gotoXY (20, 11);
  1865. X  printz (CP[25]);
  1866. X  gotoXY (20, 12);
  1867. X  printz (CP[26]);
  1868. X  gotoXY (20, 13);
  1869. X  printz (CP[27]);
  1870. X
  1871. X  OperatorTime = 0;
  1872. X  TCmoves = 60;
  1873. X  TCminutes = 5;
  1874. X  TCseconds = 0;
  1875. X  gotoXY (20, 17);
  1876. X  printz (CP[62]);
  1877. X  refresh ();
  1878. X  scanz ("%ld", &Level);
  1879. X  switch ((int) Level)
  1880. X    {
  1881. X    case 1:
  1882. X      TCmoves = 60;
  1883. X      TCminutes = 5;
  1884. X      break;
  1885. X    case 2:
  1886. X      TCmoves = 60;
  1887. X      TCminutes = 15;
  1888. X      break;
  1889. X    case 3:
  1890. X      TCmoves = 60;
  1891. X      TCminutes = 30;
  1892. X      break;
  1893. X    case 4:
  1894. X      TCmoves = 40;
  1895. X      TCminutes = 30;
  1896. X      break;
  1897. X    case 5:
  1898. X      TCmoves = 40;
  1899. X      TCminutes = 60;
  1900. X      break;
  1901. X    case 6:
  1902. X      TCmoves = 40;
  1903. X      TCminutes = 120;
  1904. X      break;
  1905. X    case 7:
  1906. X      TCmoves = 40;
  1907. X      TCminutes = 240;
  1908. X      break;
  1909. X    case 8:
  1910. X      TCmoves = 1;
  1911. X      TCminutes = 15;
  1912. X      break;
  1913. X    case 9:
  1914. X      TCmoves = 1;
  1915. X      TCminutes = 60;
  1916. X      break;
  1917. X    case 10:
  1918. X      TCmoves = 1;
  1919. X      TCminutes = 600;
  1920. X      break;
  1921. X    }
  1922. X
  1923. X  TCflag = (TCmoves > 0);
  1924. X  SetTimeControl ();
  1925. X  ClrScreen ();
  1926. X  UpdateDisplay (0, 0, 1, 0);
  1927. X}
  1928. X
  1929. Xvoid
  1930. XDoDebug (void)
  1931. X{
  1932. X  short c, p, sq, tp, tc, tsq, score;
  1933. X  char s[40];
  1934. X
  1935. X  ExaminePosition ();
  1936. X  ShowMessage (CP[65]);
  1937. X  scanz ("%s", s);
  1938. X  c = neutral;
  1939. X  if (s[0] == CP[9][0] || s[0] == CP[9][1])    /* w W*/
  1940. X    c = white;
  1941. X  if (s[0] == CP[9][2] || s[0] == CP[9][3])    /*b B*/
  1942. X    c = black;
  1943. X  for (p = king; p > no_piece; p--)
  1944. X    if ((s[1] == pxx[p]) || (s[1] == qxx[p]))
  1945. X      break;
  1946. X  for (sq = 0; sq < 64; sq++)
  1947. X    {
  1948. X      tp = board[sq];
  1949. X      tc = color[sq];
  1950. X      board[sq] = p;
  1951. X      color[sq] = c;
  1952. X      tsq = PieceList[c][1];
  1953. X      PieceList[c][1] = sq;
  1954. X      ShowPostnValue (sq);
  1955. X      PieceList[c][1] = tsq;
  1956. X      board[sq] = tp;
  1957. X      color[sq] = tc;
  1958. X    }
  1959. X  score = ScorePosition (opponent);
  1960. X  gotoXY (TAB, 5);
  1961. X  printz (CP[103], score, mtl[computer], pmtl[computer], pscore[computer], sscore[computer],
  1962. X      mtl[opponent], pmtl[opponent], pscore[opponent], sscore[opponent]);
  1963. X  ClrEoln ();
  1964. X}
  1965. END_OF_FILE
  1966. if test 20989 -ne `wc -c <'src/nuxdsp.c'`; then
  1967.     echo shar: \"'src/nuxdsp.c'\" unpacked with wrong size!
  1968. fi
  1969. # end of 'src/nuxdsp.c'
  1970. fi
  1971. if test -f 'test/test12' -a "${1}" != "-c" ; then 
  1972.   echo shar: Will not clobber existing file \"'test/test12'\"
  1973. else
  1974. echo shar: Extracting \"'test/test12'\" \(491 characters\)
  1975. sed "s/^X//" >'test/test12' <<'END_OF_FILE'
  1976. XBlack computer White Human 1 # correct e5e4 Cray Blitz at 23 plys
  1977. XCastled White false Black false # 
  1978. XTimeControl 0 Operator Time 0
  1979. XWhite Clock 0 Moves 0
  1980. XBlack Clock 0 Moves 0
  1981. X
  1982. X8 ........ 10 10 10 10 10 10 10 10
  1983. X7 .....P.. 10 10 10 10 10 10 10 10
  1984. X6 ........ 0 0 0 10 10 10 0 0
  1985. X5 ....k.p. 0 0 0 0 0 0 0 0
  1986. X4 .....pK. 0 0 0 0 0 0 0 0
  1987. X3 ........ 0 0 0 10 10 0 0 0
  1988. X2 ........ 10 10 10 10 10 0 10 10
  1989. X1 ........ 10 10 10 10 10 10 10 10
  1990. X  abcdefgh
  1991. X
  1992. Xmove  score depth  nodes  time flags capture color
  1993. END_OF_FILE
  1994. if test 491 -ne `wc -c <'test/test12'`; then
  1995.     echo shar: \"'test/test12'\" unpacked with wrong size!
  1996. fi
  1997. # end of 'test/test12'
  1998. fi
  1999. echo shar: End of archive 7 \(of 12\).
  2000. cp /dev/null ark7isdone
  2001. MISSING=""
  2002. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  2003.     if test ! -f ark${I}isdone ; then
  2004.     MISSING="${MISSING} ${I}"
  2005.     fi
  2006. done
  2007. if test "${MISSING}" = "" ; then
  2008.     echo You have unpacked all 12 archives.
  2009.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2010.     echo Building book file.
  2011.     cat misc/book.xaa misc/book.xab > misc/gnuchess.nunn.book
  2012.     rm misc/book.xaa misc/book.xab
  2013. else
  2014.     echo You still need to unpack the following archives:
  2015.     echo "        " ${MISSING}
  2016. fi
  2017. ##  End of shell archive.
  2018. exit 0
  2019.