The challenge this week is as follows: given a random – though legal. according to the laws of the game – position on a standard chessboard, here occupying the range A1:H8, a single formula to give the material evaluation of the position. For example, on the board below:
the result of the formula would be -3.
Each piece scores the following:
P (Pawn): 1
N (Knight): 3
B (Bishop): 3
R (Rook): 5
Q (Queen): 9
Each side will always have one King each, though other material may vary.
The prefixes “W” and “B” indicate a White piece and a Black piece respectively.
The formula result is the material evaluation from White’s perspective. Hence, if White’s material total is greater than Black’s, this result should be positive; conversely, if White’s material total is less than Black’s, this result should be negative. And if material is equal, the result should be zero.
This week’s challenge is also a shortest formula challenge, which means that readers should attempt to find not only a correct solution to the problem but also one which has the least number of characters as possible.
Formulas must reference the range A1:H8 – no other range references are permitted, including Named Ranges.
Solution next week. Best of luck!