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

⟦ac970cfc2⟧ TextFile

    Length: 968 (0x3c8)
    Types: TextFile
    Names: »playscore.c«

Derivation

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

TextFile

#include "defs.h"
#include "globs.h"

int
playscore()
{
	int hold, low;
	hold = 0;
	if (count == 15 || count == 31) hold=2;
	if (gocount > 1 && RANK(go[gocount-2])==RANK(go[gocount-1])) {
		hold += 2;
		if (gocount > 2 && RANK(go[gocount-3])==RANK(go[gocount-2])) {
			hold += 4;
			if (gocount > 3 && RANK(go[gocount-4])==
			RANK(go[gocount-3])) hold += 6;
		}
		return hold;	/* No need to check for runs */
	}
	if (gocount < 3) return hold;
	for (low=0; low<gocount-2; low++)
	if (isplrun(low, gocount-low)) return hold+gocount-low;
	return hold;
}

int
isplrun(start, num)
int start, num;
{
	int highest, lowest, i;
	register mask;
	lowest = KING;
	highest = ACE;
	for (i=start; i<start+num; i++) {
		if (RANK(go[i])>highest) highest=RANK(go[i]);
		if (RANK(go[i])<lowest) lowest=RANK(go[i]);
	}
	if (highest != lowest+num-1) return 0;
/*
 *	Use a mask.
 */
	mask = (1<<num)-1;
	for (i=start; i<start+num; i++) mask &= ~(1<<(RANK(go[i])-lowest));
	return !mask;
}