Welcome Guest, Not a member yet? Register   Sign In
I have a logical question one.. can any one tell the logic.......
#2

[eluser]pzajdler[/eluser]
Great, what's the question? You want to know how to calculate number of buildings controlled by soldier? If so then:

For every soldier You control

8 buildings horizontally and 8 building vertically, based on his position You can create an array of buildings controlled by him
You do this for every soldier, then You merge those arrays simply removing duplicated elements.
Here You get 22, because they stay on the same row, so 6 of their buildings duplicate.
1: {5,1},{5,2},{5,3},{5,4},{5,5},{5,6},{5,7},{5,8},{1,5},{2,5},{3,5},{4,5},{5,5},{5,6},{5,7},{5,8}
2: {5,1},{5,2},{5,3},{5,4},{5,5},{5,6},{5,7},{5,8},{1,3},{2,3},{3,3},{4,3},{5,3},{6,3},{7,3},{8,3}

After adding them You'll get:
{5,1},{5,2},{5,3},{5,4},{5,5},{5,6},{5,7},{5,8},{1,5},{2,5},{3,5},{4,5},{5,6},{5,7},{5,8},{1,3},{2,3},{3,3},{4,3},{6,3},{7,3},{8,3} which gives You 22.

Smile

@DOWN
???? :>


Messages In This Thread
I have a logical question one.. can any one tell the logic....... - by El Forum - 07-13-2012, 05:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB