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 p

⟦7c82b6dd0⟧ TextFile

    Length: 834 (0x342)
    Types: TextFile
    Names: »pawntries.c«

Derivation

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

TextFile

/* "pawntries.c */

#include "externs.h"

countpawntries (color) 
	int color;
{
	LIST l, moves, piecemoves ();
	int tries, /* move,*/ start, end;

	tries = 0;
	l = piecelocs [color];
	while (l != NIL) {
		start = l->i;
		l = l->n;
		if (occupant [start] != PAWN)
			continue;
		moves = piecemoves (start, FALSE);
		while (moves != NIL) {
			end = moves->i;
			moves = moves->n;
			if (start % 10 == end % 10)
				continue;
			if (moveintocheck (start, end))
				continue;
			tries++;
		}
	}
	return tries;
}


findvictim (from, to)
	int from, to;
{
	if (occupant [from] == PAWN) {
		if (from % 10 == to % 10)
			return FALSE;
		if (whose [to] == 1 - whose [from])
			return to;
		else
			return (to - pawndir [whose [from]]);  /* en passent */
	} else {
		if (whose [to] == 1 - whose[from])
			return to;
		else
			return FALSE;
	}
}