# Return to Answer

2 Added explanation

# Pip, 39 bytes

I'll take my brief turn in the lead before the CJam and Pyth answers come along...

$+Y(95<=>A_)*013359@{"KPNBRQ"@?UCa|0}Ma  Takes the FEN string as a command-line argument. Explanation forthcoming.Here's an explanation for a slightly ungolfed version: $+({(95<=>Aa)*013359@("KPNBRQ"@?UCa|0)}Ma)

{                                  }Ma   Map this function to each character in input:
UCa          Uppercase version of character
"KPNBRQ"@?             Its index in this string, nil if not present
|0        Logical or with 0 (to turn nil into 0)
013359@(               )       Index into this number to get piece's score
Aa                                 ASCII value of character
95<=>                                   1 if less than 95, -1 if greater than 95
(       )*                               Multiply by the score
$+( ) Sum all scores and autoprint result  # Pip, 39 bytes I'll take my brief turn in the lead before the CJam and Pyth answers come along... $+Y(95<=>A_)*013359@{"KPNBRQ"@?UCa|0}Ma


Takes the FEN string as a command-line argument. Explanation forthcoming.

# Pip, 39 bytes

I'll take my brief turn in the lead before the CJam and Pyth answers come along...

$+Y(95<=>A_)*013359@{"KPNBRQ"@?UCa|0}Ma  Takes the FEN string as a command-line argument. Here's an explanation for a slightly ungolfed version: $+({(95<=>Aa)*013359@("KPNBRQ"@?UCa|0)}Ma)

{                                  }Ma   Map this function to each character in input:
UCa          Uppercase version of character
"KPNBRQ"@?             Its index in this string, nil if not present
|0        Logical or with 0 (to turn nil into 0)
013359@(               )       Index into this number to get piece's score
Aa                                 ASCII value of character
95<=>                                   1 if less than 95, -1 if greater than 95
(       )*                               Multiply by the score
$+( ) Sum all scores and autoprint result  1 # Pip, 39 bytes I'll take my brief turn in the lead before the CJam and Pyth answers come along... $+Y(95<=>A_)*013359@{"KPNBRQ"@?UCa|0}Ma


Takes the FEN string as a command-line argument. Explanation forthcoming.