Initial commit based on GNU Shogi 1.2 patchlevel 3.
[gnushogi.git] / src / nondsp.c
blob9686a29fe8fc9be3a0a5c089c2747a9d141fb40b
1 /*
2 * nondsp.c - UNIX & MSDOS AND NON-DISPLAY interface for GNU SHOGI
4 * Copyright (c) 1993, 1994, 1995 Matthias Mutz
6 * GNU SHOGI is based on GNU CHESS
8 * Copyright (c) 1988,1989,1990 John Stanback
9 * Copyright (c) 1992 Free Software Foundation
11 * This file is part of GNU SHOGI.
13 * GNU Shogi is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 1, or (at your option)
16 * any later version.
18 * GNU Shogi is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GNU Shogi; see the file COPYING. If not, write to
25 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 extern int EADD,EGET;
28 #include <ctype.h>
29 #include <signal.h>
30 #if defined THINK_C
31 #include <time.h>
32 #elif defined MSDOS
33 #include <dos.h>
34 #include <conio.h>
35 #include <stdlib.h>
36 #include <string.h>
37 #include <time.h>
38 #else
39 #include <sys/param.h>
40 #include <sys/types.h>
41 #include <sys/file.h>
42 #include <sys/ioctl.h>
43 void TerminateSearch (int), Die (int);
45 #endif /* MSDOS */
47 #include "gnushogi.h"
49 #ifdef DEBUG
50 short int debuglevel = 1024;
51 #endif /* DEBUG */
52 unsigned short int MV[MAXDEPTH];
53 int MSCORE;
55 #if defined XSHOGI
56 short int xshogi = 1;
58 #else
59 short int xshogi = 0;
61 #endif /* XSHOGI */
62 int mycnt1, mycnt2;
63 char *DRAW;
64 extern char *InPtr;
65 extern short int pscore[];
67 void
68 Initialize (void)
70 mycnt1 = mycnt2 = 0;
71 #if defined XSHOGI && !defined THINK_C && !defined MSDOS
72 #ifndef SYSV
73 setlinebuf (stdout);
74 #else
75 setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
76 #endif
77 printf ("GNU Shogi %sp%s\n", version, patchlevel);
78 #endif XSHOGI
79 #ifdef HARDTIMELIMIT
80 if (!TCflag && (MaxResponseTime == 0))
81 MaxResponseTime = 15L*100L;
82 #endif
85 void
86 ExitChess (void)
88 signal (SIGTERM, SIG_IGN);
89 #ifndef NOLIST
90 ListGame ();
91 #endif
94 #ifndef MSDOS /* never called!!! */
95 void
96 Die (int sig)
98 char s[80];
100 ShowMessage (CP[31]); /*Abort?*/
101 scanz ("%s", s);
102 if (strcmp (s, CP[210]) == 0) /*yes*/
103 ExitChess ();
106 #endif /* MSDOS */
108 void
109 TerminateSearch (int sig)
111 #ifdef MSDOS
112 sig++; /* shut up the compiler */
113 #endif /* MSDOS */
114 #ifdef INTERRUPT_TEST
115 ElapsedTime(INIT_INTERRUPT_MODE);
116 #endif
117 if (!flag.timeout)
118 flag.back = true; /* previous: flag.timeout = true; */
119 flag.bothsides = false;
120 #ifdef DEBUG
121 printf("Terminate Search\n");
122 #endif
128 void
129 help (void)
131 ClrScreen ();
132 /*printz ("SHOGI command summary\n");*/
133 printz (CP[40]);
134 printz ("----------------------------------------------------------------\n");
135 /*printz ("7g7f move from 7g to 7f quit Exit Shogi\n");*/
136 printz (CP[158]);
137 /*printz ("S6h move silver to 6h beep turn %s\n", (flag.beep) ? "off" : "on");*/
138 printz (CP[86], (flag.beep) ? CP[92] : CP[93]);
139 /*printz ("2d2c+ move from 2d to 2c and promote\n");*/
140 printz (CP[128], (flag.material) ? CP[92] : CP[93]);
141 /*printz ("P*5e drop pawn to 5e easy turn %s\n", (flag.easy) ? "off" : "on");*/
142 printz (CP[173], (flag.easy) ? CP[92] : CP[93]);
143 /*printz (" hash turn %s\n", (flag.hash) ? "off" : "on");*/
144 printz (CP[174], (flag.hash) ? CP[92] : CP[93]);
145 /*printz ("bd redraw board reverse board display\n");*/
146 printz (CP[130]);
147 /*printz ("list game to shogi.lst book turn %s used %d of %d\n", (Book) ? "off" : "on", bookcount);*/
148 printz (CP[170], (Book) ? CP[92] : CP[93], bookcount,booksize);
149 /*printz ("undo undo last ply remove take back a move\n");*/
150 printz (CP[200]);
151 /*printz ("edit edit board force enter game moves\n");*/
152 printz (CP[153]);
153 /*printz ("switch sides with computer both computer match\n");*/
154 printz (CP[194]);
155 /*printz ("black computer plays black white computer plays white\n");*/
156 printz (CP[202]);
157 /*printz ("depth set search depth clock set time control\n");*/
158 printz (CP[149]);
159 /*printz ("post principle variation hint suggest a move\n");*/
160 printz (CP[177]);
161 /*printz ("save game to file get game from file\n");*/
162 printz (CP[188]);
163 printz ("xsave pos. to xshogi file xget pos. from xshogi file\n");
164 /*printz ("random randomize play new start new game\n");*/
165 printz (CP[181]);
166 printz ("----------------------------------------------------------------\n");
167 /*printz ("Computer: %-12s Opponent: %s\n",*/
168 printz (CP[46],
169 ColorStr[computer], ColorStr[opponent]);
170 /*printz ("Depth: %-12d Response time: %d sec\n",*/
171 printz (CP[51],
172 MaxSearchDepth, MaxResponseTime/100);
173 /*printz ("Random: %-12s Easy mode: %s\n",*/
174 printz (CP[99],
175 (dither) ? CP[93] : CP[92], (flag.easy) ? CP[93] : CP[92]);
176 /*printz ("Beep: %-12s Transposition file: %s\n",*/
177 printz (CP[36],
178 (flag.beep) ? CP[93] : CP[92], (flag.hash) ? CP[93] : CP[92]);
179 /*printz ("Tsume: %-12s Force: %s\n")*/
180 printz (CP[232],
181 (flag.tsume) ? CP[93] : CP[92], (flag.force) ? CP[93] : CP[92]);
182 /*printz ("Time Control %s %d moves %d seconds %d opr %d depth\n", (TCflag) ? "ON" : "OFF",*/
183 printz (CP[110], (TCflag) ? CP[93] : CP[92],
184 TimeControl.moves[black], TimeControl.clock[black] / 100, TCadd/100, MaxSearchDepth);
185 signal (SIGINT, TerminateSearch);
186 #if !defined MSDOS && !defined THINK_C
187 signal (SIGQUIT, TerminateSearch);
188 #endif /* MSDOS */
192 void
193 EditBoard (void)
196 * Set up a board position. Pieces are entered by typing the piece followed
197 * by the location. For example, Nf3 will place a knight on square f3.
201 short a, r, c, sq, i, found;
202 char s[80];
204 flag.regularstart = true;
205 Book = BOOKFAIL;
206 ClrScreen ();
207 UpdateDisplay (0, 0, 1, 0);
208 /*printz (". exit to main\n");*/
209 printz (CP[29]);
210 /*printz ("# clear board\n");*/
211 printz (CP[28]);
212 /*printz ("c change sides\n");*/
213 printz (CP[136]);
214 /*printz ("enter piece & location: \n");*/
215 printz (CP[155]);
217 a = black;
220 scanz ("%s", s);
221 found=0;
222 if (s[0] == CP[28][0]) /*#*/
223 { short side;
224 for (sq = 0; sq < NO_SQUARES; sq++)
226 board[sq] = no_piece;
227 color[sq] = neutral;
229 ClearCaptured ();
231 if (s[0] == CP[136][0]) /*c*/
232 a = otherside[a];
233 if ( s[1] == '*' )
235 for ( i = pawn; i <= king; i++)
236 if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
238 Captured[a][i]++;
239 found=1;
240 break;
242 c = -1;
243 r = -1;
245 else
247 c = '9' - s[1];
248 r = 'i' - s[2];
250 if ((c >= 0) && (c < NO_COLS) && (r >= 0) && (r < NO_ROWS))
252 sq = locn (r, c);
253 color[sq] = a;
254 board[sq] = no_piece;
255 for (i = no_piece; i <= king; i++)
256 if ((s[0] == pxx[i]) || (s[0] == qxx[i]))
258 if ( s[3] == '+' )
259 board[sq] = promoted[i];
260 else
261 board[sq] = i;
262 found=1;
263 break;
265 if (found==0) color[sq] = neutral;
267 } while (s[0] != CP[29][0]);
268 for (sq = 0; sq < NO_SQUARES; sq++)
269 Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);
270 GameCnt = 0;
271 Game50 = 1;
272 ZeroRPT ();
273 Sdepth = 0;
274 InitializeStats ();
275 ClrScreen ();
276 UpdateDisplay (0, 0, 1, 0);
279 void
280 SetupBoard (void)
283 * Set up a board position.
284 * Nine lines of nine characters are used to setup the board. 9a-1a is the
285 * first line. White pieces are represented by uppercase characters.
289 short r, c, sq, i;
290 char ch;
291 char s[80];
293 NewGame ();
295 gets (s); /* skip "setup" command */
296 for (r = NO_ROWS-1; r >= 0; r--)
298 gets (s);
299 for (c = 0; c <= (NO_COLS-1); c++)
301 ch = s[c];
302 sq = locn (r, c);
303 color[sq] = neutral;
304 board[sq] = no_piece;
305 for (i = no_piece; i <= king; i++)
306 if (ch == pxx[i])
308 color[sq] = white;
309 board[sq] = i;
310 break;
312 else if (ch == qxx[i])
314 color[sq] = black;
315 board[sq] = i;
316 break;
320 for (sq = 0; sq < NO_SQUARES; sq++)
321 Mvboard[sq] = ((board[sq] != Stboard[sq]) ? 10 : 0);
322 InitializeStats ();
323 ClrScreen ();
324 UpdateDisplay (0, 0, 1, 0);
325 /*printz ("Setup successful\n");*/
326 printz (CP[106]);
329 void
330 ShowDepth (char ch)
332 #ifdef MSDOS
333 ch++; /* shut up the compiler */
334 #endif /* MSDOS */
335 #if !defined BAREBONES
336 printz (CP[53], Sdepth, ch); /*Depth= %d%c*/
337 printz ("\n");
338 #endif
342 void
343 ShowStage (void)
345 printz("stage = %d\n",stage);
346 printz("balance[black] = %d balance[white] = %d\n",balance[black],balance[white]);
350 void
351 ShowLine (short unsigned int *bstline)
353 register int i;
355 for (i = 1; bstline[i] > 0; i++)
357 if ((i > 1) && (i % 8 == 1))
358 printf ("\n ");
359 algbr ((short) (bstline[i] >> 8), (short) (bstline[i] & 0xFF), false);
360 printf ("%5s ", mvstr[0]);
362 printf ("\n");
365 void
366 ShowResults (short int score, short unsigned int *bstline, char ch)
368 if (flag.post)
370 ElapsedTime (2);
371 printf ("%2d%c %6d %4ld %8ld ", Sdepth, ch, score, et / 100, NodeCnt);
372 ShowLine (bstline);
376 void
377 ShowPatternCount (short side, short n)
379 if (flag.post)
381 printz("%s matches %d pattern(s)\n",ColorStr[side],n);
385 void
386 ShowResponseTime (void)
388 #ifdef DEBUG
389 if (flag.post)
391 printz("RT=%ld TCC=%d TCL=%ld EX=%ld ET=%ld TO=%d\n",
392 ResponseTime,TCcount,TCleft,ExtraTime,et,flag.timeout);
394 #endif
397 void
398 ShowGameType (void)
400 if (flag.post)
402 printz("%c vs. %c\n",GameType[black],GameType[white]);
406 void
407 SearchStartStuff (short int side)
409 signal (SIGINT, TerminateSearch);
410 #if !defined MSDOS && !defined THINK_C
411 signal (SIGQUIT, TerminateSearch);
412 #endif /* MSDOS */
413 if (flag.post)
415 printf (CP[123],
416 GameCnt/2+1,
417 ResponseTime, TimeControl.clock[side]);
420 void
421 OutputMove (void)
423 #ifdef DEBUG11
424 if (1)
426 FILE *D;
427 extern unsigned short int PrVar[];
428 char d[80];
429 int r, c, l, i;
430 D = fopen ("/tmp/DEBUGA", "a+");
431 fprintf (D, "inout move is %s\n", mvstr[0]);
432 strcpy (d, mvstr[0]);
433 for (i = 1; PrVar[i] > 0; i++)
435 algbr ((short) (PrVar[i] >> 8), (short) (PrVar[i] & 0xFF), false);
436 fprintf (D, "%5s ", mvstr[0]);
438 fprintf (D, "\n");
439 fprintf_current_board (D);
440 fclose (D);
441 strcpy (mvstr[0], d);
443 #endif
444 if (flag.illegal) {printf("%s\n",CP[225]);return;}
445 if (mvstr[0][0] == '\0') goto nomove;
446 #ifdef XSHOGI
447 /* add remaining time in milliseconds to xshogi */
448 printz ("%d. ... %s %ld\n", ++mycnt1, mvstr[0], (TimeControl.clock[player]-et)*10);
449 #else
450 printz ("%d. ... %s\n", ++mycnt1, mvstr[0]);
451 #endif
452 #ifdef notdef /* optional pass best line to frontend with move */
453 if (flag.post)
455 register int i;
457 printz (" %6d%c ", MSCORE, MV[30]);
458 for (i = 1; MV[i] > 0; i++)
460 algbr ((short) (MV[i] >> 8), (short) (MV[i] & 0xFF), false);
461 printz ("%5s ", mvstr[0]);
464 printz ("\n");
465 #endif
466 nomove:
467 if ((root->flags & draw)||(root->score == -(SCORE_LIMIT+999))||
468 (root->score == (SCORE_LIMIT+998))) goto summary;
469 if (flag.post)
471 short h, l, t;
473 h = TREE;
474 l = 0;
475 t = TREE >> 1;
476 while (l != t)
478 if (Tree[t].f || Tree[t].t)
479 l = t;
480 else
481 h = t;
482 t = (l + h) >> 1;
484 /*printf ("Nodes %ld Tree %d Eval %ld Rate %ld RS high %ld low %ld\n",*/
485 printf (CP[89],GenCnt,NodeCnt,t,EvalNodes,(et>100)?(NodeCnt/(et/100)):0,EADD,EGET,reminus,replus);
486 /*printf ("Hin/Hout/Coll/Fin/Fout = %ld/%ld/%ld/%ld/%ld\n",*/
487 printf (CP[71],
488 HashAdd, HashCnt, THashCol, HashCol,FHashCnt, FHashAdd);
490 UpdateDisplay (root->f, root->t, 0, root->flags);
491 if ( !xshogi )
493 /*printf ("My move is: %s\n", mvstr[0]);*/
494 printf (CP[83], mvstr[0]);
495 if (flag.beep)
496 printz ("%c", 7);
498 summary:
499 if (root->flags & draw)
500 /* printf ("Drawn game!\n");*/
501 printf (CP[57]);
502 else if (root->score == -(SCORE_LIMIT+999))
503 printf("%s mates!\n",ColorStr[opponent]);
504 else if (root->score == (SCORE_LIMIT+998))
505 printf("%s mates!\n",ColorStr[computer]);
506 #if !defined BAREBONES
507 #ifdef VERYBUGGY
508 else if (root->score < -SCORE_LIMIT)
509 printf("%s has a forced mate in %d moves!\n",
510 ColorStr[opponent], SCORE_LIMIT+999 + root->score - 1);
511 else if (root->score > SCORE_LIMIT)
512 printf("%s has a forced mate in %d moves!\n",
513 ColorStr[computer], SCORE_LIMIT+998 - root->score - 1);
514 #endif /*VERYBUGGY*/
515 #endif /* BAREBONES */
518 void
519 ClrScreen (void)
521 #if !defined BAREBONES
522 printz ("\n");
523 #endif
526 void
527 UpdateDisplay (short int f, short int t, short int redraw, short int isspec)
530 short r, c, l, m;
532 if (redraw && !xshogi)
534 printz ("\n");
535 r = (short)(TimeControl.clock[black] / 6000);
536 c = (short)((TimeControl.clock[black] % 6000) / 100);
537 l = (short)(TimeControl.clock[white] / 6000);
538 m = (short)((TimeControl.clock[white] % 6000) / 100);
539 /*printz ("Black %d:%02d White %d:%02d\n", r, c, l, m);*/
540 printz (CP[116], r, c, l, m);
541 printz ("\n");
542 for (r = (NO_ROWS-1); r >= 0; r--)
544 for (c = 0; c <= (NO_COLS-1); c++)
545 { char pc;
546 l = ((flag.reverse) ? locn ((NO_ROWS-1) - r, (NO_COLS-1) - c) : locn (r, c));
547 pc = (is_promoted[board[l]] ? '+' : ' ');
548 if (color[l] == neutral)
549 printz (" -");
550 else if (color[l] == black)
551 printz ("%c%c", pc, qxx[board[l]]);
552 else
553 printz ("%c%c", pc, pxx[board[l]]);
555 printz ("\n");
557 printz ("\n");
559 short side;
560 for (side = black; side <= white; side++)
561 { short piece, c;
562 printz((side==black)?"black ":"white ");
563 for (piece = pawn; piece <= king; piece++)
564 if (c = Captured[side][piece])
565 printz("%i%c ",c,pxx[piece]);
566 printz("\n");
572 void
573 ShowMessage (char *s)
575 printf("%s\n", s);
578 void
579 ShowSidetoMove (void)
583 void
584 PromptForMove (void)
586 #if !defined BAREBONES
587 /*printz ("\nYour move is? ");*/
588 printz (CP[124]);
589 #endif /* BAREBONES */
593 void
594 ShowCurrentMove (short int pnt, short int f, short int t)
596 #ifdef MSDOS
597 f++;
598 t++;
599 pnt++; /* shut up the compiler */
600 #endif /* MSDOS */
603 void
604 ChangeAlphaWindow (void)
606 printz ("WAwindow: ");
607 scanz ("%hd", &WAwindow);
608 printz ("BAwindow: ");
609 scanz ("%hd", &BAwindow);
612 void
613 ChangeBetaWindow (void)
615 printz ("WBwindow: ");
616 scanz ("%hd", &WBwindow);
617 printz ("BBwindow: ");
618 scanz ("%hd", &BBwindow);
621 void
622 GiveHint (void)
624 if (hint)
626 algbr ((short) (hint >> 8), (short) (hint & 0xFF), false);
627 printf(CP[72], mvstr[0]); /*hint*/
629 else
630 printz (CP[223]);
633 void
634 SelectLevel (char *sx)
637 char T[NO_SQUARES], *p, *q;
639 if ( (p = strstr(sx,CP[169])) != NULL )
640 p += strlen(CP[169]);
641 else if ( (p = strstr(sx,CP[217])) != NULL )
642 p += strlen(CP[217]);
643 strcat(sx,"XX");
644 q = T; *q = '\0';
645 for(;*p != 'X';*q++ = *p++);
646 *q = '\0';
647 /* line empty ask for input */
648 if(!T[0]){ printz (CP[61]); gets(T); strcat(T,"XX"); }
649 /* skip blackspace */
650 for (p = T; *p == ' '; p++) ;
651 /* could be moves or a fischer clock */
652 if(*p == 'f') { /* its a fischer clock game */
653 p++;
654 TCminutes = (short)strtol(p,&q,10);
655 TCadd = (short)strtol(q,NULL,10) *100;
656 TCseconds = 0;
657 TCmoves = 50;
658 } else { /* regular game */
659 TCadd = 0;
660 TCmoves = (short)strtol (p, &q, 10);
661 TCminutes = (short)strtol (q, &q, 10);
662 if (*q == ':')
663 TCseconds = (short)strtol (q + 1, (char **) NULL, 10);
664 else
665 TCseconds = 0;
666 #ifdef OPERATORTIME
667 printz (CP[94]);
668 scanz ("%hd", &OperatorTime);
669 #endif
670 if (TCmoves == 0) {
671 TCflag = false;
672 MaxResponseTime = TCminutes*60L*100L + TCseconds*100L;
673 TCminutes = TCseconds = 0;
674 } else {
675 TCflag = true;
676 MaxResponseTime = 0;
679 TimeControl.clock[black] = TimeControl.clock[white] = 0;
680 SetTimeControl ();
681 #if defined XSHOGI
682 printz ("Clocks: %ld %ld\n",TimeControl.clock[black]*10,TimeControl.clock[white]*10);
683 #endif
686 #ifdef DEBUG
687 void
688 ChangeDbLev (void)
690 printz (CP[146]);
691 scanz ("%hd", &debuglevel);
694 #endif /* DEBUG */
696 void
697 ChangeSearchDepth (void)
699 printz ("depth= ");
700 scanz ("%hd", &MaxSearchDepth);
701 TCflag = !(MaxSearchDepth > 0);
704 void
705 ChangeHashDepth (void)
707 printz ("hashdepth= ");
708 scanz ("%hd", &HashDepth);
709 printz ("MoveLimit= ");
710 scanz ("%hd", &HashMoveLimit);
713 void
714 SetContempt (void)
716 printz ("contempt= ");
717 scanz ("%hd", &contempt);
720 void
721 ChangeXwindow (void)
723 printz ("xwndw= ");
724 scanz ("%hd", &xwndw);
727 void
728 ShowPostnValue (short int sq)
731 * must have called ExaminePosition() first
735 short score;
736 score = ScorePosition (color[sq]);
737 if (color[sq] != neutral){
738 #if defined SAVE_SVALUE
739 printz ("???%c ", (color[sq] == white)?'b':'w');}
740 #else
741 printz ("%3d%c ", svalue[sq],(color[sq] == white)?'b':'w');}
742 #endif
743 else
744 printz(" * ");
747 void
748 DoDebug (void)
750 short c, p, sq, tp, tc, tsq, score,j,k;
751 char s[40];
753 ExaminePosition (opponent);
754 ShowMessage (CP[65]);
755 scanz ("%s", s);
756 c = neutral;
757 if (s[0] == CP[9][0] || s[0] == CP[9][1]) /* w W*/ c = black;
758 if (s[0] == CP[9][2] || s[0] == CP[9][3]) /*b B*/ c = white;
759 for (p = king; p > no_piece; p--)
760 if ((s[1] == pxx[p]) || (s[1] == qxx[p])) break;
761 if(p > no_piece)
762 for(j=(NO_ROWS-1);j>=0;j--){
763 for(k=0;k<(NO_COLS);k++){
764 sq=j*(NO_COLS)+k;
765 tp = board[sq];
766 tc = color[sq];
767 board[sq] = p;
768 color[sq] = c;
769 tsq = PieceList[c][1];
770 PieceList[c][1] = sq;
771 ShowPostnValue (sq);
772 PieceList[c][1] = tsq;
773 board[sq] = tp;
774 color[sq] = tc;
776 printz("\n");
778 score = ScorePosition (opponent);
779 for(j=(NO_ROWS-1);j>=0;j--){
780 for(k=0;k<(NO_COLS);k++){
781 sq=j*(NO_COLS)+k;
782 if (color[sq] != neutral){
783 #if defined SAVE_SVALUE
784 printz ("%?????%c ", (color[sq] == white)?'b':'w');}
785 #else
786 printz ("%5d%c ", svalue[sq],(color[sq] == white)?'b':'w');}
787 #endif
788 else
789 printz(" * ");
791 printz("\n");
793 printz("stage = %d\n",stage);
794 printz (CP[103], score,
795 mtl[computer], pscore[computer], GameType[computer],
796 mtl[opponent], pscore[opponent], GameType[opponent]);
799 void
800 DoTable (short table[NO_SQUARES])
802 short sq,j,k;
803 ExaminePosition (opponent);
804 for(j=(NO_ROWS-1);j>=0;j--){
805 for(k=0;k<NO_COLS;k++){
806 sq=j*(NO_ROWS)+k;
807 printz ("%3d ", table[sq]);
809 printz("\n");
813 void
814 ShowPostnValues (void)
816 short sq, score,j,k;
817 ExaminePosition (opponent);
818 for(j=(NO_ROWS-1);j>=0;j--){
819 for(k=0;k<NO_COLS;k++){
820 sq=j*NO_COLS+k;
821 ShowPostnValue (sq);
823 printz("\n");
825 score = ScorePosition (opponent);
826 printz (CP[103], score,
827 mtl[computer], pscore[computer], GameType[computer],
828 mtl[opponent], pscore[opponent], GameType[opponent]);
829 printz("\nhung black %d hung white %d\n",hung[black],hung[white]);