Relax. Alfil can be entered in season 9, so no biggie.
Updating the engine to fix bugs takes time, and it can be that the engine has a game in like 2-3 hours. So maybe its the regulations that need a change.
Alfil 15.7
Moderators: hgm, Rebel, chrisw
-
- Posts: 12540
- Joined: Wed Mar 08, 2006 8:57 pm
- Location: Redmond, WA USA
Re: Compile from sources?
Sample code, Evaluate King (Alfil C# version):
Evaluate King Stockfish:
Code: Select all
//----------------------------------------------------------------------------------------------------------
public static pnt EvalRey(cPosicion pos, cEvalInfo ei, color colr)
{
color colorVS = (colr == cColor.BLANCO ? cColor.NEGRO : cColor.BLANCO);
bitbrd indefenso, b, b1, b2, safe;
int attackUnits;
sq nCasillaRey = pos.GetRey(colr);
pnt score = 0;//ei.m_Peones.ReyProtegido(pos, nCasillaRey, colr);
if (ei.m_AtaquesAlRey[colorVS] != 0)
{
indefenso = ei.m_Ataques[colorVS][cPieza.NAN] & ei.m_Ataques[colr][cPieza.REY] & ~(ei.m_Ataques[colr][cPieza.PEON] | ei.m_Ataques[colr][cPieza.CABALLO]
| ei.m_Ataques[colr][cPieza.ALFIL] | ei.m_Ataques[colr][cPieza.TORRE] | ei.m_Ataques[colr][cPieza.DAMA]);
attackUnits = Math.Min(20, (ei.m_AtaquesAlRey[colorVS] * ei.m_PesoAtaquesAlRey[colorVS]) / 2)
+ 3 * (ei.m_ZonaDelRey[colorVS] + cBitBoard.CountMax15(indefenso))
+ 2 * (ei.m_Clavadas[colr] != 0 ? 1 : 0)
- cTypes.GetMedioJuego(score) / 32;
b = indefenso & ei.m_Ataques[colorVS][cPieza.DAMA] & ~pos.PiezasColor(colorVS);
if (b != 0)
{
b &= (ei.m_Ataques[colorVS][cPieza.PEON] | ei.m_Ataques[colorVS][cPieza.CABALLO]
| ei.m_Ataques[colorVS][cPieza.ALFIL] | ei.m_Ataques[colorVS][cPieza.TORRE]);
if (b != 0)
attackUnits += QueenContactCheck
* cBitBoard.CountMax15(b)
* (colorVS == pos.ColorMueve() ? 2 : 1);
}
b = indefenso & ei.m_Ataques[colorVS][cPieza.TORRE] & ~pos.PiezasColor(colorVS);
b &= cBitBoard.m_PseudoAtaques[cPieza.TORRE][nCasillaRey];
if (b != 0)
{
b &= (ei.m_Ataques[colorVS][cPieza.PEON] | ei.m_Ataques[colorVS][cPieza.CABALLO]
| ei.m_Ataques[colorVS][cPieza.ALFIL] | ei.m_Ataques[colorVS][cPieza.DAMA]);
if (b != 0)
attackUnits += RookContactCheck
* cBitBoard.CountMax15(b)
* (colorVS == pos.ColorMueve() ? 2 : 1);
}
safe = ~(pos.PiezasColor(colorVS) | ei.m_Ataques[colr][cPieza.NAN]);
b1 = pos.attacks_from_square_piecetype(nCasillaRey, cPieza.TORRE) & safe;
b2 = pos.attacks_from_square_piecetype(nCasillaRey, cPieza.ALFIL) & safe;
b = (b1 | b2) & ei.m_Ataques[colorVS][cPieza.DAMA];
if (b != 0)
attackUnits += QueenCheck * cBitBoard.CountMax15(b);
b = b1 & ei.m_Ataques[colorVS][cPieza.TORRE];
if (b != 0)
attackUnits += RookCheck * cBitBoard.CountMax15(b);
b = b2 & ei.m_Ataques[colorVS][cPieza.ALFIL];
if (b != 0)
attackUnits += BishopCheck * cBitBoard.CountMax15(b);
b = pos.attacks_from_square_piecetype(nCasillaRey, cPieza.CABALLO) & ei.m_Ataques[colorVS][cPieza.CABALLO] & safe;
if (b != 0)
attackUnits += KnightCheck * cBitBoard.CountMax15(b);
attackUnits = Math.Min(99, Math.Max(0, attackUnits));
score -= m_ReyAmenazado[colr == cSearch.RootColor ? 1 : 0][attackUnits];
}
return score;
}
Code: Select all
template<Color Us, bool DoTrace>
Score evaluate_king(const Position& pos, const EvalInfo& ei) {
const Color Them = (Us == WHITE ? BLACK : WHITE);
Bitboard undefended, b, b1, b2, safe;
int attackUnits;
const Square ksq = pos.square<KING>(Us);
// King shelter and enemy pawns storm
Score score = ei.pi->king_safety<Us>(pos, ksq);
// Main king safety evaluation
if (ei.kingAttackersCount[Them])
{
// Find the attacked squares around the king which have no defenders
// apart from the king itself
undefended = ei.attackedBy[Them][ALL_PIECES]
& ei.attackedBy[Us][KING]
& ~( ei.attackedBy[Us][PAWN] | ei.attackedBy[Us][KNIGHT]
| ei.attackedBy[Us][BISHOP] | ei.attackedBy[Us][ROOK]
| ei.attackedBy[Us][QUEEN]);
// Initialize the 'attackUnits' variable, which is used later on as an
// index into the KingDanger[] array. The initial value is based on the
// number and types of the enemy's attacking pieces, the number of
// attacked and undefended squares around our king and the quality of
// the pawn shelter (current 'score' value).
attackUnits = std::min(74, ei.kingAttackersCount[Them] * ei.kingAttackersWeight[Them])
+ 8 * ei.kingAdjacentZoneAttacksCount[Them]
+ 25 * popcount<Max15>(undefended)
+ 11 * !!ei.pinnedPieces[Us]
- 60 * !pos.count<QUEEN>(Them)
- mg_value(score) / 8;
// Analyse the enemy's safe queen contact checks. Firstly, find the
// undefended squares around the king reachable by the enemy queen...
b = undefended & ei.attackedBy[Them][QUEEN] & ~pos.pieces(Them);
if (b)
{
// ...and then remove squares not supported by another enemy piece
b &= ei.attackedBy[Them][PAWN] | ei.attackedBy[Them][KNIGHT]
| ei.attackedBy[Them][BISHOP] | ei.attackedBy[Them][ROOK];
if (b)
attackUnits += QueenContactCheck * popcount<Max15>(b);
}
// Analyse the enemy's safe rook contact checks. Firstly, find the
// undefended squares around the king reachable by the enemy rooks...
b = undefended & ei.attackedBy[Them][ROOK] & ~pos.pieces(Them);
// Consider only squares where the enemy's rook gives check
b &= PseudoAttacks[ROOK][ksq];
if (b)
{
// ...and then remove squares not supported by another enemy piece
b &= ( ei.attackedBy[Them][PAWN] | ei.attackedBy[Them][KNIGHT]
| ei.attackedBy[Them][BISHOP]);
if (b)
attackUnits += RookContactCheck * popcount<Max15>(b);
}
// Analyse the enemy's safe distance checks for sliders and knights
safe = ~(ei.attackedBy[Us][ALL_PIECES] | pos.pieces(Them));
b1 = pos.attacks_from<ROOK >(ksq) & safe;
b2 = pos.attacks_from<BISHOP>(ksq) & safe;
// Enemy queen safe checks
b = (b1 | b2) & ei.attackedBy[Them][QUEEN];
if (b)
attackUnits += QueenCheck * popcount<Max15>(b);
// Enemy rooks safe checks
b = b1 & ei.attackedBy[Them][ROOK];
if (b)
attackUnits += RookCheck * popcount<Max15>(b);
// Enemy bishops safe checks
b = b2 & ei.attackedBy[Them][BISHOP];
if (b)
attackUnits += BishopCheck * popcount<Max15>(b);
// Enemy knights safe checks
b = pos.attacks_from<KNIGHT>(ksq) & ei.attackedBy[Them][KNIGHT] & safe;
if (b)
attackUnits += KnightCheck * popcount<Max15>(b);
// Finally, extract the king danger score from the KingDanger[]
// array and subtract the score from evaluation.
score -= KingDanger[std::max(std::min(attackUnits, 399), 0)];
}
if (DoTrace)
Trace::add(KING, Us, score);
return score;
}
-
- Posts: 6401
- Joined: Thu Mar 09, 2006 8:30 pm
- Location: Chicago, Illinois, USA
Re: Compile from sources?
This bug may take one minute for the author to fix, or recompile with an empty book. Martin can always wait or a game could be replayed. He has done it in the past. I think that rules are fine. If the author is can/have time/willing to work with Martin, he has shown it could be done.whereagles wrote:Relax. Alfil can be entered in season 9, so no biggie.
Updating the engine to fix bugs takes time, and it can be that the engine has a game in like 2-3 hours. So maybe its the regulations that need a change.
Miguel
-
- Posts: 565
- Joined: Thu Nov 13, 2014 12:03 pm
Re: Compile from sources?
This particular bug should be simple to fix, yes. I was speaking more in general.
Anyway, I see Alfil is a basically a SF copy... Now that's more of an issue.
Anyway, I see Alfil is a basically a SF copy... Now that's more of an issue.
-
- Posts: 2555
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: Compile from sources?
It's trivial, in C# it will run like 2-4 times slower, add some changes here and there to fool sim test that lose elo as well and you're doneSzG wrote:By copying how do you create an engine that is more than 200 Elos weaker than the original?
The opposite is difficult.
-
- Posts: 3245
- Joined: Thu Mar 09, 2006 9:10 am
Re: Compile from sources?
- C# is much slower than C++SzG wrote:By copying how do you create an engine that is more than 200 Elos weaker than the original?whereagles wrote:This particular bug should be simple to fix, yes. I was speaking more in general.
Anyway, I see Alfil is a basically a SF copy... Now that's more of an issue.
...
- translation bugs and intentional deviations
My engine was quite strong till I added knowledge to it.
http://www.chess.hylogic.de
http://www.chess.hylogic.de