Added cpp grid state calculator