|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T r
Length: 2067 (0x813) Types: TextFile Names: »review.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987 └─⟦this⟧ »EUUGD18/General/Kriegspiel/review.c«
/* review.c */ #include "externs.h" #include <ctype.h> #include <sys/ioctl.h> review () { int color = WHITE; MOVELIST m; struct sgttyb termcap_stuff; initdirlists (); initpiecelocs (); initboard (TRUE); ioctl (0, TIOCGETP, &termcap_stuff); if (termcap_stuff.sg_ospeed > B1800) { touchwin (stdscr); redraw (); } else refresh (); m = movelist; waddstr (win [MESSAGE], "hit a key for\neach move\n"); while (m) { makereviewmove (m -> from, m -> to, color); m = m -> n; if (m) move (square [m -> from] -> _begy, square [m -> from] -> _begx); refresh(); if (m && occupant[m->from] == KING && (m->to - m->from == 2 || m->to - m->from == -2)) /* do nothing */; else { /* not castling */ color = 1 - color; while (getchar () == '\f') redraw (); } } } makereviewmove (from, to, color) int from, to, color; { int victim, i, j; wclear (win [INPUT]); waddstr (win [INPUT], ": "); i = from; j = to; if (occupant [from] != KING || (to - from != 2 && to - from != -2)) { /* not castling */ if (option [REVERSE] && ourcolor == BLACK) { i = 99 - from; j = 99 - to; } waddch (win [INPUT], 'a' + (i % 10) - 1); waddch (win [INPUT], '0' + (9 - (i / 10))); waddch (win [INPUT], '-'); waddch (win [INPUT], 'a' + (j % 10) - 1); waddch (win [INPUT], '0' + (9 - (j / 10))); } else if (to - from == 2) waddstr (win [INPUT], "o-o"); else waddstr (win [INPUT], "o-o-o"); if (victim = findvictim (from, to)) { whose [victim] = EMPTY; waddch (square [victim], sqcolor[(victim + victim / 10) % 2]); } if (occupant [from] == KING) kingloc [color] = to; whose [to] = color; occupant [to] = occupant [from]; whose [from] = EMPTY; occupant [from] = 0; if (occupant [to] == PAWN && ((to / 10 == 1 && color == WHITE) || (to / 10 == 8 && color == BLACK))) occupant [to] = QUEEN; waddch (square [from], sqcolor [(from + from / 10) % 2]); if (whose [to] == ourcolor) waddch (square [to], symbol [occupant [to]]); else waddch (square [to], tolower (symbol [occupant [to]])); }