games/ching/phx/ching.phx.c
/*
 * Compute the hexagram number, given the trigrams.
 */
Compute the hexagram number, given the trigrams.
Compute the hexagram number given the trigrams .
int
doahex()
{
	int lower, upper;	
	int lnum, unum;		
	register int i;
	lower = codem(0);
	upper = codem(3);
	for (i = 0; i < 8; i++) {
		if (table[i].lines == lower)
			 lnum = table[i].trinum;
		if (table[i].lines == upper)
			 unum = table[i].trinum;
	}
	return(crosstab[lnum][unum]);
}
int doahex ( ) { int lower , upper ; int lnum , unum ; register int i ; lower = codem ( 0 ) ; upper = codem ( 3 ) ; for ( i = 0 ; i < 8 ; i ++ ) { if ( table [ i ] . lines == lower ) lnum = table [ i ] . trinum ; if ( table [ i ] . lines == upper ) unum = table [ i ] . trinum ; } return ( crosstab [ lnum ] [ unum ] ) ; }
Compute the hexagram number, given the trigrams.
Compute the hexagram number given the trigrams .
/* encoded values of lower and upper trigrams */ /* indices of upper and lower trigrams */