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**.

**Notes:**

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!

### Like this:

Like Loading...

*Related*

What is the point value for the King?

Nominally 1, though, as I said, both sides will always have precisely one king each, so this piece cannot ever affect the material balance.

Alright short or not here is my solution:

Entered as an array from White’s perspective.

Hi XOR LX

This will be short…. i suppose ;-)))

Regards.

@GreasySpotGood stuff! Works perfectly! Now let’s just see if anyone can come along with a shorter version.

Thanks a lot for your contribution. Cheers

@Bill SzyszHi Bill. Not sure I understand. How does this formula account for the possible different number of pieces that Black and White have?

Regards

@XOR LX

I can’t paste here the correct version of my formula (i don’t know why…. your site changing my formula).

So i upload the file to my google drive (shared file). You can see correct version of formula. Or….

here is a link to picture with my formula

https://drive.google.com/file/d/0B6UlMk8OzUrxTV9DMlNGaEhCeUE/view?usp=sharing

Regards

@BillApologies. Yes – it’s the editor here. Have amended in your original post.Works great! Well done!

Awesome Bill! Looks Sweet.

I feel a bit of a cheapskate offering this as the donkeywork has already been done by Bill. However given the prize money that’s at stake, it has to be done…….

Would I be pushing my luck to suggest using lowercase letters and transposing the arrays so that commas outnumber the semicolons?

Although it contains the same number of characters it is actually ‘shorter ‘, left to right and will use up less ink!!!

Looks like my (Bill’s if we’re being honest. What’s a couple of $’s between friends?) formulas have fallen foul of your editor?

*First visit to site. Looks interesting, I will be back!!!

@SnakehipsWelcome! Good to see someone of such standing in the Excel world here! (No offence, everyone else 🙂 )

“Harsh” is the word that springs to mind! But then, Bill did kind of leave that door wide open, so who can blame you for walking through it?

As for the lower-case stuff, you should know me better than that! So that one’s not getting you any extra points, I’m afraid. And prize money?? You and everyone else wish! 🙂

Cheers and hope to see you around here again!

P.S. Sorry about the editor here. Not nearly on the same level of technical expertise as at Mr. Excel. Have amended your formula, hopefully to what you intended.

Pingback: Shortest Formula Challenge #1: Results and Discussion | EXCELXOR