Backtracking ?

Hello. I actually understand recursion and how it works but im having some difficulties in backtracking exercies.

..#.#
..###
#..##
#.##.
#....
If a fan from one available(.) seat starts shouting, then fans sitting on his left, right, up, and down do the same. Then, the neighbors of these do the same, and so on. A sponsor of the soccer team would like that the fans "spontaneously" shout the slogan of his company. They have hired Mirko to sit on a free seat and starts shouting the slogan of the company. A sponsor aims that the number of people who shout their slogan is as large as possible. Your duty is to help out Mirko to pick an available (.) seat that will allow him to induce a shout of a maximum number of fans that are sitting in a unavailable seat (#).Output the coordinates of his seat.


I understand the logic
but i dont know how to create the backtracking part and what the base case should be of the recursive function.
Thanks

Last edited on
Pass seat they will hear shout from in addition to seat which hears the shout.
Topic archived. No new replies allowed.