Tuesday, June 21, 2016

filling the empty spaces in a certain region in a grid using c++


enter image description here


enter image description here Hi guys i am struggling to find the optimal way to fill the grid of a certain region.


In the above example lets say my player is at (7,5) and traveled (2,0) and i have the information of all the points he went through. for example: (7,5)->(6,5)->(4,5)->(4,4)->(4,3)->(3,3)->(2,3)....(2,0).


Here what i want to do is fill in either top side of the path with some color and bottom path with some other color.


and same goes for the other cases as well if player travels from (7,3)->(5,0) i want to color the insides with one color and out sides with another.


can any body explain me the logic to do this in c++ please thank you.


i went through that flood filling but not sure how to implement that for this one :( .





No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...