*/
public Casella obteMoviment( EstatCasella fitxa )
{
if ( partida.getTornsJugats() <= 1 )
{
Casella obertura = obertura();
if ( obertura != null )
{
return obertura;
}
}
tauler = partida.getTauler();
int puntuacio_millor = Integer.MIN_VALUE + 1;
Set<ResistenciaCasella> moviments_ordenats = movimentsOrdenats( fitxa );
ArrayList<Casella> millors_moviments = new ArrayList<Casella>();
if ( tauler.getTotalFitxes() % ( ( int ) ( 1.3 * tauler.getMida() ) ) == 0 && partida.getTornsJugats() != 0 )
{
profunditat_maxima++;
}
int resistencia_minima = moviments_ordenats.iterator().next().getResistencia();
for ( ResistenciaCasella resistencia_actual : moviments_ordenats )
{
Casella actual = resistencia_actual.getCasella();
tauler.mouFitxa( fitxa, actual );
pressupost = Math.max( pressupost_defecte, resistencia_actual.getResistencia() + 1 );
if ( partida.getTornsJugats() < 3 )
{
profunditat_maxima = 2;
}
else if ( resistencia_actual.getResistencia() >= resistencia_minima + 3 )
{
profunditat_maxima = 2;
}
else
{
profunditat_maxima = profunditat_defecte;
}
int puntuacio_actual =
sexSearch( fitxa, fitxaContraria( fitxa ), Integer.MIN_VALUE + 1, Integer.MAX_VALUE - 1, 1,
resistencia_actual.getResistencia(),
partida.comprovaEstatPartida( actual.getFila(), actual.getColumna() ) );
tauler.treuFitxa( actual );
if ( puntuacio_actual > puntuacio_millor )
{