» Project Code 1.0 - MATE - Template for Chess Problems -- C++

Problem Link: https://www.codechef.com/PCO12020/problems/MATE
How to solve this? I thought of Bruteforce, is it?
How to implement these problems efficiently?
Can someone attach a template for better implementation of these(chess) problems