Funky Chess board doubt

could someone tell me whats wrong with this code
1st and 3rd test-cases are failing?