modifique o programa xadrez. c para imprimir um tabuleiro maior que preencha a tela
O algoritmo será:
var minimax = function ( profundidade , jogo , isMaximisingPlayer ) {
if (profundidade === 0 ) {
voltar - evaluateBoard ( jogo . placa ());
}
var newGameMoves = jogo . ugly_moves ();
if (isMaximisingPlayer) {
var bestMove = - 9999 ;
para ( var i = 0 ; i < newGameMoves . tamanho ; i ++ ) {
jogo . ugly_move (newGameMoves [i]);
bestMove = Math . max (bestMove, minimax (profundidade - 1 , jogo ,! isMaximisingPlayer));
jogo . desfazer ();
}
return bestMove;
} mais {
var bestMove = 9999 ;
para ( var i = 0 ; i < newGameMoves . tamanho ; i ++ ) {
jogo . ugly_move (newGameMoves [i]);
bestMove = Math . min (bestMove, minimax (profundidade - 1 , jogo ,! isMaximisingPlayer));
jogo . desfazer ();
}
return bestMove;
}
};
O algoritmo será:
var minimax = function ( profundidade , jogo , isMaximisingPlayer ) {
if (profundidade === 0 ) {
voltar - evaluateBoard ( jogo . placa ());
}
var newGameMoves = jogo . ugly_moves ();
if (isMaximisingPlayer) {
var bestMove = - 9999 ;
para ( var i = 0 ; i < newGameMoves . tamanho ; i ++ ) {
jogo . ugly_move (newGameMoves [i]);
bestMove = Math . max (bestMove, minimax (profundidade - 1 , jogo ,! isMaximisingPlayer));
jogo . desfazer ();
}
return bestMove;
} mais {
var bestMove = 9999 ;
para ( var i = 0 ; i < newGameMoves . tamanho ; i ++ ) {
jogo . ugly_move (newGameMoves [i]);
bestMove = Math . min (bestMove, minimax (profundidade - 1 , jogo ,! isMaximisingPlayer));
jogo . desfazer ();
}
return bestMove;
}
};
Para escrever sua resposta aqui, entre ou crie uma conta
Compartilhar