src/z-dice.c
static dice_state_t dice_parse_state_transition(dice_state_t state,
												dice_input_t input)
{
	static unsigned char state_table[DICE_STATE_MAX][DICE_INPUT_MAX] = {
		/* Input:								&-+dm$DU0 */
		/*[DICE_STATE_START] = */	   /* A */ ".B.EHKB..",
		/*[DICE_STATE_BASE_DIGIT] = */  /* B */ "..CE..B.C",
		/*[DICE_STATE_FLUSH_BASE] = */  /* C */ "...EHKD..",
		/*[DICE_STATE_DICE_DIGIT] = */  /* D */ "...E..D..",
		/*[DICE_STATE_FLUSH_DICE] = */  /* E */ ".....KF..",
		/*[DICE_STATE_SIDE_DIGIT] = */  /* F */ "G...H.F.G",
		/*[DICE_STATE_FLUSH_SIDE] = */  /* G */ "....H....",
		/*[DICE_STATE_BONUS] = */	   /* H */ ".....KI..",
		/*[DICE_STATE_BONUS_DIGIT] = */ /* I */ "......I.J",
		/*[DICE_STATE_FLUSH_BONUS] = */ /* J */ ".........",
		/*[DICE_STATE_VAR] = */		 /* K */ ".......L.",
		/*[DICE_STATE_VAR_CHAR] = */	/* L */ "G.CEH..LM",
		/*[DICE_STATE_FLUSH_ALL] = */   /* M */ "........."
	};

	if (state == DICE_STATE_MAX || input == DICE_INPUT_MAX)
		return DICE_STATE_MAX;

	if (state_table[state][input] == '.')
		return DICE_STATE_MAX;

	return state_table[state][input] - 'A';
}
/**
 * Perform a state transition for the given state and input.
 *
 * The state table is contained within this function, using a compact
 * char-based format.
 *
 * \param state is the current state.
 * \param input is the input type to transition with.
 * \return The next state for the input, Or DICE_STATE_MAX for an invalid transition.
 */
Perform a state transition for the given state and input.
The state table is contained within this function, using a compact
char-based format.

\param state is the current state.
\param input is the input type to transition with.
\return The next state for the input, Or DICE_STATE_MAX for an invalid transition.
Perform a state transition for the given state and input . The state table is contained within this function using a compact char - based format . \ param state is the current state . \ param input is the input type to transition with . \ return The next state for the input Or DICE_STATE_MAX for an invalid transition .
static dice_state_t dice_parse_state_transition(dice_state_t state,
												dice_input_t input)
{
	static unsigned char state_table[DICE_STATE_MAX][DICE_INPUT_MAX] = {
			    ".B.EHKB..",
		   "..CE..B.C",
		   "...EHKD..",
		   "...E..D..",
		   ".....KF..",
		   "G...H.F.G",
		   "....H....",
			    ".....KI..",
		  "......I.J",
		  ".........",
				  ".......L.",
			 "G.CEH..LM",
		    "........."
	};
	if (state == DICE_STATE_MAX || input == DICE_INPUT_MAX)
		return DICE_STATE_MAX;
	if (state_table[state][input] == '.')
		return DICE_STATE_MAX;
	return state_table[state][input] - 'A';
}
static dice_state_t dice_parse_state_transition ( dice_state_t state , dice_input_t input ) { static unsigned char state_table [ DICE_STATE_MAX ] [ DICE_INPUT_MAX ] = { " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " , " " } ; if ( state == DICE_STATE_MAX || input == DICE_INPUT_MAX ) return DICE_STATE_MAX ; if ( state_table [ state ] [ input ] == ' ' ) return DICE_STATE_MAX ; return state_table [ state ] [ input ] - ' ' ; }
Perform a state transition for the given state and input.
Perform a state transition for the given state and input .
/* Input:								&-+dm$DU0 */ /*[DICE_STATE_START] = */ /* A */ /*[DICE_STATE_BASE_DIGIT] = */ /* B */ /*[DICE_STATE_FLUSH_BASE] = */ /* C */ /*[DICE_STATE_DICE_DIGIT] = */ /* D */ /*[DICE_STATE_FLUSH_DICE] = */ /* E */ /*[DICE_STATE_SIDE_DIGIT] = */ /* F */ /*[DICE_STATE_FLUSH_SIDE] = */ /* G */ /*[DICE_STATE_BONUS] = */ /* H */ /*[DICE_STATE_BONUS_DIGIT] = */ /* I */ /*[DICE_STATE_FLUSH_BONUS] = */ /* J */ /*[DICE_STATE_VAR] = */ /* K */ /*[DICE_STATE_VAR_CHAR] = */ /* L */ /*[DICE_STATE_FLUSH_ALL] = */ /* M */