/** DebugLog **/
/** This function keeps counts of bits and fil# **/
/** of the winning positions **/

#define MAXITEMS	10000

long	FilTotal[4];
long	BitsTotal[17];
int		FilItems[MAXITEMS];
int		BitItems[MAXITEMS];
long	ItemCount = 0;
long	ItemWrap = 0;
long	BitsError = 0L;
long	FilError = 0L;

DebugLogPrint() {
	long i;
	printf("\n Results of Debug Logger:");
	printf("\n ------------------------");
	printf("\n Filters: 0:%ld 1:%ld 2:%ld 3:%ld ",
			FilTotal[0],FilTotal[1], FilTotal[2], FilTotal[3]);
        printf("\n\n Bits:");
	for (i = 0; i < 17; i++) {
		if ((i%4) == 0) {
			printf("\n");
		}
		printf("%ld:%ld  ",i,BitsTotal[i]);
	}
	printf("\n Errors: Fil:%ld Bits:%ld ",FilError,BitsError);
	printf(" Item Count:%ld   ItemWrap:%ld ",ItemCount,ItemWrap);
	return(0);
}


DebugLogInit() {
	long i;
	BitsError = 0L;
	FilError = 0L;
	ItemWrap = 0L;
	ItemCount = 0L;
	for (i = 0L; i < ((long) MAXITEMS); i++) {
		FilItems[i] = -1L;
		BitItems[i] = -1L;
	}
	for (i = 0L; i < ((long) 4); i++) {
		FilTotal[i] = 0L;
	}
	for (i = 0L; i < ((long) 17); i++) {
		BitsTotal[i] = 0L;
	}
	return(0);
}

DebugLog(int Fil, int Bits) {
	if (Fil < 4) {
		FilTotal[Fil]++;
	}
	else {
		FilError++;
	}
	if (Bits < 17) {
		BitsTotal[Bits]++;
	}
	else {
		BitsError++;
	}
	FilItems[ItemWrap] = Fil;
	BitItems[ItemWrap] = Bits;
	ItemCount++;
	ItemWrap++;
	if (ItemWrap >= ((long) MAXITEMS)) {
		ItemWrap = 0;
	}
	return(0);
}