Challenge Suggestion:Chess - How many moves?

Add a reply

Posted by Mark Byers 1367 days ago:
Another chess related one: Given a chessboard with some pieces placed, how many valid moves are there? I suggest having only one colour to make it simpler (no need to consider capturing).

Example input:

_ _ _ _ _ _ _ _
_ _ N _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ R _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _

Example output:

18

(knight has 6 moves, rook has 12).

Difficulty = 4/5 (?). Can be made easier by restricting the problem only to one specific kind of chess piece (only queens, for example).

Please reply if you like this idea!
Posted by carldr 1367 days ago:
I like this idea :)

Add a reply