Changes

Jump to: navigation, search

King Safety

2 bytes added, 14:55, 7 May 2020
no edit summary
=Attacking King Zone=
''sample specification''
King zone is usually defined as squares to which enemy King can move plus two or three additional squares facing enemy position. Basic King safety function, similar to the one described in [[Toga Log#UserManual|Toga log user manual]], can work as follows: we have two variables, '''attackingPiecesCount''' and '''valueOfAttacks''', zeroed at startup. If a piece attacks enemy king zone, we increase attackingPiecesCount by one, and count how many squares within enemy King zone are attacked. We multpily the number of attacked squares by a constant: 20 for a knight, 20 for a bishop, 40 for a rook and 80 for a queen. The result of multiplication is added to valueOfAttacks. After finding all attacks, we look at attackingPiecesCount, use it as an index to the table given below, and our king attack score is <br/> '''(valueOfAttacks * attackWeight[attackingPiecesCount] ) / 100'''.
{| class="wikitable"

Navigation menu