Say for instance you have a surface divided into squares and an object which is supposed to move through all these squares. Sum squares have obstacles which mean that the object cannot move through them. Don’t you know of any algorithm I can use so that the object can cover as much area and at the same time avoid the squares with obstacles?
I already have a class for creating the surface and a class for controlling the object.
Give numbers to each square, and then if it is obstacled give false, otherwise true:
When u move the button, first check the square, if it is not obstacled then move, otherwise stay there