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 m

⟦dec8666f9⟧ TextFile

    Length: 840 (0x348)
    Types: TextFile
    Names: »mate.c«

Derivation

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

TextFile

/* mate.c */

#include "externs.h"

mate (pawnattempts, color)
	int pawnattempts, color;
{
	LIST l, tos, piecemoves ();
	int from, to;

	l = piecelocs [color];
	while (l != NIL) {
		from = l->i;
		l = l->n;
		tos = piecemoves (from, FALSE);
		while (tos != NIL) {
			to = tos->i;
			tos = tos->n;
			if (moveintocheck (from, to))
				continue;
			if (occupant [from] == PAWN
			&& from % 10 != to % 10
			&& pawnattempts > 3
			&& option [ANNOUNCEPAWNS] == TRUE)
				continue;
			return FALSE;
		}
	}
	return TRUE;
}
      
insufficient ()
{
	int i, p, minorpieces = 0;
	LIST l;

	for (i = 0; i < 2; i++) {
		l = piecelocs [i];
		while (l != NIL) {
			p = occupant [l->i];
			if (p == QUEEN || p == ROOK || p == PAWN)
				return FALSE;
			if (p == KNIGHT || p == BISHOP)
				minorpieces++;
			l = l->n;
		}
	}
	return (minorpieces <= 2);
}