|
|
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 p
Length: 834 (0x342)
Types: TextFile
Names: »pawntries.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Kriegspiel/pawntries.c«
/* "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;
}
}