diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 05:05:38 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1995-05-30 05:05:38 +0000 |
commit | 2ad6f3dee6bc54535003f4ab26bbc587b7efa38c (patch) | |
tree | a3959baf797787918878bec6d58d6a0fb743ad0a /gnu/games | |
parent | 4f960dd75f181e9fa2edc44324f15f0ab5c64b37 (diff) | |
download | FreeBSD-src-2ad6f3dee6bc54535003f4ab26bbc587b7efa38c.zip FreeBSD-src-2ad6f3dee6bc54535003f4ab26bbc587b7efa38c.tar.gz |
Remove trailing whitespace.
Diffstat (limited to 'gnu/games')
25 files changed, 412 insertions, 412 deletions
diff --git a/gnu/games/chess/Makefile b/gnu/games/chess/Makefile index 1fff3a2..a129137 100644 --- a/gnu/games/chess/Makefile +++ b/gnu/games/chess/Makefile @@ -8,7 +8,7 @@ DPADD= ${LIBCURSES} ${LIBTERMCAP} LDADD= -lcurses -ltermcap HIDEGAME=hidegame -beforeinstall: +beforeinstall: install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/gnuchess.book \ ${DESTDIR}/usr/share/games diff --git a/gnu/games/chess/Xchess/Makefile b/gnu/games/chess/Xchess/Makefile index d8892e2..bbf2789 100644 --- a/gnu/games/chess/Xchess/Makefile +++ b/gnu/games/chess/Xchess/Makefile @@ -1,5 +1,5 @@ -# RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:05 $ -# $Source: /a/cvs/386BSD/src/gnu/chess/Xchess/Makefile,v $ +# RCS Info: $Revision: 1.2 $ on $Date: 1994/01/07 11:10:39 $ +# $Source: /home/ncvs/src/gnu/games/chess/Xchess/Makefile,v $ # Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group # # Makefile for xchess. @@ -95,7 +95,7 @@ reopt: all install: all -source: $(SOURCE) +source: $(SOURCE) tags: $(ALLFILES) ctags -w -t *.c *.h > /dev/null 2>&1 @@ -123,7 +123,7 @@ depend: $(SOURCE) echo '$$r makedep' >>eddep echo 'w' >>eddep ed - Makefile < eddep - rm eddep makedep + rm eddep makedep echo '# DEPENDENCIES MUST END AT END OF FILE' >> Makefile echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY' >> Makefile echo '# see make depend above' >> Makefile diff --git a/gnu/games/chess/Xchess/XCircle.c b/gnu/games/chess/Xchess/XCircle.c index d2144bc..3d1b1c8 100644 --- a/gnu/games/chess/Xchess/XCircle.c +++ b/gnu/games/chess/Xchess/XCircle.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.2 $ on $Date: 86/11/23 17:17:04 $ - * $Source: /users/faustus/xchess/RCS/XCircle.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:12 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/XCircle.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -143,7 +143,7 @@ XCircle(win, x, y, rad, start, end, width, height, pixel, func, planes) verts[0].flags |= VertexStartClosed; verts[j].x = verts[0].x; verts[j].y = verts[0].y; - verts[j].flags = (verts[0].flags & ~VertexStartClosed) | + verts[j].flags = (verts[0].flags & ~VertexStartClosed) | VertexEndClosed; for (i = 0; i < 15; i++) { if (dp) diff --git a/gnu/games/chess/Xchess/board.c b/gnu/games/chess/Xchess/board.c index 4c5b934..fab97d8 100644 --- a/gnu/games/chess/Xchess/board.c +++ b/gnu/games/chess/Xchess/board.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/23 17:17:15 $ - * $Source: /users/faustus/xchess/RCS/board.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/board.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -164,12 +164,12 @@ board_move(b, m) if (m->piece.color == WHITE) { if (m->fromx == 0) b->white_cant_castle_q = true; - else if (m->fromx == 7) + else if (m->fromx == 7) b->white_cant_castle_k = true; } else { if (m->fromx == 0) b->black_cant_castle_q = true; - else if (m->fromx == 7) + else if (m->fromx == 7) b->black_cant_castle_k = true; } } diff --git a/gnu/games/chess/Xchess/button.c b/gnu/games/chess/Xchess/button.c index 67bf3c8..d91005d 100644 --- a/gnu/games/chess/Xchess/button.c +++ b/gnu/games/chess/Xchess/button.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/26 12:09:41 $ - * $Source: /users/faustus/xchess/RCS/button.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:15 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/button.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -52,7 +52,7 @@ static struct but { { "Reset", 0, 80, 108, 29, RESTART } , { "Save", 109, 80, 108, 29, SAVE } , #define EASY_OFFSET 8 - { "Switch", 219, 80, 108, 29, SWITCH } + { "Switch", 219, 80, 108, 29, SWITCH } /* { "NoEasy", 219, 80, 108, 29, EASY }*/ } ; static int easy = 1; @@ -69,7 +69,7 @@ button_draw(win) XSetLineAttributes(win->display, DefaultGC(win->display, 0), BORDER_WIDTH, LineSolid, CapButt, JoinMiter); - + XDrawLine(win->display, win->buttonwin, DefaultGC(win->display, 0), 0, 29, BUTTON_WIDTH, 29); @@ -85,9 +85,9 @@ button_draw(win) XSetFont(win->display, DefaultGC(win->display, 0), win->large->fid); XSetForeground(win->display, DefaultGC(win->display, 0), - win->textcolor.pixel); + win->textcolor.pixel); XSetBackground(win->display, DefaultGC(win->display, 0), - win->textback.pixel); + win->textback.pixel); for (i = 0; i < numbuts; i++) { x = (buts[i].width - @@ -219,7 +219,7 @@ button_service(win, event) case SAVE: if (saveflag) { - message_add(win, + message_add(win, "Game is already being logged in file '", true); message_add(win, record_file, true); message_add(win, "'.\n", true); @@ -248,12 +248,12 @@ button_service(win, event) return; } } - message_add(win1, + message_add(win1, "Clock stopped.\nHit 'Pause' again to restart.\n", false); if (!oneboard) - message_add(win2, - "Clock stopped.\nHit 'Pause' again to restart.\n", + message_add(win2, + "Clock stopped.\nHit 'Pause' again to restart.\n", false); clock_started = false; } else { @@ -320,7 +320,7 @@ button_service(win, event) win->textcolor.pixel); XSetBackground(win->display, DefaultGC(win->display, 0), - win->textback.pixel); + win->textback.pixel); XDrawImageString(win->display, win->buttonwin, diff --git a/gnu/games/chess/Xchess/clock.c b/gnu/games/chess/Xchess/clock.c index a7b3c32..88228b0 100644 --- a/gnu/games/chess/Xchess/clock.c +++ b/gnu/games/chess/Xchess/clock.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/26 12:09:47 $ - * $Source: /users/faustus/xchess/RCS/clock.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/clock.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -59,7 +59,7 @@ clock_draw(win, col) Window w = ((col == WHITE) ? win->wclockwin : win->bclockwin); /* Draw a clock face and the hands. */ - XCircle(w, x, y, rad, 0.0, 0.0, 1, 1, win->textcolor.pixel, GXcopy, + XCircle(w, x, y, rad, 0.0, 0.0, 1, 1, win->textcolor.pixel, GXcopy, AllPlanes); rad -= 8; @@ -112,7 +112,7 @@ clock_update() lastwhite = lastblack = now; return; } - + if (white_running) { whiteseconds += now - lastwhite; lastwhite = now; @@ -198,7 +198,7 @@ dohands(win, col) { int cx = CLOCK_WIDTH / 2, cy = CLOCK_WIDTH / 2; double *h = (col == WHITE) ? win->whitehands : win->blackhands; - Window w = (col == WHITE) ? win->wclockwin : win->bclockwin; + Window w = (col == WHITE) ? win->wclockwin : win->bclockwin; long secs = (col == WHITE) ? whiteseconds : blackseconds; int rad, x, y, i; @@ -272,11 +272,11 @@ hilight(win, col, on) BORDER_WIDTH, LineSolid, CapButt, JoinMiter); XSetFont(win->display, DefaultGC(win->display, 0), win->large->fid); - + XDrawLine(win->display, w, DefaultGC(win->display, 0), 0, CLOCK_HEIGHT - 26, CLOCK_WIDTH, CLOCK_HEIGHT - 26); - + XDrawImageString(win->display, w, DefaultGC(win->display, 0), (CLOCK_WIDTH - x) / 2, CLOCK_HEIGHT, s, strlen(s)); diff --git a/gnu/games/chess/Xchess/control.c b/gnu/games/chess/Xchess/control.c index ad2e1d7..7d23a76 100644 --- a/gnu/games/chess/Xchess/control.c +++ b/gnu/games/chess/Xchess/control.c @@ -19,8 +19,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/23 17:17:32 $ - * $Source: /users/faustus/xchess/RCS/control.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:11 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/control.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -154,7 +154,7 @@ button_released(event, win) thismove->type = QCASTLE; else thismove->type = MOVE; - + /* Now check the en-passant case... */ if ((thismove->type == MOVE) && ((thismove->tox == thismove->fromx + 1) || (thismove->tox == thismove->fromx - 1)) && @@ -278,7 +278,7 @@ screen_move(m) win_drawpiece(&m->piece, m->toy, m->tox, BLACK); } break; - + case KCASTLE: if (m->piece.color == WHITE) { win_erasepiece(7, 4, WHITE); diff --git a/gnu/games/chess/Xchess/jail.c b/gnu/games/chess/Xchess/jail.c index e5e6064..b3ed391 100644 --- a/gnu/games/chess/Xchess/jail.c +++ b/gnu/games/chess/Xchess/jail.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.3 $ on $Date: 86/11/26 12:09:54 $ - * $Source: /users/faustus/xchess/RCS/jail.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:12 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/jail.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -82,7 +82,7 @@ jail_draw(win) win->textcolor.pixel); XSetBackground(win->display, DefaultGC(win->display, 0), win->textback.pixel); - + XDrawImageString(win->display, win->jailwin, DefaultGC(win->display, 0), (JAIL_WIDTH - i) / 2, 20, JAIL_HEADER, @@ -96,7 +96,7 @@ jail_draw(win) FillSolid); XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy); - + for (i = 0; i < 16; i++) if (pos[i]) { p.color = WHITE; @@ -105,7 +105,7 @@ jail_draw(win) tmpPM = XCreateBitmapFromData(win->display, win->jailwin, bits, 32, 32); - + XCopyPlane(win->display, tmpPM, win->jailwin, DefaultGC(win->display, 0), 0, 0, 32, 32, @@ -127,7 +127,7 @@ jail_draw(win) tmpPM = XCreateBitmapFromData(win->display, win->jailwin, bits, 32, 32); - + XCopyPlane(win->display, tmpPM, win->jailwin, DefaultGC(win->display, 0), 0, 0, 32, 32, @@ -151,7 +151,7 @@ jail_add(p) int i = piecepos(p, false); char *bits; Pixmap tmpPM; - + pos[i] = true; bits = bitsget(p); @@ -165,14 +165,14 @@ jail_add(p) tmpPM = XCreateBitmapFromData(win1->display, win1->jailwin, bits, 32, 32); - + XCopyPlane(win1->display, tmpPM, win1->jailwin, DefaultGC(win1->display, 0), 0, 0, 32, 32, 5 + (i % 8) * 32, ((i >= 16) ? 30 : 25) + (i / 8) * 32, 1); XFreePixmap(win1->display, tmpPM); - + if (!oneboard) { XSetState(win2->display, DefaultGC(win2->display, 0), win2->blackpiece.pixel, @@ -184,7 +184,7 @@ jail_add(p) tmpPM = XCreateBitmapFromData(win2->display, win2->jailwin, bits, 32, 32); - + XCopyPlane(win2->display, tmpPM, win2->jailwin, DefaultGC(win2->display, 0), 0, 0, 32, 32, diff --git a/gnu/games/chess/Xchess/message.c b/gnu/games/chess/Xchess/message.c index 8b85e9c..26df739 100644 --- a/gnu/games/chess/Xchess/message.c +++ b/gnu/games/chess/Xchess/message.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/26 12:10:22 $ - * $Source: /users/faustus/xchess/RCS/message.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:14 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/message.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -38,7 +38,7 @@ void message_init(win) windata *win; { - TxtGrab(win->display, win->messagewin, "xchess", win->medium, + TxtGrab(win->display, win->messagewin, "xchess", win->medium, win->textback.pixel, win->textcolor.pixel, win->cursorcolor.pixel); TxtAddFont(win->display, win->messagewin, 1, win->large, win->textcolor.pixel); diff --git a/gnu/games/chess/Xchess/parse.c b/gnu/games/chess/Xchess/parse.c index c66cc38..2dd94ed 100644 --- a/gnu/games/chess/Xchess/parse.c +++ b/gnu/games/chess/Xchess/parse.c @@ -19,8 +19,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.2 $ on $Date: 86/11/23 17:17:59 $ - * $Source: /users/faustus/xchess/RCS/parse.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:06 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/parse.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -71,7 +71,7 @@ load_game(file) message_add(win1, buf, false); if (!oneboard) message_add(win2, buf, false); - + fgets(buf, BSIZE, fp); if (eq(buf, "\tenglish\n")) eflag = true; @@ -106,7 +106,7 @@ load_game(file) while (fgets(buf, BSIZE, fp)) message_add(win1, buf, false); - + fclose(fp); return; @@ -179,7 +179,7 @@ parse_file(fp, b, english) * name followed by a row number. If the column name is kr, kn, kb, k, q, * qb, qn, or qr, then the row number is according to the english system, * or if it is a-h then it is according to the international system. - * + * *** As of now the spec must include the position. */ @@ -380,7 +380,7 @@ if (debug) fprintf(stderr, "(alg) parsing %s\n", buf); else if ((m->piece.type == KING) && (m->fromy == m->toy) && (m->fromx == 4) && (m->tox == 2)) m->type = QCASTLE; - + return (m); } diff --git a/gnu/games/chess/Xchess/popup.c b/gnu/games/chess/Xchess/popup.c index 2e19ee5..0995638 100644 --- a/gnu/games/chess/Xchess/popup.c +++ b/gnu/games/chess/Xchess/popup.c @@ -20,9 +20,9 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.2 $ on $Date: 86/11/26 12:10:38 $ - * $Source: /users/faustus/xchess/RCS/popup.c,v $ - * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:13 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/popup.c,v $ + * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * faustus@cad.berkeley.edu, ucbvax!faustus * Permission is granted to modify and re-distribute this code in any manner * as long as this notice is preserved. All standard disclaimers apply. @@ -75,7 +75,7 @@ pop_question(win, text) XMapRaised(win->display, w); XSetFont(win->display, DefaultGC(win->display, 0), win->medium->fid); - + for (i = 0, s = text; i < nlines - 4; i++) { for (t = s, j = 0; *t && (*t != '\n'); t++, j++) ; diff --git a/gnu/games/chess/Xchess/program.c b/gnu/games/chess/Xchess/program.c index c1ec0ac..e2eb186 100644 --- a/gnu/games/chess/Xchess/program.c +++ b/gnu/games/chess/Xchess/program.c @@ -20,7 +20,7 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.2 $ on $Date: 1994/01/07 11:10:40 $ +/* RCS Info: $Revision: 1.3 $ on $Date: 1994/11/04 02:11:30 $ * $Source: /home/ncvs/src/gnu/games/chess/Xchess/program.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it @@ -62,7 +62,7 @@ program_init(name) sprintf (moves, "%d", movesperunit); if (proghost) execl("/usr/ucb/rsh", "rsh", proghost, name, - moves, time, + moves, time, (char *) NULL); else execl(name, name, moves, time, (char *) NULL); diff --git a/gnu/games/chess/Xchess/record.c b/gnu/games/chess/Xchess/record.c index d9459b3..b2fcea1 100644 --- a/gnu/games/chess/Xchess/record.c +++ b/gnu/games/chess/Xchess/record.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.4 $ on $Date: 86/11/23 17:18:20 $ - * $Source: /users/faustus/xchess/RCS/record.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:09 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/record.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -56,7 +56,7 @@ record_init(win) i = XTextWidth(win->medium, RECORD_HEADER, sizeof(RECORD_HEADER) - 1); i = (40 * win->small->max_bounds.width - i * - win->medium->max_bounds.width) / + win->medium->max_bounds.width) / win->medium->max_bounds.width / 2; TxtGrab(win->display, win->recwin, "xchess", win->small, win->textback.pixel, win->textcolor.pixel, win->cursorcolor.pixel); @@ -64,7 +64,7 @@ record_init(win) for (; i > 0; i++) TxtWriteStr(win->display, win->recwin, " "); TxtWriteStr(win->display, win->recwin, RECORD_HEADER); - + if (saveflag) { if (!(backup = fopen(record_file, "w"))) { perror(record_file); @@ -72,7 +72,7 @@ record_init(win) } else { fprintf(backup, "X Chess -- %s\n", datestring()); if (dispname2) - fprintf(backup, "\tWhite on %s, black on %s\n", + fprintf(backup, "\tWhite on %s, black on %s\n", dispname1, dispname2); else fprintf(backup, "\tGame played on %s\n", @@ -136,7 +136,7 @@ record_save() } fprintf(fp, "X Chess -- %s\n", datestring()); if (dispname2) - fprintf(fp, "\tWhite on %s, black on %s\n", + fprintf(fp, "\tWhite on %s, black on %s\n", dispname1, dispname2); else fprintf(fp, "\tGame played on %s\n", dispname1); @@ -201,7 +201,7 @@ record_back() s = buf; for (i = 0; *s != '\0'; i++) *s++ = ''; /* control H, backspace */ - + TxtWriteStr(win1->display, win1->recwin, buf); if (!oneboard) { TxtWriteStr(win2->display, win2->recwin, buf); @@ -279,9 +279,9 @@ movestring(m) sprintf(buf, "something strange"); break; } - if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) && + if ((m->piece.type == PAWN) && (((m->piece.color == BLACK) && (m->toy == 7)) || ((m->piece.color == WHITE) && - (m->toy == 0)))) + (m->toy == 0)))) strcat(buf, "(Q)"); #ifdef smartass diff --git a/gnu/games/chess/Xchess/scrollText.c b/gnu/games/chess/Xchess/scrollText.c index ace88a7..b8484dd 100644 --- a/gnu/games/chess/Xchess/scrollText.c +++ b/gnu/games/chess/Xchess/scrollText.c @@ -1,7 +1,7 @@ /* * A Scrollable Text Output Window * - * David Harrison + * David Harrison * University of California, Berkeley * 1986 * @@ -204,7 +204,7 @@ int bg, fg, cur; /* Background, foreground, and cursor colors */ XWindowAttributes winInfo; /* Window information */ int index; XGCValues gc_val; - + if (textWindows == (XAssocTable *) 0) { textWindows = XCreateAssocTable(32); if (textWindows == (XAssocTable *) 0) return(0); @@ -259,7 +259,7 @@ int bg, fg, cur; /* Background, foreground, and cursor colors */ winInfo.width - BARSIZE, 0, BARSIZE - (2*BARBORDER), winInfo.height - (2*BARBORDER), - BARBORDER, + BARBORDER, fg, bg); XSelectInput(display, newWin->scrollBar, ExposureMask|ButtonReleaseMask); XMapRaised(display, newWin->scrollBar); @@ -302,7 +302,7 @@ int bg, fg, cur; /* Background, foreground, and cursor colors */ newWin->fontGC[index] = 0; } - + /* Initialize size of first line */ newWin->txtBuffer[0]->lineHeight = newWin->theFonts[0].ascent + newWin->theFonts[0].descent; @@ -391,7 +391,7 @@ struct txtWin *textInfo; /* Text window information */ (startPos > 0) && (textInfo->mainBuffer[startPos] != '\n'); startPos--) /* null loop body */; - + /* Clear out the old line start array */ for (index = 0; index < textInfo->numLines; index++) { InitLine(textInfo->txtBuffer[index]); @@ -411,7 +411,7 @@ struct txtWin *textInfo; /* Text window information */ curfont = 0; for (index = 0; index < textInfo->bufSpot; index++) { theChar = bufptr[index] & CHARMASK; - + if ((bufptr[index] & FONTMASK) != curfont) { int newFontNum, heightDiff; @@ -503,7 +503,7 @@ int newColor; /* Color of font */ struct txtWin *textInfo; int redrawFlag; XGCValues gc_val; - + if ((fontNumber < 0) || (fontNumber >= MAXFONTS)) return 0; if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) textWin)) == 0) @@ -518,7 +518,7 @@ int newColor; /* Color of font */ gc_val.plane_mask = AllPlanes; gc_val.graphics_exposures = 1; gc_val.function = GXcopy; - + if (textInfo->fontGC[fontNumber] != 0) { XChangeGC(display, textInfo->fontGC[fontNumber], @@ -532,7 +532,7 @@ int newColor; /* Color of font */ GCFunction | GCPlaneMask | GCGraphicsExposures, - &gc_val); + &gc_val); redrawFlag = (textInfo->theFonts[fontNumber].fid != 0) && @@ -622,7 +622,7 @@ struct txtWin *textInfo; /* Text window information */ if (bottom == textInfo->h-(2*BARBORDER)) bottom--; XFillRectangle(display, textInfo->scrollBar, - textInfo->bgGC, + textInfo->bgGC, 0, 0, BARSIZE, top-1); #ifdef __FreeBSD__ XFillRectangle(display, textInfo->scrollBar, @@ -648,7 +648,7 @@ Display *display; Window w; /* * This routine clears a scrollable text window. It resets the current - * writing position to the upper left hand corner of the screen. + * writing position to the upper left hand corner of the screen. * NOTE: THIS ALSO CLEARS THE CONTENTS OF THE TEXT WINDOW BUFFER AND * RESETS THE SCROLL BAR. Returns 0 if the window is not a text window. * This should be used *instead* of XClear. @@ -674,7 +674,7 @@ Window w; textInfo->endLine = 0; textInfo->curLine = 0; textInfo->curX = 0; - textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent + textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent + textInfo->theFonts[textInfo->curFont].descent; textInfo->bottomSpace = textInfo->h - YPADDING - @@ -1119,7 +1119,7 @@ int ypos; /* Y position for line */ curX += CharSize(textInfo, lineIndex, index); glyph++; } - + /* Flush out the glyphs */ XFillRectangle(display, textInfo->mainWindow, textInfo->bgGC, @@ -1191,7 +1191,7 @@ int flagWord; /* DODISP or nothing */ if ((textInfo->curY + thisLine->lineHeight + heightDiff + INTERLINE) > textInfo->h) { - /* + /* * General approach: "unscroll" the last line up * and then call ScrollDown to do the right thing. */ @@ -1210,7 +1210,7 @@ int flagWord; /* DODISP or nothing */ (textInfo->bottomSpace + INTERLINE + thisLine->lineHeight); } - else + else { /* Just update bottom space */ textInfo->bottomSpace -= heightDiff; @@ -1251,7 +1251,7 @@ register char *str; /* 0 terminated string */ * - A new font can be chosen using the sequence '^F<digit>' where * <digit> is 0-7. The directive will be ignored if * there is no font in the specified slot. - * Returns 0 if something went wrong. + * Returns 0 if something went wrong. */ { register int fontIndex; @@ -1260,7 +1260,7 @@ register char *str; /* 0 terminated string */ if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0) return 0; - + /* See if screen needs to be updated */ if (textInfo->flagWord & SCREENWRONG) { TxtRepaint(display, textInfo->mainWindow); @@ -1292,7 +1292,7 @@ register char *str; /* 0 terminated string */ continue; } } - + /* Inline code for handling normal character case */ if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) { register XFontStruct *thisFont; @@ -1324,21 +1324,21 @@ register char *str; /* 0 terminated string */ HandleNewLine(display, textInfo, DODISP | NONEWLINE); thisLine = textInfo->txtBuffer[textInfo->curLine]; } - + /* Ready to draw character */ XDrawString(display, textInfo->mainWindow, - DEFAULT_GC, + DEFAULT_GC, textInfo->curX += charWidth, - textInfo->curY + thisLine->lineHeight, + textInfo->curY + thisLine->lineHeight, str, 1); - + /* Append character onto main buffer */ if (textInfo->bufSpot >= textInfo->bufAlloc) /* Make room for more characters */ ExpandBuffer(textInfo); textInfo->mainBuffer[(textInfo->bufSpot)++] = (textInfo->curFont << FONTSHIFT) | (*str); - + /* Update the line start array */ thisLine->lineLength += 1; thisLine->lineWidth += charWidth; @@ -1384,7 +1384,7 @@ register char *str; /* NULL terminated string */ if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w) ) == 0) return 0; - + for ( /* str is ok */ ; (*str != 0) ; str++) { /* Check to see if we are waiting on a font */ if (textInfo->flagWord & FONTNUMWAIT) { @@ -1402,7 +1402,7 @@ register char *str; /* NULL terminated string */ register XFontStruct *thisFont; register struct txtLine *thisLine; register int charWidth; - + /* Determine size of character */ thisFont = &(textInfo->theFonts[textInfo->curFont]); @@ -1429,7 +1429,7 @@ register char *str; /* NULL terminated string */ ExpandBuffer(textInfo); textInfo->mainBuffer[(textInfo->bufSpot)++] = (textInfo->curFont << FONTSHIFT) | (*str); - + /* Update the line start array */ thisLine->lineLength += 1; thisLine->lineWidth += charWidth; @@ -1455,7 +1455,7 @@ Display *display; Window w; /* * Repaints the given scrollable text window. The routine repaints - * the entire window. For handling exposure events, the TxtFilter + * the entire window. For handling exposure events, the TxtFilter * routine should be used. */ { @@ -1589,7 +1589,7 @@ struct txtWin *textInfo; /* Text window information */ 0, textInfo->h - textInfo->bottomSpace, textInfo->w, textInfo->bottomSpace); #endif - + UpdateExposures(display, textInfo); UpdateScroll(display, textInfo); @@ -1774,7 +1774,7 @@ XEvent *evt; return 0; if ((textInfo = (struct txtWin *) - XLookUpAssoc(display, textWindows, (XID) w)) == 0) + XLookUpAssoc(display, textWindows, (XID) w)) == 0) return 0; /* Determine whether it's main window or not */ diff --git a/gnu/games/chess/Xchess/scrollText/scrollText.c b/gnu/games/chess/Xchess/scrollText/scrollText.c index 4320710..aefb599 100644 --- a/gnu/games/chess/Xchess/scrollText/scrollText.c +++ b/gnu/games/chess/Xchess/scrollText/scrollText.c @@ -1,7 +1,7 @@ /* * A Scrollable Text Output Window * - * David Harrison + * David Harrison * University of California, Berkeley * 1986 * @@ -204,7 +204,7 @@ int bg, fg, cur; /* Background, foreground, and cursor colors */ XWindowAttributes winInfo; /* Window information */ int index; XGCValues gc_val; - + if (textWindows == (XAssocTable *) 0) { textWindows = XCreateAssocTable(32); if (textWindows == (XAssocTable *) 0) return(0); @@ -259,7 +259,7 @@ int bg, fg, cur; /* Background, foreground, and cursor colors */ winInfo.width - BARSIZE, 0, BARSIZE - (2*BARBORDER), winInfo.height - (2*BARBORDER), - BARBORDER, + BARBORDER, fg, bg); XSelectInput(display, newWin->scrollBar, ExposureMask|ButtonReleaseMask); XMapRaised(display, newWin->scrollBar); @@ -302,7 +302,7 @@ int bg, fg, cur; /* Background, foreground, and cursor colors */ newWin->fontGC[index] = 0; } - + /* Initialize size of first line */ newWin->txtBuffer[0]->lineHeight = newWin->theFonts[0].ascent + newWin->theFonts[0].descent; @@ -391,7 +391,7 @@ struct txtWin *textInfo; /* Text window information */ (startPos > 0) && (textInfo->mainBuffer[startPos] != '\n'); startPos--) /* null loop body */; - + /* Clear out the old line start array */ for (index = 0; index < textInfo->numLines; index++) { InitLine(textInfo->txtBuffer[index]); @@ -411,7 +411,7 @@ struct txtWin *textInfo; /* Text window information */ curfont = 0; for (index = 0; index < textInfo->bufSpot; index++) { theChar = bufptr[index] & CHARMASK; - + if ((bufptr[index] & FONTMASK) != curfont) { int newFontNum, heightDiff; @@ -503,7 +503,7 @@ int newColor; /* Color of font */ struct txtWin *textInfo; int redrawFlag; XGCValues gc_val; - + if ((fontNumber < 0) || (fontNumber >= MAXFONTS)) return 0; if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) textWin)) == 0) @@ -518,7 +518,7 @@ int newColor; /* Color of font */ gc_val.plane_mask = AllPlanes; gc_val.graphics_exposures = 1; gc_val.function = GXcopy; - + if (textInfo->fontGC[fontNumber] != 0) { XChangeGC(display, textInfo->fontGC[fontNumber], @@ -532,7 +532,7 @@ int newColor; /* Color of font */ GCFunction | GCPlaneMask | GCGraphicsExposures, - &gc_val); + &gc_val); redrawFlag = (textInfo->theFonts[fontNumber].fid != 0) && @@ -622,7 +622,7 @@ struct txtWin *textInfo; /* Text window information */ if (bottom == textInfo->h-(2*BARBORDER)) bottom--; XFillRectangle(display, textInfo->scrollBar, - textInfo->bgGC, + textInfo->bgGC, 0, 0, BARSIZE, top-1); XFillRectangle(display, textInfo->scrollBar, DEFAULT_GC, top, BARSIZE - (2*BARBORDER) - 2, @@ -642,7 +642,7 @@ Display *display; Window w; /* * This routine clears a scrollable text window. It resets the current - * writing position to the upper left hand corner of the screen. + * writing position to the upper left hand corner of the screen. * NOTE: THIS ALSO CLEARS THE CONTENTS OF THE TEXT WINDOW BUFFER AND * RESETS THE SCROLL BAR. Returns 0 if the window is not a text window. * This should be used *instead* of XClear. @@ -668,7 +668,7 @@ Window w; textInfo->endLine = 0; textInfo->curLine = 0; textInfo->curX = 0; - textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent + textInfo->curY = YPADDING + textInfo->theFonts[textInfo->curFont].ascent + textInfo->theFonts[textInfo->curFont].descent; textInfo->bottomSpace = textInfo->h - YPADDING - @@ -1106,7 +1106,7 @@ int ypos; /* Y position for line */ curX += CharSize(textInfo, lineIndex, index); glyph++; } - + /* Flush out the glyphs */ XFillRectangle(display, textInfo->mainWindow, textInfo->bgGC, @@ -1178,7 +1178,7 @@ int flagWord; /* DODISP or nothing */ if ((textInfo->curY + thisLine->lineHeight + heightDiff + INTERLINE) > textInfo->h) { - /* + /* * General approach: "unscroll" the last line up * and then call ScrollDown to do the right thing. */ @@ -1197,7 +1197,7 @@ int flagWord; /* DODISP or nothing */ (textInfo->bottomSpace + INTERLINE + thisLine->lineHeight); } - else + else { /* Just update bottom space */ textInfo->bottomSpace -= heightDiff; @@ -1238,7 +1238,7 @@ register char *str; /* 0 terminated string */ * - A new font can be chosen using the sequence '^F<digit>' where * <digit> is 0-7. The directive will be ignored if * there is no font in the specified slot. - * Returns 0 if something went wrong. + * Returns 0 if something went wrong. */ { register int fontIndex; @@ -1247,7 +1247,7 @@ register char *str; /* 0 terminated string */ if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w)) == 0) return 0; - + /* See if screen needs to be updated */ if (textInfo->flagWord & SCREENWRONG) { TxtRepaint(display, textInfo->mainWindow); @@ -1279,7 +1279,7 @@ register char *str; /* 0 terminated string */ continue; } } - + /* Inline code for handling normal character case */ if ((*str >= LOWCHAR) && (*str <= HIGHCHAR)) { register XFontStruct *thisFont; @@ -1311,21 +1311,21 @@ register char *str; /* 0 terminated string */ HandleNewLine(display, textInfo, DODISP | NONEWLINE); thisLine = textInfo->txtBuffer[textInfo->curLine]; } - + /* Ready to draw character */ XDrawString(display, textInfo->mainWindow, - DEFAULT_GC, + DEFAULT_GC, textInfo->curX += charWidth, - textInfo->curY + thisLine->lineHeight, + textInfo->curY + thisLine->lineHeight, str, 1); - + /* Append character onto main buffer */ if (textInfo->bufSpot >= textInfo->bufAlloc) /* Make room for more characters */ ExpandBuffer(textInfo); textInfo->mainBuffer[(textInfo->bufSpot)++] = (textInfo->curFont << FONTSHIFT) | (*str); - + /* Update the line start array */ thisLine->lineLength += 1; thisLine->lineWidth += charWidth; @@ -1371,7 +1371,7 @@ register char *str; /* NULL terminated string */ if ((textInfo = (struct txtWin *) XLookUpAssoc(display, textWindows, (XID) w) ) == 0) return 0; - + for ( /* str is ok */ ; (*str != 0) ; str++) { /* Check to see if we are waiting on a font */ if (textInfo->flagWord & FONTNUMWAIT) { @@ -1389,7 +1389,7 @@ register char *str; /* NULL terminated string */ register XFontStruct *thisFont; register struct txtLine *thisLine; register int charWidth; - + /* Determine size of character */ thisFont = &(textInfo->theFonts[textInfo->curFont]); @@ -1416,7 +1416,7 @@ register char *str; /* NULL terminated string */ ExpandBuffer(textInfo); textInfo->mainBuffer[(textInfo->bufSpot)++] = (textInfo->curFont << FONTSHIFT) | (*str); - + /* Update the line start array */ thisLine->lineLength += 1; thisLine->lineWidth += charWidth; @@ -1442,7 +1442,7 @@ Display *display; Window w; /* * Repaints the given scrollable text window. The routine repaints - * the entire window. For handling exposure events, the TxtFilter + * the entire window. For handling exposure events, the TxtFilter * routine should be used. */ { @@ -1570,7 +1570,7 @@ struct txtWin *textInfo; /* Text window information */ XClearArea(display, textInfo->mainWindow, 0, textInfo->h - textInfo->bottomSpace, textInfo->w, textInfo->bottomSpace); - + UpdateExposures(display, textInfo); UpdateScroll(display, textInfo); @@ -1755,7 +1755,7 @@ XEvent *evt; return 0; if ((textInfo = (struct txtWin *) - XLookUpAssoc(display, textWindows, (XID) w)) == 0) + XLookUpAssoc(display, textWindows, (XID) w)) == 0) return 0; /* Determine whether it's main window or not */ diff --git a/gnu/games/chess/Xchess/std.c b/gnu/games/chess/Xchess/std.c index 1aa9e83..2bbd113 100644 --- a/gnu/games/chess/Xchess/std.c +++ b/gnu/games/chess/Xchess/std.c @@ -20,7 +20,7 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.2 $ on $Date: 1994/01/07 11:10:42 $ +/* RCS Info: $Revision: 1.3 $ on $Date: 1994/11/04 02:11:33 $ * $Source: /home/ncvs/src/gnu/games/chess/Xchess/std.c,v $ * Copyright (c) 1985 Wayne A. Christopher, U. C. Berkeley CAD Group * @@ -62,7 +62,7 @@ copy(str) char *str; { char *p, *tmalloc(); - + p = tmalloc(strlen(str) + 1); strcpy(p, str); return(p); @@ -90,7 +90,7 @@ substring(sub, str) } /* Malloc num bytes and initialize to zero. Fatal error if the space can't - * be malloc'd. + * be malloc'd. */ char * @@ -375,7 +375,7 @@ setenv(name, value) environ = xx; } else xx = environ; - + xx[i] = tmalloc(strlen(name) + strlen(value) + 2); sprintf(xx[i], "%s=%s", name, value); return; diff --git a/gnu/games/chess/Xchess/valid.c b/gnu/games/chess/Xchess/valid.c index 3dcdb00..06d1f29 100644 --- a/gnu/games/chess/Xchess/valid.c +++ b/gnu/games/chess/Xchess/valid.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.3 $ on $Date: 86/11/23 17:18:35 $ - * $Source: /users/faustus/xchess/RCS/valid.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/valid.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -49,10 +49,10 @@ valid_move(m, b) board_move(&tb, m); if (ischeck(&tb, m->piece.color)) return (false); - + if (ischeck(&tb, ((m->piece.color == WHITE) ? BLACK : WHITE))) m->check = true; - + return (true); } @@ -66,7 +66,7 @@ couldmove(m, b) switch (m->type) { case KCASTLE: if ((m->piece.color == WHITE) && (b->white_cant_castle_k) || - (m->piece.color == BLACK) && + (m->piece.color == BLACK) && (b->black_cant_castle_k)) return (false); if ((b->square[m->fromy][5].color != NONE) || @@ -78,7 +78,7 @@ couldmove(m, b) case QCASTLE: if ((m->piece.color == WHITE) && (b->white_cant_castle_q) || - (m->piece.color == BLACK) && + (m->piece.color == BLACK) && (b->black_cant_castle_q)) return (false); if ((b->square[m->fromy][1].color != NONE) || @@ -129,7 +129,7 @@ couldmove(m, b) */ if (m->enpassant) { if (b->square[(m->piece.color == WHITE) - ? 3 : 4][m->tox].color == + ? 3 : 4][m->tox].color == ((m->piece.color == WHITE) ? BLACK : WHITE)) break; diff --git a/gnu/games/chess/Xchess/window.c b/gnu/games/chess/Xchess/window.c index 4aae06d..c33ef81 100644 --- a/gnu/games/chess/Xchess/window.c +++ b/gnu/games/chess/Xchess/window.c @@ -19,8 +19,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.5 $ on $Date: 86/11/26 12:11:15 $ - * $Source: /users/faustus/xchess/RCS/window.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:08 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/window.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -89,7 +89,7 @@ win_setup(disp1, disp2) win2->flipped = true; win_drawboard(win2); } - + return(true); } @@ -199,7 +199,7 @@ win_drawpiece(p, y, x, wnum) XSetState(win->display, DefaultGC(win->display, 0), BlackPixel(win->display, 0), WhitePixel(win->display, 0), GXcopy, AllPlanes); - + tmpPM = XCreateBitmapFromData(win->display, win->boardwin, shade_bits, SQUARE_WIDTH, SQUARE_HEIGHT); @@ -209,7 +209,7 @@ win_drawpiece(p, y, x, wnum) y * (SQUARE_HEIGHT + BORDER_WIDTH), 1); XFreePixmap(win->display, tmpPM); - + XSetFunction(win->display, DefaultGC(win->display, 0), GXandInverted); maskPM = XCreateBitmapFromData(win->display, win->boardwin, @@ -268,16 +268,16 @@ win_drawpiece(p, y, x, wnum) gc.background = win->blacksquare.pixel; gc.font = win->small->fid; - + XChangeGC(win->display, DefaultGC(win->display, 0), GCForeground | GCBackground | GCFont, &gc); - + if (!x) { sprintf(buf, " %d", SIZE - y); XDrawImageString(win->display, win->boardwin, DefaultGC(win->display, 0), - 1, (y + 1) * (SQUARE_HEIGHT + - BORDER_WIDTH) - BORDER_WIDTH + + 1, (y + 1) * (SQUARE_HEIGHT + + BORDER_WIDTH) - BORDER_WIDTH + win->small->max_bounds.ascent - 1, buf, 2); } if (y == SIZE - 1) { @@ -285,7 +285,7 @@ win_drawpiece(p, y, x, wnum) XDrawImageString(win->display, win->boardwin, DefaultGC(win->display, 0), x * (SQUARE_WIDTH + BORDER_WIDTH) + 1, - SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH + + SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH + win->small->max_bounds.ascent - 1, buf, 1); } } @@ -301,12 +301,12 @@ win_erasepiece(y, x, wnum) char buf[BSIZE]; XGCValues gc; Pixmap tmpPM; - + if (oneboard || (wnum == win1->color)) win = win1; else win = win2; - + if (win->flipped) { y = SIZE - y - 1; x = SIZE - x - 1; @@ -354,16 +354,16 @@ win_erasepiece(y, x, wnum) gc.background = win->blacksquare.pixel; gc.font = win->small->fid; - + XChangeGC(win->display, DefaultGC(win->display, 0), GCForeground | GCBackground | GCFont, &gc); - + if (!x) { sprintf(buf, " %d", SIZE - y); XDrawImageString(win->display, win->boardwin, DefaultGC(win->display, 0), - 1, (y + 1) * (SQUARE_HEIGHT + - BORDER_WIDTH) - BORDER_WIDTH + + 1, (y + 1) * (SQUARE_HEIGHT + + BORDER_WIDTH) - BORDER_WIDTH + win->small->max_bounds.ascent - 1, buf, 2); } if (y == SIZE - 1) { @@ -371,11 +371,11 @@ win_erasepiece(y, x, wnum) XDrawImageString(win->display, win->boardwin, DefaultGC(win->display, 0), x * (SQUARE_WIDTH + BORDER_WIDTH) + 1, - SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH + + SIZE * (SQUARE_HEIGHT + BORDER_WIDTH) - BORDER_WIDTH + win->small->max_bounds.ascent - 1, buf, 1); } } - + return; } @@ -392,7 +392,7 @@ win_flash(m, wnum) win = win1; else win = win2; - + if (win->flipped) { sx = SIZE - m->fromx - 1; sy = SIZE - m->fromy - 1; @@ -417,7 +417,7 @@ win_flash(m, wnum) DefaultGC(win->display, 0), sx, sy, ex, ey); } - + XSetFunction(win->display, DefaultGC(win->display, 0), GXcopy); return; } @@ -598,7 +598,7 @@ win_redraw(win, event) x2 = SIZE - x1 - 1; } - for (i = x1; i <= x2; i++) + for (i = x1; i <= x2; i++) for (j = y1; j <= y2; j++) { if (chessboard->square[j][i].color == NONE) win_erasepiece(j, i, WHITE); @@ -613,7 +613,7 @@ win_redraw(win, event) j, i, BLACK); } } - + return; } @@ -627,11 +627,11 @@ setup(dispname, win) Cursor cur; extern char *program, *recfile; XSizeHints xsizes; - + if (!(win->display = XOpenDisplay(dispname))) return (false); - + /* Now get boolean defaults... */ if ((s = XGetDefault(win->display, program, "noisy")) && eq(s, "on")) @@ -646,13 +646,13 @@ setup(dispname, win) quickflag = true; if ((s = XGetDefault(win->display, program, "flash")) && eq(s, "on")) win_flashmove = true; - + /* ... numeric variables ... */ if (s = XGetDefault(win->display, program, "numflashes")) num_flashes = atoi(s); if (s = XGetDefault(win->display, program, "flashsize")) flash_size = atoi(s); - + /* ... and strings. */ if (s = XGetDefault(win->display, program, "progname")) progname = s; @@ -683,7 +683,7 @@ setup(dispname, win) if ((DisplayPlanes(win->display, 0) == 1) || bnwflag) win->bnw = true; - + /* Allocate colors... */ if (win->bnw) { win->blackpiece.pixel = BlackPixel (win->display, 0); @@ -699,64 +699,64 @@ setup(dispname, win) } else { if (!XParseColor(win->display, DefaultColormap(win->display, 0), - black_piece_color, &win->blackpiece) || + black_piece_color, &win->blackpiece) || !XParseColor(win->display, DefaultColormap(win->display, 0), - white_piece_color, &win->whitepiece) || + white_piece_color, &win->whitepiece) || !XParseColor(win->display, DefaultColormap(win->display, 0), - black_square_color, &win->blacksquare) || + black_square_color, &win->blacksquare) || !XParseColor(win->display, DefaultColormap(win->display, 0), - white_square_color, &win->whitesquare) || + white_square_color, &win->whitesquare) || !XParseColor(win->display, DefaultColormap(win->display, 0), - border_color, &win->border) || + border_color, &win->border) || !XParseColor(win->display, DefaultColormap(win->display, 0), - text_color, &win->textcolor) || + text_color, &win->textcolor) || !XParseColor(win->display, DefaultColormap(win->display, 0), - text_back, &win->textback) || + text_back, &win->textback) || !XParseColor(win->display, DefaultColormap(win->display, 0), - error_text, &win->errortext) || + error_text, &win->errortext) || !XParseColor(win->display, DefaultColormap(win->display, 0), - player_text, &win->playertext) || + player_text, &win->playertext) || !XParseColor(win->display, DefaultColormap(win->display, 0), cursor_color, &win->cursorcolor) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->blackpiece) || + &win->blackpiece) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->whitepiece) || + &win->whitepiece) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->blacksquare) || + &win->blacksquare) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->whitesquare) || + &win->whitesquare) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->border) || + &win->border) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->textcolor) || + &win->textcolor) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->textback) || + &win->textback) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->errortext) || + &win->errortext) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->playertext) || + &win->playertext) || !XAllocColor(win->display, DefaultColormap(win->display, 0), - &win->cursorcolor)) + &win->cursorcolor)) fprintf(stderr, "Can't get colors...\n"); } @@ -773,17 +773,17 @@ setup(dispname, win) NULL) fprintf(stderr, "Can't get large font...\n"); - + /* Create the windows... */ win->basewin = XCreateSimpleWindow(win->display,DefaultRootWindow(win->display), - BASE_XPOS, BASE_YPOS, + BASE_XPOS, BASE_YPOS, BASE_WIDTH, BASE_HEIGHT, 0, BlackPixel(win->display, 0), - WhitePixel(win->display, 0)); + WhitePixel(win->display, 0)); win->boardwin = XCreateSimpleWindow(win->display,win->basewin, - BOARD_XPOS, BOARD_YPOS, + BOARD_XPOS, BOARD_YPOS, BOARD_WIDTH, BOARD_HEIGHT, BORDER_WIDTH, win->border.pixel, @@ -819,7 +819,7 @@ setup(dispname, win) BUTTON_WIDTH, BUTTON_HEIGHT, BORDER_WIDTH, win->border.pixel, win->textback.pixel); - + /* Let's define an icon... */ win->iconpixmap = XCreatePixmapFromBitmapData(win->display, win->basewin, icon_bits, @@ -835,7 +835,7 @@ setup(dispname, win) XSetStandardProperties(win->display, win->basewin, program, program, win->iconpixmap, 0, NULL, &xsizes); - + bm = XCreateBitmapFromData(win->display, win->basewin, xchess_bits, xchess_width, xchess_height); @@ -848,7 +848,7 @@ setup(dispname, win) xchess_x_hot, xchess_y_hot); XFreePixmap(win->display, bm); XFreePixmap(win->display, bmask); - + XDefineCursor(win->display,win->basewin, cur); XMapSubwindows(win->display,win->basewin); @@ -866,7 +866,7 @@ setup(dispname, win) ButtonReleaseMask | ExposureMask); XSelectInput(win->display,win->buttonwin, ButtonPressMask | ExposureMask); - + message_init(win); record_init(win); button_draw(win); @@ -900,12 +900,12 @@ drawgrid(win) gc.foreground = win->border.pixel; gc.line_width = 0; gc.line_style = LineSolid; - + XChangeGC(win->display, DefaultGC(win->display, 0), GCFunction | GCPlaneMask | GCForeground | GCLineWidth | GCLineStyle, &gc); - + /* Draw the lines... horizontal, */ for (i = 1; i < SIZE; i++) XDrawLine(win->display, win->boardwin, @@ -923,7 +923,7 @@ drawgrid(win) i * (SQUARE_WIDTH + BORDER_WIDTH) - BORDER_WIDTH / 2, 0, i * (SQUARE_WIDTH + BORDER_WIDTH) - - BORDER_WIDTH / 2, + BORDER_WIDTH / 2, SIZE * (SQUARE_WIDTH + BORDER_WIDTH)); return; } diff --git a/gnu/games/chess/Xchess/xchess.c b/gnu/games/chess/Xchess/xchess.c index 6de6502..74d010f 100644 --- a/gnu/games/chess/Xchess/xchess.c +++ b/gnu/games/chess/Xchess/xchess.c @@ -20,8 +20,8 @@ file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ -/* RCS Info: $Revision: 1.2 $ on $Date: 89/04/28 08:44:02 $ - * $Source: /usr/local/src/source/X.V11R3/contrib/games/xchess/Xchess/RCS/xchess.c,v $ +/* RCS Info: $Revision: 1.1.1.1 $ on $Date: 1993/06/12 14:41:09 $ + * $Source: /home/ncvs/src/gnu/games/chess/Xchess/xchess.c,v $ * Copyright (c) 1986 Wayne A. Christopher, U. C. Berkeley CAD Group * Permission is granted to do anything with this code except sell it * or remove this message. @@ -82,7 +82,7 @@ main(ac, av) char *s; program = av[0]; - + #ifdef notdef signal(SIGCHLD, die); #endif @@ -157,7 +157,7 @@ main(ac, av) if (!dispname2) oneboard = true; - + srandom(getpid()); if (!oneboard && randflag && (random() % 2)) { @@ -165,10 +165,10 @@ main(ac, av) dispname1 = dispname2; dispname2 = s; } - + if (!dispname1) dispname1 = getenv("DISPLAY"); - + /* Set up the board. */ board_setup(); diff --git a/gnu/games/chess/gnuchess.c b/gnu/games/chess/gnuchess.c index da56689..20b32c4 100644 --- a/gnu/games/chess/gnuchess.c +++ b/gnu/games/chess/gnuchess.c @@ -1,5 +1,5 @@ /* - C source for CHESS + C source for CHESS Revision: 4-25-88 @@ -44,7 +44,7 @@ #define neutral 2 #define white 0 -#define black 1 +#define black 1 #define no_piece 0 #define pawn 1 #define knight 2 @@ -164,7 +164,7 @@ short unmap[120]= 40,41,42,43,44,45,46,47,-1,-1,-1,-1,-1,-1,-1,-1, 48,49,50,51,52,53,54,55,-1,-1,-1,-1,-1,-1,-1,-1, 56,57,58,59,60,61,62,63}; -short Dcode[120]= +short Dcode[120]= {0,1,1,1,1,1,1,1,0,0,0,0,0,0,0x0E,0x0F, 0x10,0x11,0x12,0,0,0,0,0,0,0,0,0,0,0,0x0F,0x1F, 0x10,0x21,0x11,0,0,0,0,0,0,0,0,0,0,0x0F,0,0, @@ -287,7 +287,7 @@ short PawnAdvance[64]= 12,16,24,32,32,24,16,12, 12,16,24,32,32,24,16,12, 0, 0, 0, 0, 0, 0, 0, 0}; - + main(argc,argv) int argc; char *argv[]; @@ -331,8 +331,8 @@ short iop; unsigned short *mv; /* - Compare the string 's' to the list of legal moves available for the - opponent. If a match is found, make the move on the board. + Compare the string 's' to the list of legal moves available for the + opponent. If a match is found, make the move on the board. */ { @@ -373,7 +373,7 @@ struct leaf *node; if (xnode.flags & epmask) UpdateDisplay(0,0,1,0); else UpdateDisplay(xnode.f,xnode.t,0,xnode.flags & cstlmask); if (xnode.flags & cstlmask) Game50 = GameCnt; - else if (board[xnode.t] == pawn || (xnode.flags & capture)) + else if (board[xnode.t] == pawn || (xnode.flags & capture)) Game50 = GameCnt; GameList[GameCnt].depth = GameList[GameCnt].score = 0; GameList[GameCnt].nodes = 0; @@ -384,7 +384,7 @@ struct leaf *node; *mv = (xnode.f << 8) + xnode.t; algbr(xnode.f,xnode.t,false); return(true); - } + } } if (cnt > 1) ShowMessage("Ambiguous Move!"); return(false); @@ -464,12 +464,12 @@ SelectMove(side,iop) short side,iop; /* - Select a move by calling function search() at progressively deeper - ply until time is up or a mate or draw is reached. An alpha-beta - window of -90 to +90 points is set around the score returned from the - previous iteration. If Sdepth != 0 then the program has correctly - predicted the opponents move and the search will start at a depth of - Sdepth+1 rather than a depth of 1. + Select a move by calling function search() at progressively deeper + ply until time is up or a mate or draw is reached. An alpha-beta + window of -90 to +90 points is set around the score returned from the + previous iteration. If Sdepth != 0 then the program has correctly + predicted the opponents move and the search will start at a depth of + Sdepth+1 rather than a depth of 1. */ { @@ -495,7 +495,7 @@ static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt; ExaminePosition(); ScorePosition(side,&score); ShowSidetomove(); - + if (Sdepth == 0) { ZeroTTable(); @@ -516,7 +516,7 @@ static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt; NodeCnt = ETnodes = EvalNodes = HashCnt = 0; Zscore = 0; zwndw = 20; } - + while (!timeout && Sdepth < MaxSearchDepth) { Sdepth++; @@ -576,7 +576,7 @@ static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt; if (score == -9999 || score == 9998) mate = true; if (mate) hint = 0; if (root->flags & cstlmask) Game50 = GameCnt; - else if (board[root->t] == pawn || (root->flags & capture)) + else if (board[root->t] == pawn || (root->flags & capture)) Game50 = GameCnt; GameList[GameCnt].score = score; GameList[GameCnt].nodes = NodeCnt; @@ -599,13 +599,13 @@ static short i,alpha,beta,score,tempb,tempc,tempsf,tempst,xside,rpt; OpeningBook() /* - Go thru each of the opening lines of play and check for a match with - the current game listing. If a match occurs, generate a random number. - If this number is the largest generated so far then the next move in - this line becomes the current "candidate". After all lines are - checked, the candidate move is put at the top of the Tree[] array and - will be played by the program. Note that the program does not handle - book transpositions. + Go thru each of the opening lines of play and check for a match with + the current game listing. If a match occurs, generate a random number. + If this number is the largest generated so far then the next move in + this line becomes the current "candidate". After all lines are + checked, the candidate move is put at the top of the Tree[] array and + will be played by the program. Note that the program does not handle + book transpositions. */ { @@ -630,7 +630,7 @@ struct BookEntry *p; } p = p->next; } - + for (pnt = TrPnt[1]; pnt < TrPnt[2]; pnt++) if ((Tree[pnt].f<<8) + Tree[pnt].t == m) Tree[pnt].score = 0; pick(TrPnt[1],TrPnt[2]-1); @@ -658,12 +658,12 @@ short side,ply,depth,alpha,beta,*rpt; unsigned short bstline[]; /* - Perform an alpha-beta search to determine the score for the current - board position. If depth <= 0 only capturing moves, pawn promotions - and responses to check are generated and searched, otherwise all - moves are processed. The search depth is modified for check evasions, - certain re-captures and threats. Extensions may continue for up to 11 - ply beyond the nominal search depth. + Perform an alpha-beta search to determine the score for the current + board position. If depth <= 0 only capturing moves, pawn promotions + and responses to check are generated and searched, otherwise all + moves are processed. The search depth is modified for check evasions, + certain re-captures and threats. Extensions may continue for up to 11 + ply beyond the nominal search depth. */ #define prune (cf && score+node->score < alpha) @@ -683,7 +683,7 @@ struct leaf *node,tmp; NodeCnt++; xside = otherside[side]; if (depth < 0) depth = 0; - + if (ply <= Sdepth+3) repetition(rpt); else *rpt = 0; if (*rpt >= 2) return(0); @@ -693,7 +693,7 @@ struct leaf *node,tmp; bstline[ply] = 0; return(score); } - + if (depth > 0) { if (InChk || PawnThreat[ply-1] || ReCapture) ++depth; @@ -704,7 +704,7 @@ struct leaf *node,tmp; (InChk || PawnThreat[ply-1] || Threat[ply-1])) ++depth; else if (score <= beta && MateThreat) ++depth; } - + if (depth > 0 && hashflag && ply > 1) { ProbeTTable(side,depth,&alpha,&beta,&score); @@ -713,21 +713,21 @@ struct leaf *node,tmp; if (beta == -20000) return(score); if (alpha > beta) return(alpha); } - + if (Sdepth == 1) d = 7; else d = 11; if (ply > Sdepth+d || (depth < 1 && score > beta)) return(score); if (ply > 1) if (depth > 0) MoveList(side,ply); else CaptureList(side,xside,ply); - + if (TrPnt[ply] == TrPnt[ply+1]) return(score); - + cf = (depth < 1 && ply > Sdepth+1 && !ChkFlag[ply-2] && !slk); if (depth > 0) best = -12000; else best = score; if (best > alpha) alpha = best; - + for (pnt = pbst = TrPnt[ply]; pnt < TrPnt[ply+1] && best <= beta; pnt++) @@ -736,7 +736,7 @@ struct leaf *node,tmp; node = &Tree[pnt]; mv = (node->f << 8) + node->t; nxtline[ply+1] = 0; - + if (prune) break; if (ply == 1) UpdateSearchStatus; @@ -789,7 +789,7 @@ struct leaf *node,tmp; if (NodeCnt > ETnodes) ElapsedTime(0); if (timeout) return(-Tscore[ply-1]); } - + node = &Tree[pbst]; mv = (node->f<<8) + node->t; if (hashflag && ply <= Sdepth && *rpt == 0 && best == alpha) @@ -815,13 +815,13 @@ evaluate(side,xside,ply,alpha,beta) short side,xside,ply,alpha,beta; /* - Compute an estimate of the score by adding the positional score from - the previous ply to the material difference. If this score falls - inside a window which is 180 points wider than the alpha-beta window - (or within a 50 point window during quiescence search) call - ScorePosition() to determine a score, otherwise return the estimated - score. If one side has only a king and the other either has no pawns - or no pieces then the function ScoreLoneKing() is called. + Compute an estimate of the score by adding the positional score from + the previous ply to the material difference. If this score falls + inside a window which is 180 points wider than the alpha-beta window + (or within a 50 point window during quiescence search) call + ScorePosition() to determine a score, otherwise return the estimated + score. If one side has only a king and the other either has no pawns + or no pieces then the function ScoreLoneKing() is called. */ { @@ -832,14 +832,14 @@ short s,evflag; (mtl[black] == valueK && (pmtl[white] == 0 || emtl[white] == 0))); s = -Pscore[ply-1] + mtl[side] - mtl[xside]; s -= INCscore; - + if (slk) evflag = false; - else evflag = + else evflag = (ply == 1 || ply < Sdepth || ((ply == Sdepth+1 || ply == Sdepth+2) && (s > alpha-xwndw && s < beta+xwndw)) || (ply > Sdepth+2 && s >= alpha-25 && s <= beta+25)); - + if (evflag) { EvalNodes++; @@ -855,7 +855,7 @@ short s,evflag; InChk = SqAtakd(PieceList[side][0],xside); if (slk) ScoreLoneKing(side,&s); } - + Pscore[ply] = s - mtl[side] + mtl[xside]; if (InChk) ChkFlag[ply-1] = Pindex[TOsquare]; else ChkFlag[ply-1] = 0; @@ -867,7 +867,7 @@ short s,evflag; ProbeTTable(side,depth,alpha,beta,score) short side,depth,*alpha,*beta,*score; -/* +/* Look for the current board position in the transposition table. */ @@ -916,7 +916,7 @@ short hindx; ptbl = (ttable + hindx); ptbl->hashbd = hashbd; ptbl->depth = depth; - ptbl->score = score; + ptbl->score = score; ptbl->mv = mv; ptbl->flags = 0; if (score < alpha) ptbl->flags |= upperbound; @@ -941,10 +941,10 @@ MoveList(side,ply) short side,ply; /* - Fill the array Tree[] with all available moves for side to play. Array - TrPnt[ply] contains the index into Tree[] of the first move at a ply. + Fill the array Tree[] with all available moves for side to play. Array + TrPnt[ply] contains the index into Tree[] of the first move at a ply. */ - + { register short i; short xside,f; @@ -979,16 +979,16 @@ GenMoves(ply,sq,side,xside) short ply,sq,side,xside; /* - Generate moves for a piece. The from square is mapped onto a special - board and offsets (taken from array Dir[]) are added to the mapped - location. The newly generated square is tested to see if it falls off - the board by ANDing the square with 88 HEX. Legal moves are linked - into the tree. + Generate moves for a piece. The from square is mapped onto a special + board and offsets (taken from array Dir[]) are added to the mapped + location. The newly generated square is tested to see if it falls off + the board by ANDing the square with 88 HEX. Legal moves are linked + into the tree. */ - + { register short m,u,d; -short i,m0,piece; +short i,m0,piece; piece = board[sq]; m0 = map[sq]; if (sweep[piece]) @@ -1057,7 +1057,7 @@ short ply,f,t,xside; 2. Capture of last moved piece 3. Other captures (major pieces first) 4. Killer moves - 5. "history" killers + 5. "history" killers */ { @@ -1140,7 +1140,7 @@ struct leaf *node; } PL = PieceList[side]; for (i = 0; i <= PieceCnt[side]; i++) - { + { sq = PL[i]; m0 = map[sq]; piece = board[sq]; j1 = Dstart[piece]; j2 = Dstop[piece]; @@ -1176,7 +1176,7 @@ struct leaf *node; } } #endif - + int castle(side,kf,kt,iop) short side,kf,kt,iop; @@ -1244,7 +1244,7 @@ short l; { board[l] = no_piece; color[l] = neutral; } - else + else { board[l] = pawn; color[l] = xside; } @@ -1257,11 +1257,11 @@ short side,*tempc,*tempb,*tempsf,*tempst; struct leaf *node; /* - Update Arrays board[], color[], and Pindex[] to reflect the new board - position obtained after making the move pointed to by node. Also - update miscellaneous stuff that changes when a move is made. + Update Arrays board[], color[], and Pindex[] to reflect the new board + position obtained after making the move pointed to by node. Also + update miscellaneous stuff that changes when a move is made. */ - + { register short f,t; short xside,ct,cf; @@ -1323,7 +1323,7 @@ short xside,ct,cf; UpdateHashbd(side,queen,f,-1); } INCscore -= *tempsf; - } + } if (board[t] == king) ++kingmoved[side]; if (node->flags & epmask) EnPassant(xside,f,t,1); else if (hashflag) UpdateHashbd(side,board[t],f,t); @@ -1363,7 +1363,7 @@ short xside; UpdateHashbd(side,queen,-1,t); UpdateHashbd(side,pawn,-1,t); } - } + } if (*tempc != neutral) { UpdatePieceList(*tempc,t,2); @@ -1388,10 +1388,10 @@ UpdateHashbd(side,piece,f,t) short side,piece,f,t; /* - hashbd contains a 32 bit "signature" of the board position. hashkey - contains a 16 bit code used to address the hash table. When a move is - made, XOR'ing the hashcode of moved piece on the from and to squares - with the hashbd and hashkey values keeps things current. + hashbd contains a 32 bit "signature" of the board position. hashkey + contains a 16 bit code used to address the hash table. When a move is + made, XOR'ing the hashcode of moved piece on the from and to squares + with the hashbd and hashkey values keeps things current. */ { @@ -1412,8 +1412,8 @@ UpdatePieceList(side,sq,iop) short side,sq,iop; /* - Update the PieceList and Pindex arrays when a piece is captured or - when a capture is unmade. + Update the PieceList and Pindex arrays when a piece is captured or + when a capture is unmade. */ { @@ -1439,13 +1439,13 @@ register short i; InitializeStats() /* - Scan thru the board seeing what's on each square. If a piece is found, - update the variables PieceCnt, PawnCnt, Pindex and PieceList. Also - determine the material for each side and set the hashkey and hashbd - variables to represent the current board position. Array - PieceList[side][indx] contains the location of all the pieces of - either side. Array Pindex[sq] contains the indx into PieceList for a - given square. + Scan thru the board seeing what's on each square. If a piece is found, + update the variables PieceCnt, PawnCnt, Pindex and PieceList. Also + determine the material for each side and set the hashkey and hashbd + variables to represent the current board position. Array + PieceList[side][indx] contains the location of all the pieces of + either side. Array Pindex[sq] contains the indx into PieceList for a + given square. */ { @@ -1477,9 +1477,9 @@ register short i,sq; pick(p1,p2) short p1,p2; -/* - Find the best move in the tree between indexes p1 and p2. Swap the - best move into the p1 element. +/* + Find the best move in the tree between indexes p1 and p2. Swap the + best move into the p1 element. */ { @@ -1535,7 +1535,7 @@ short sq,side; /* See if any piece with color 'side' ataks sq. First check for pawns or king, then try other pieces. Array Dcode is used to check for - knight attacks or R,B,Q co-linearity. + knight attacks or R,B,Q co-linearity. */ { @@ -1550,7 +1550,7 @@ short i,m0,m1,loc,piece,*PL; if (!(m & 0x88)) if (board[unmap[m]] == pawn && color[unmap[m]] == side) return(true); if (distance(sq,PieceList[side][0]) == 1) return(true); - + PL = PieceList[side]; for (i = 1; i <= PieceCnt[side]; i++) { @@ -1584,7 +1584,7 @@ short side,*a; { register short u,m; short d,c,j,j1,j2,piece,i,m0,sq,*PL; - + /* memset((char *)a,0,64*sizeof(short)); */ @@ -1626,9 +1626,9 @@ ScorePosition(side,score) short side,*score; /* - Perform normal static evaluation of board position. A score is - generated for each piece and these are summed to get a score for each - side. + Perform normal static evaluation of board position. A score is + generated for each piece and these are summed to get a score for each + side. */ { @@ -1656,17 +1656,17 @@ short i,xside,pscore[3]; } if (hung[side] > 1) pscore[side] += HUNGX; if (hung[xside] > 1) pscore[xside] += HUNGX; - + *score = mtl[side] - mtl[xside] + pscore[side] - pscore[xside] + 10; if (dither) *score += rand() % dither; - + if (*score > 0 && pmtl[side] == 0) if (emtl[side] < valueR) *score = 0; else if (*score < valueR) *score /= 2; if (*score < 0 && pmtl[xside] == 0) if (emtl[xside] < valueR) *score = 0; else if (-*score < valueR) *score /= 2; - + if (mtl[xside] == valueK && emtl[side] > valueB) *score += 200; if (mtl[side] == valueK && emtl[xside] > valueB) *score -= 200; } @@ -1675,7 +1675,7 @@ short i,xside,pscore[3]; ScoreLoneKing(side,score) short side,*score; -/* +/* Static evaluation when loser has only a king and winner has no pawns or no pieces. */ @@ -1687,19 +1687,19 @@ short winner,loser,king1,king2,s,i; if (mtl[white] > mtl[black]) winner = white; else winner = black; loser = otherside[winner]; king1 = PieceList[winner][0]; king2 = PieceList[loser][0]; - + s = 0; - + if (pmtl[winner] > 0) for (i = 1; i <= PieceCnt[winner]; i++) s += ScoreKPK(side,winner,loser,king1,king2,PieceList[winner][i]); - + else if (emtl[winner] == valueB+valueN) s = ScoreKBNK(winner,king1,king2); - + else if (emtl[winner] > valueB) s = 500 + emtl[winner] - DyingKing[king2] - 2*distance(king1,king2); - + if (side == winner) *score = s; else *score = -s; } @@ -1713,7 +1713,7 @@ short side,winner,loser,king1,king2,sq; { short s,r; - + if (PieceCnt[winner] == 1) s = 50; else s = 120; if (winner == white) { @@ -1883,8 +1883,8 @@ short s,piece,a1,a2,in_square,r,mob,e,c; if (PC2[7] == 0) s += KHOPNX; } } - - if (a2 > 0) + + if (a2 > 0) { c = (control[piece] & 0x4FFF); if (a1 == 0 || a2 > c+1) @@ -1977,8 +1977,8 @@ BRscan(sq,s,mob) short sq,*s,*mob; /* - Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the - hung[] array if a pin is found. + Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the + hung[] array if a pin is found. */ { @@ -2077,9 +2077,9 @@ short i,m0; ExaminePosition() /* - This is done one time before the search is started. Set up arrays - Mwpawn, Mbpawn, Mknight, Mbishop, Mking which are used in the - SqValue() function to determine the positional value of each piece. + This is done one time before the search is started. Set up arrays + Mwpawn, Mbpawn, Mknight, Mbishop, Mking which are used in the + SqValue() function to determine the positional value of each piece. */ { @@ -2114,14 +2114,14 @@ short wpadv,bpadv,wstrong,bstrong,z,side,pp,j,val,Pd,fyle,rank; if (!PawnStorm && stage < 5) PawnStorm = ((column[wking] < 3 && column[bking] > 4) || (column[wking] > 4 && column[bking] < 3)); - + CopyBoard(pknight,Mknight[white]); CopyBoard(pknight,Mknight[black]); CopyBoard(pbishop,Mbishop[white]); CopyBoard(pbishop,Mbishop[black]); BlendBoard(KingOpening,KingEnding,Mking[white]); BlendBoard(KingOpening,KingEnding,Mking[black]); - + for (sq = 0; sq < 64; sq++) { fyle = column[sq]; rank = row[sq]; @@ -2159,7 +2159,7 @@ short wpadv,bpadv,wstrong,bstrong,z,side,pp,j,val,Pd,fyle,rank; if ((column[bking] < 4 && fyle > 4) || (column[bking] > 3 && fyle < 3)) Mbpawn[sq] -= 3*rank; } - + Mknight[white][sq] += 5 - distance(sq,bking); Mknight[white][sq] += 5 - distance(sq,wking); Mknight[black][sq] += 5 - distance(sq,wking); @@ -2176,19 +2176,19 @@ short wpadv,bpadv,wstrong,bstrong,z,side,pp,j,val,Pd,fyle,rank; if (bstrong) Mknight[black][sq] += KNIGHTSTRONG; if (wstrong) Mbishop[white][sq] += BISHOPSTRONG; if (bstrong) Mbishop[black][sq] += BISHOPSTRONG; - + if (HasBishop[white] == 2) Mbishop[white][sq] += 8; if (HasBishop[black] == 2) Mbishop[black][sq] += 8; if (HasKnight[white] == 2) Mknight[white][sq] += 5; if (HasKnight[black] == 2) Mknight[black][sq] += 5; - + if (board[sq] == bishop) if (rank % 2 == fyle % 2) KBNKsq = 0; else KBNKsq = 7; - + Kfield[white][sq] = Kfield[black][sq] = 0; if (distance(sq,wking) == 1) Kfield[black][sq] = KATAK; if (distance(sq,bking) == 1) Kfield[white][sq] = KATAK; - + Pd = 0; for (i = 0; i < 64; i++) if (board[i] == pawn) @@ -2221,9 +2221,9 @@ short wpadv,bpadv,wstrong,bstrong,z,side,pp,j,val,Pd,fyle,rank; UpdateWeights() -/* - If material balance has changed, determine the values for the - positional evaluation terms. +/* + If material balance has changed, determine the values for the + positional evaluation terms. */ { @@ -2241,7 +2241,7 @@ short tmtl; if (tmtl > 3600) stage2 = 0; else if (tmtl < 1400) stage2 = 10; else stage2 = (3600-tmtl) / 220; - + PEDRNK2B = -15; /* centre pawn on 2nd rank & blocked */ PBLOK = -4; /* blocked backward pawn */ PDOUBLED = -14; /* doubled pawn */ @@ -2250,27 +2250,27 @@ short tmtl; PADVNCM = 10; /* advanced pawn multiplier */ PADVNCI = 7; /* muliplier for isolated pawn */ PawnBonus = stage; - + KNIGHTPOST = (stage+2)/3; /* knight near enemy pieces */ KNIGHTSTRONG = (stage+6)/2; /* occupies pawn hole */ - + BISHOPSTRONG = (stage+6)/2; /* occupies pawn hole */ BishopBonus = 2*stage; - + RHOPN = 10; /* rook on half open file */ RHOPNX = 4; RookBonus = 6*stage; - + XRAY = 8; /* Xray attack on piece */ PINVAL = 10; /* Pin */ - + KHOPN = (3*stage-30) / 2; /* king on half open file */ KHOPNX = KHOPN / 2; KCASTLD = 10 - stage; KMOVD = -40 / (stage+1); /* king moved before castling */ KATAK = (10-stage) / 2; /* B,R attacks near enemy king */ if (stage < 8) KSFTY = 16-2*stage; else KSFTY = 0; - + ATAKD = -6; /* defender > attacker */ HUNGP = -8; /* each hung piece */ HUNGX = -12; /* extra for >1 hung piece */ diff --git a/gnu/games/chess/gnuchess.h b/gnu/games/chess/gnuchess.h index 6e9c74b..ee6442e 100644 --- a/gnu/games/chess/gnuchess.h +++ b/gnu/games/chess/gnuchess.h @@ -21,11 +21,11 @@ */ -/* Header file for GNU CHESS */ +/* Header file for GNU CHESS */ #define neutral 2 #define white 0 -#define black 1 +#define black 1 #define no_piece 0 #define pawn 1 #define knight 2 diff --git a/gnu/games/chess/move.c b/gnu/games/chess/move.c index 4ce686c..b4b0d42 100644 --- a/gnu/games/chess/move.c +++ b/gnu/games/chess/move.c @@ -161,7 +161,7 @@ short sq,side; u = p[u].nextpos; } else { - if (color[u] == side && + if (color[u] == side && (board[u] == queen || board[u] == bishop)) return(true); u = p[u].nextdir; @@ -175,7 +175,7 @@ short sq,side; u = p[u].nextpos; } else { - if (color[u] == side && + if (color[u] == side && (board[u] == queen || board[u] == rook)) return(true); u = p[u].nextdir; @@ -201,8 +201,8 @@ short sq,side; BRscan(sq,s,mob) short sq,*s,*mob; /* - Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the - hung[] array if a pin is found. + Find Bishop and Rook mobility, XRAY attacks, and pins. Increment the + hung[] array if a pin is found. */ { register short u,piece,pin; @@ -260,7 +260,7 @@ short side,xside,ply; register struct sqdata *p; short i,piece,*PL; struct leaf *node; - + TrPnt[ply+1] = TrPnt[ply]; node = &Tree[TrPnt[ply]]; PL = PieceList[side]; @@ -312,17 +312,17 @@ short side,xside,ply; #if (NEWMOVE > 5) GenMoves(ply,sq,side,xside) short ply,sq,side,xside; - + /* Generate moves for a piece. The moves are taken from the precalulated array posdata. If the board is free, next move is choosen from nextpos else from nextdir. */ - + { register short u,piece; register struct sqdata *p; - + piece = board[sq]; p = posdata[side][piece][sq]; if (piece == pawn) { @@ -339,7 +339,7 @@ GenMoves(ply,sq,side,xside) } u = p[u].nextpos; } - } + } else { u = p[sq].nextpos; while (u != sq) { @@ -352,6 +352,6 @@ GenMoves(ply,sq,side,xside) u = p[u].nextdir; } } - } -} + } +} #endif diff --git a/gnu/games/chess/move.h b/gnu/games/chess/move.h index 2f32830..3294e4a 100644 --- a/gnu/games/chess/move.h +++ b/gnu/games/chess/move.h @@ -11,7 +11,7 @@ extern short taxidata[64][64]; extern void Initialize_dist(); #endif - + #if (NEWMOVE >= 2) struct sqdata { short nextpos; diff --git a/gnu/games/chess/nondsp.c b/gnu/games/chess/nondsp.c index 0b29ad5..bec36d3 100644 --- a/gnu/games/chess/nondsp.c +++ b/gnu/games/chess/nondsp.c @@ -1,8 +1,8 @@ /* UNIX & MSDOS NON-DISPLAY, AND CHESSTOOL interface for Chess - + Revision: 4-25-88 - + Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. Copyright (c) 1988 John Stanback @@ -90,12 +90,12 @@ TerminateSearch() InputCommand() /* - Process the users command. If easy mode is OFF (the computer is - thinking on opponents time) and the program is out of book, then make - the 'hint' move on the board and call SelectMove() to find a response. - The user terminates the search by entering ^C (quit siqnal) before - entering a command. If the opponent does not make the hint move, then - set Sdepth to zero. + Process the users command. If easy mode is OFF (the computer is + thinking on opponents time) and the program is out of book, then make + the 'hint' move on the board and call SelectMove() to find a response. + The user terminates the search by entering ^C (quit siqnal) before + entering a command. If the opponent does not make the hint move, then + set Sdepth to zero. */ { @@ -124,7 +124,7 @@ char s[80]; ft = time((long *)0) - time0; epsquare = tmp; } - + #ifndef MSDOS #endif while (!(ok || quit)) @@ -139,7 +139,7 @@ char s[80]; Sdepth = 0; ft = 0; } - + if (strcmp(s,"bd") == 0) { ClrScreen(); @@ -183,7 +183,7 @@ char s[80]; Sdepth = 0; ok = true; } - if (strcmp(s,"white") == 0) + if (strcmp(s,"white") == 0) { computer = white; opponent = black; ok = true; force = false; @@ -196,7 +196,7 @@ char s[80]; Sdepth = 0; } if (strcmp(s,"undo") == 0 && GameCnt >= 0) Undo(); - if (strcmp(s,"remove") == 0 && GameCnt >= 1) + if (strcmp(s,"remove") == 0 && GameCnt >= 1) { Undo(); Undo(); } @@ -221,7 +221,7 @@ char s[80]; printz("cnt= %ld rate= %ld\n",cnt,rate); } } - + ElapsedTime(1); if (force) { @@ -272,7 +272,7 @@ help() printz("Easy mode: "); if (easy) printz("ON\n"); else printz("OFF\n"); printz("Depth: %d\n",MaxSearchDepth); - printz("Random: "); + printz("Random: "); if (dither) printz("ON\n"); else printz("OFF\n"); printz("Transposition table: "); if (hashflag) printz("ON\n"); else printz("OFF\n"); @@ -282,10 +282,10 @@ help() EditBoard() -/* - Set up a board position. Pieces are entered by typing the piece - followed by the location. For example, Nf3 will place a knight on - square f3. +/* + Set up a board position. Pieces are entered by typing the piece + followed by the location. For example, Nf3 will place a knight on + square f3. */ { @@ -297,7 +297,7 @@ char s[80]; printz(". exit to main\n"); printz("# clear board\n"); printz("enter piece & location: \n"); - + a = white; do { @@ -399,12 +399,12 @@ OutputMove() NodeCnt,EvalNodes,HashCnt,evrate); printz("CPU= %.2ld:%.2ld.%.2ld\n\n", cputimer/6000,(cputimer % 6000)/100,cputimer % 100); - + if (root->flags & epmask) UpdateDisplay(0,0,1,0); else UpdateDisplay(root->f,root->t,0,root->flags & cstlmask); printz("My move is: %s\n\n",mvstr1); if (beep) printz("%c",7); - + if (root->flags & draw) printz("Draw game!\n"); else if (root->score == -9999) printz("opponent mates!\n"); else if (root->score == 9998) printz("computer mates!\n"); @@ -417,10 +417,10 @@ OutputMove() ElapsedTime(iop) short iop; -/* - Determine the time that has passed since the search was started. If - the elapsed time exceeds the target (ResponseTime+ExtraTime) then set - timeout to true which will terminate the search. +/* + Determine the time that has passed since the search was started. If + the elapsed time exceeds the target (ResponseTime+ExtraTime) then set + timeout to true which will terminate the search. */ { @@ -508,12 +508,12 @@ short r,c,l; GetOpenings() /* - Read in the Opening Book file and parse the algebraic notation for a - move into an unsigned integer format indicating the from and to - square. Create a linked list of opening lines of play, with - entry->next pointing to the next line and entry->move pointing to a - chunk of memory containing the moves. More Opening lines of up to 256 - half moves may be added to gnuchess.book. + Read in the Opening Book file and parse the algebraic notation for a + move into an unsigned integer format indicating the from and to + square. Create a linked list of opening lines of play, with + entry->next pointing to the next line and entry->move pointing to a + chunk of memory containing the moves. More Opening lines of up to 256 + half moves may be added to gnuchess.book. */ { @@ -542,7 +542,7 @@ unsigned short mv,*mp,tmp[100]; mp = (unsigned short *)malloc((i+1)*sizeof(unsigned short)); entry->mv = mp; entry->next = Book; - Book = entry; + Book = entry; for (j = 1; j <= i; j++) *(mp++) = tmp[j]; *mp = 0; i = 0; side = white; @@ -640,7 +640,7 @@ short sq,i,c; printz("Enter file name: "); scanz("%s",fname); - + if (fname[0] == '\0' || access(fname,W_OK) == -1) strcpy(fname,"chess.000"); fd = fopen(fname,"w"); fprintf(fd,"%d %d %d\n",computer+1,opponent+1,Game50); @@ -687,7 +687,7 @@ short i,f,t; } fprintf(fd,"\n\n"); fclose(fd); -} +} Undo() diff --git a/gnu/games/chess/uxdsp.c b/gnu/games/chess/uxdsp.c index d584738..84034bc 100644 --- a/gnu/games/chess/uxdsp.c +++ b/gnu/games/chess/uxdsp.c @@ -1,8 +1,8 @@ /* ALPHA interface for CHESS - + Revision: 4-25-88 - + Copyright (C) 1986, 1987, 1988 Free Software Foundation, Inc. Copyright (c) 1988 John Stanback @@ -88,12 +88,12 @@ TerminateSearch() InputCommand() /* - Process the users command. If easy mode is OFF (the computer is - thinking on opponents time) and the program is out of book, then make - the 'hint' move on the board and call SelectMove() to find a response. - The user terminates the search by entering ^C (quit siqnal) before - entering a command. If the opponent does not make the hint move, then - set Sdepth to zero. + Process the users command. If easy mode is OFF (the computer is + thinking on opponents time) and the program is out of book, then make + the 'hint' move on the board and call SelectMove() to find a response. + The user terminates the search by entering ^C (quit siqnal) before + entering a command. If the opponent does not make the hint move, then + set Sdepth to zero. */ { @@ -123,7 +123,7 @@ char s[80]; ft = time((time_t *)0) - time0; epsquare = tmp; } - + signal(SIGINT,Die); signal(SIGQUIT,Die); while (!(ok || quit)) { @@ -136,7 +136,7 @@ char s[80]; Sdepth = 0; ft = 0; } - + if (strcmp(s,"bd") == 0) { ClrScreen(); @@ -179,7 +179,7 @@ char s[80]; Sdepth = 0; ok = true; } - if (strcmp(s,"white") == 0) + if (strcmp(s,"white") == 0) { computer = white; opponent = black; ok = true; force = false; @@ -191,7 +191,7 @@ char s[80]; ok = true; force = false; Sdepth = 0; } - if (strcmp(s,"remove") == 0 && GameCnt >= 1) + if (strcmp(s,"remove") == 0 && GameCnt >= 1) { Undo(); Undo(); } @@ -220,7 +220,7 @@ char s[80]; if (strcmp(s,"p") == 0) ShowPostnValues(); if (strcmp(s,"debug") == 0) DoDebug(); } - + ClearMessage(); ElapsedTime(1); if (force) @@ -234,10 +234,10 @@ char s[80]; EditBoard() -/* - Set up a board position. Pieces are entered by typing the piece - followed by the location. For example, Nf3 will place a knight on - square f3. +/* + Set up a board position. Pieces are entered by typing the piece + followed by the location. For example, Nf3 will place a knight on + square f3. */ { @@ -322,7 +322,7 @@ help() gotoXY(10,24); printz("Easy mode: "); if (easy) printz("ON"); else printz("OFF"); gotoXY(40,21); printz("Depth: %d",MaxSearchDepth); - gotoXY(40,22); printz("Random: "); + gotoXY(40,22); printz("Random: "); if (dither) printz("ON"); else printz("OFF"); gotoXY(40,23); printz("Transposition table: "); if (hashflag) printz("ON"); else printz("OFF"); @@ -390,7 +390,7 @@ OutputMove() gotoXY(50,17); printz("My move is: %s",mvstr1); if (beep) putchar(7); ClrEoln(); - + gotoXY(50,24); if (root->flags & draw) printz("Draw game!"); else if (root->score == -9999) printz("opponent mates!"); @@ -398,7 +398,7 @@ OutputMove() else if (root->score < -9000) printz("opponent will soon mate!"); else if (root->score > 9000) printz("computer will soon mate!"); ClrEoln(); - + if (post) { gotoXY(50,22); printz("Nodes= %6ld",NodeCnt); ClrEoln(); @@ -409,10 +409,10 @@ OutputMove() ElapsedTime(iop) -/* - Determine the time that has passed since the search was started. If - the elapsed time exceeds the target (ResponseTime+ExtraTime) then set - timeout to true which will terminate the search. +/* + Determine the time that has passed since the search was started. If + the elapsed time exceeds the target (ResponseTime+ExtraTime) then set + timeout to true which will terminate the search. */ short iop; @@ -515,7 +515,7 @@ short r,c; char x; UpdateDisplay(f,t,flag,iscastle) short f,t,flag,iscastle; { -short i,l,z; +short i,l,z; if (flag) { gotoXY(56,2); printz("CHESS"); @@ -557,12 +557,12 @@ short i,l,z; GetOpenings() /* - Read in the Opening Book file and parse the algebraic notation for a - move into an unsigned integer format indicating the from and to - square. Create a linked list of opening lines of play, with - entry->next pointing to the next line and entry->move pointing to a - chunk of memory containing the moves. More Opening lines of up to 256 - half moves may be added to gnuchess.book. + Read in the Opening Book file and parse the algebraic notation for a + move into an unsigned integer format indicating the from and to + square. Create a linked list of opening lines of play, with + entry->next pointing to the next line and entry->move pointing to a + chunk of memory containing the moves. More Opening lines of up to 256 + half moves may be added to gnuchess.book. */ { @@ -587,7 +587,7 @@ unsigned short mv,*mp,tmp[100]; mp = (unsigned short *)malloc((i+1)*sizeof(unsigned short)); entry->mv = mp; entry->next = Book; - Book = entry; + Book = entry; for (j = 1; j <= i; j++) *(mp++) = tmp[j]; *mp = 0; i = 0; side = white; @@ -690,7 +690,7 @@ short sq,i,c; ShowMessage("File name: "); scanz("%s",fname); - + if (fname[0] == '\0' || access(fname,W_OK) == -1) strcpy(fname,"chess.000"); fd = fopen(fname,"w"); fprintf(fd,"%d %d %d\n",computer+1,opponent+1,Game50); @@ -737,7 +737,7 @@ short i,f,t; } fprintf(fd,"\n\n"); fclose(fd); -} +} Undo() @@ -851,7 +851,7 @@ SelectLevel() gotoXY(20,11); printz(" 8. 1 move in 15 minutes"); gotoXY(20,12); printz(" 9. 1 move in 60 minutes"); gotoXY(20,13); printz("10. 1 move in 600 minutes"); - + OperatorTime = 0; TCmoves = 60; TCminutes = 5; gotoXY(20,17); printz("Enter Level: "); |