DataMuseum.dk

Presents historical artifacts from the history of:

DKUUG/EUUG Conference tapes

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about DKUUG/EUUG Conference tapes

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download
Index: T o

⟦b07fc5b36⟧ TextFile

    Length: 2793 (0xae9)
    Types: TextFile
    Names: »output.c«

Derivation

└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
    └─⟦this⟧ »EUUGD18/General/Kriegspiel/output.c« 

TextFile

/* output.c */

#include "externs.h"
#include <strings.h>

redraw ()
{
	int i;

	if (vtterm) {
		/* make characters double-width on a vt100 type terminal */
		overwrite (stdscr, backupscreen);
		overwrite (blankscreen, stdscr);
		refresh ();
		printf("\0337\033[0;0H\033#6"); /* save cursor, home,
						   and widen first line */
		for (i = 1; i <= LINES - 1; i++)
			printf("\n\033#6");	/* wide next line */
		printf("\0338");		/* restore cursor */
		overwrite (backupscreen, stdscr);
		refresh();
	} else
		wrefresh(curscr);
}

reportchecks (checkdirs, kingloc)
	LIST checkdirs;
	int kingloc;
{
	LIST l, lmember ();
	int quadrant, n;
	char str [2] [40];

	n = 0;
	quadrant = ((kingloc % 10 > 4) == (kingloc/10 < 5));
	if (lmember (-9, checkdirs) || lmember (9, checkdirs))
		if (quadrant == 1)
			strcpy (str[n++], "long diagonal\n");
		else
			strcpy (str[n++], "short diagonal\n");
	if (lmember (-11, checkdirs) || lmember (11, checkdirs))
		if (quadrant == 0)
			strcpy (str[n++], "long diagonal\n");
		else
			strcpy (str[n++], "short diagonal\n");
	if (lmember (-10, checkdirs) || lmember (10, checkdirs))
		strcpy (str[n++], "file\n");
	if (lmember (-1, checkdirs) || lmember (1, checkdirs))
		strcpy (str[n++], "rank\n");
	l = dirlist [KNIGHT];
	while (l != NIL) {
		if (lmember (l->i, checkdirs))
			strcpy (str[n++], "knight\n");
		l = l->n;
	}
	if (n > 0) {
		waddstr (win [CHECK], "check by the\n");
		waddstr (win [CHECK], str[0]);
	}
	if (n == 2) {
		waddstr (win [CHECK], "and ");
		waddstr (win [CHECK], str[1]);
	}
	refresh();
}

illegal (why, color)
	int color, why;
{
	wclear (win [LEGAL]);
	if (why == ILLEGAL)
		waddstr (win [LEGAL], "illegal");
	else if (color == ourcolor)
		switch (why) {
		case ILLEGAL_PIECE:
			waddstr (win [LEGAL], "illegal piece");
			break;
		case ILLEGAL_FORMAT:
			waddstr (win [LEGAL], "illegal format");
			wclear (win [MESSAGE]);
			waddstr (win [MESSAGE],
				 "(type help)\n");
			break;
		case AMBIGUOUS_TO:
			waddstr (win [LEGAL], "to which square?");
			break;
		case AMBIGUOUS_FROM:
			waddstr (win [LEGAL], "from which?");
			break;
		case AMBIGUOUS:
			waddstr (win [LEGAL], "ambiguous");
			break;
		case NOPAWNTRIES:
			waddstr (win [LEGAL], "no pawntries");
			break;
		case NOMOREPAWNTRIES:
			waddstr (win [LEGAL], "3 pawns tried");
			break;
		case BADPAWNPUSH:
		case NO_FROM:
			waddstr (win [LEGAL], "from where?");
			break;
		case NO_MOVE:
			waddstr (win [LEGAL], "how?");
			break;
		case KING_MOVED:
			waddstr (win [LEGAL], "king has moved");
			break;
		case ROOK_MOVED:
			waddstr (win [LEGAL], "rook has moved");
			break;
		case PIECE_IN_WAY:
			waddstr (win [LEGAL], "piece in way");
			break;
		case NO_PIECE:
			waddstr (win [LEGAL], "no piece there");
			break;
		}
	else
		waddstr (win [LEGAL], "nope");
}