Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bench_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "bench.h"

int main(){
printf("capizero %s por Hugo Souza 2023\n", CAPIZERO_VERSION);
printf("capizero %s por Hugo Souza 2026\n", CAPIZERO_VERSION);
printf("build %d \n", BUILDNO);
printf("compilado em %s \n\n", __TIMESTAMP__);
printf("executando testes de performance \n\n\n");
Expand Down
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ int main(int argc, char **argv){
bool headless = (argc >= 2);

if (!headless){
printf("capizero %s por Hugo Souza 2023\n", CAPIZERO_VERSION);
printf("capizero %s por Hugo Souza 2026\n", CAPIZERO_VERSION);
printf("build %d \n", BUILDNO);
printf("compilado em %s \n", __TIMESTAMP__);

Expand Down
37 changes: 26 additions & 11 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <stdio.h>
#include <string.h>
#include <setjmp.h>
#include <math.h>

#include "update.h"
#include "game.h"
Expand Down Expand Up @@ -406,29 +407,43 @@ int Search::pesquisa(int alpha, int beta, int profundidade, bool pv, bool null_p
lances_legais_na_posicao++;


// REDUÇÕES E EXTENSÕES
if (check == 1){ // extensões
nova_profundidade = profundidade; // extensões de xeques
// EXTENSÕES E REDUÇÕES (LMR)
if (check == 1){
nova_profundidade = profundidade; // extensão de xeque
}
else{ // reduções
if (Gen::lista_de_lances[candidato].score > SCORE_DE_CAPTURA_VANTAJOSAS || lances_legais_na_posicao == 1){
else if (Gen::lista_de_lances[candidato].score > SCORE_DE_CAPTURA_VANTAJOSAS
|| lances_legais_na_posicao == 1){
nova_profundidade = profundidade - 1; // primeira peça ou captura vantajosa: sem redução
}
else if (lances_legais_na_posicao >= 2 && profundidade >= 3){
// LMR: redução logarítmica para lances quietos tardios em nós não-PV.
// Exclui: TT, killers, contralances e capturas (via score >= SCORE_CONTRALANCE
// ou destino ocupado) e promoções.
const bool nao_reduzir =
Gen::lista_de_lances[candidato].score >= PONTUACAO_HASH
|| Gen::lista_de_lances[candidato].promove != 0;

if (nao_reduzir){
nova_profundidade = profundidade - 1;
}
else if (Gen::lista_de_lances[candidato].score > 0){
nova_profundidade = profundidade - 2;
}
else{
nova_profundidade = profundidade - REDUCAO_LMR;
int lmr_r = (int)(log((double)profundidade) * log((double)lances_legais_na_posicao) / 2.0);
if (lmr_r < 1) lmr_r = 1;
nova_profundidade = profundidade - 1 - lmr_r;
if (nova_profundidade < 1) nova_profundidade = 1;
}
}
else{
nova_profundidade = profundidade - 1;
}

// pesquisa da variante principal (pvs)
if (pesquisandoPV){
score_candidato = -pesquisa(-beta, -alpha, nova_profundidade, true); // extender profundidade???
score_candidato = -pesquisa(-beta, -alpha, nova_profundidade, true);
}
else{
if (-pesquisa(-alpha - 1, -alpha, nova_profundidade, false) > alpha){
score_candidato = -pesquisa(-beta, -alpha, nova_profundidade, true);
score_candidato = -pesquisa(-beta, -alpha, profundidade - 1, true);
Comment on lines 444 to +446
}
else{
Update::desfaz_lance();
Expand Down
2 changes: 1 addition & 1 deletion src/unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "init.h"

int main(){
printf("capizero %s por Hugo Souza 2023\n", CAPIZERO_VERSION);
printf("capizero %s por Hugo Souza 2026\n", CAPIZERO_VERSION);
printf("build %d \n", BUILDNO);
printf("compilado em %s \n\n", __TIMESTAMP__);
printf("executando testes unitários \n\n\n");
Expand Down