bot/src/bitboard.cpp
/*
* Convert the I, Z, S pieces to their default forms
* Useful in move generator
*/
Convert the I, Z, S pieces to their default forms
Useful in move generator
Convert the I Z S pieces to their default forms Useful in move generator
void piece_data::normalize()
{
	switch (type)
	{
	case PIECE_I:
		switch (rotation)
		{
		case PIECE_UP:
			break;
		case PIECE_RIGHT:
			break;
		case PIECE_DOWN:
			rotation = PIECE_UP;
			--x;
			break;
		case PIECE_LEFT:
			rotation = PIECE_RIGHT;
			++y;
			break;
		default:
			break;
		}
		break;
	case PIECE_O:
		switch (rotation)
		{
		case PIECE_UP:
			break;
		case PIECE_RIGHT:
			--y;
			break;
		case PIECE_DOWN:
			--x;
			--y;
			break;
		case PIECE_LEFT:
			--x;
			break;
		default:
			break;
		}
		rotation = PIECE_UP;
		break;
	case PIECE_S:
		switch (rotation)
		{
		case PIECE_UP:
			break;
		case PIECE_RIGHT:
			break;
		case PIECE_DOWN:
			rotation = PIECE_UP;
			--y;
			break;
		case PIECE_LEFT:
			rotation = PIECE_RIGHT;
			--x;
			break;
		default:
			break;
		}
		break;
	case PIECE_Z:
		switch (rotation)
		{
		case PIECE_UP:
			break;
		case PIECE_RIGHT:
			break;
		case PIECE_DOWN:
			rotation = PIECE_UP;
			--y;
			break;
		case PIECE_LEFT:
			rotation = PIECE_RIGHT;
			--x;
			break;
		default:
			break;
		}
		break;
	default:
		break;
	}
}
void piece_data :: normalize ( ) { switch ( type ) { case PIECE_I : switch ( rotation ) { case PIECE_UP : break ; case PIECE_RIGHT : break ; case PIECE_DOWN : rotation = PIECE_UP ; -- x ; break ; case PIECE_LEFT : rotation = PIECE_RIGHT ; ++ y ; break ; default : break ; } break ; case PIECE_O : switch ( rotation ) { case PIECE_UP : break ; case PIECE_RIGHT : -- y ; break ; case PIECE_DOWN : -- x ; -- y ; break ; case PIECE_LEFT : -- x ; break ; default : break ; } rotation = PIECE_UP ; break ; case PIECE_S : switch ( rotation ) { case PIECE_UP : break ; case PIECE_RIGHT : break ; case PIECE_DOWN : rotation = PIECE_UP ; -- y ; break ; case PIECE_LEFT : rotation = PIECE_RIGHT ; -- x ; break ; default : break ; } break ; case PIECE_Z : switch ( rotation ) { case PIECE_UP : break ; case PIECE_RIGHT : break ; case PIECE_DOWN : rotation = PIECE_UP ; -- y ; break ; case PIECE_LEFT : rotation = PIECE_RIGHT ; -- x ; break ; default : break ; } break ; default : break ; } }
Convert the I, Z, S pieces to their default forms
Useful in move generator
Convert the I Z S pieces to their default forms Useful in move generator