Optimized algorithm to place objects in a nxm Grid according to given Pattern
up vote
-1
down vote
favorite
As shown in the image, the top right corner specifies the pattern in which the center grid is to be filled with colored boxes(could be more than 2 colors).
we are starting from (0,0) bottom left corner. We can't move outside the activity area. Please suggest an optimized algorithm that takes care of following edge cases and fill the grid(White area) in minimum possible time:
- Grid could have already wrongly filled boxes, which should be placed somewhere else before filling that position.
- We can't move over a box but we can pick it up.
- We could be blocked from all sides by boxes so we need take care of that.
algorithm matrix grid adjacency-matrix game-theory
New contributor
add a comment |
up vote
-1
down vote
favorite
As shown in the image, the top right corner specifies the pattern in which the center grid is to be filled with colored boxes(could be more than 2 colors).
we are starting from (0,0) bottom left corner. We can't move outside the activity area. Please suggest an optimized algorithm that takes care of following edge cases and fill the grid(White area) in minimum possible time:
- Grid could have already wrongly filled boxes, which should be placed somewhere else before filling that position.
- We can't move over a box but we can pick it up.
- We could be blocked from all sides by boxes so we need take care of that.
algorithm matrix grid adjacency-matrix game-theory
New contributor
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
As shown in the image, the top right corner specifies the pattern in which the center grid is to be filled with colored boxes(could be more than 2 colors).
we are starting from (0,0) bottom left corner. We can't move outside the activity area. Please suggest an optimized algorithm that takes care of following edge cases and fill the grid(White area) in minimum possible time:
- Grid could have already wrongly filled boxes, which should be placed somewhere else before filling that position.
- We can't move over a box but we can pick it up.
- We could be blocked from all sides by boxes so we need take care of that.
algorithm matrix grid adjacency-matrix game-theory
New contributor
As shown in the image, the top right corner specifies the pattern in which the center grid is to be filled with colored boxes(could be more than 2 colors).
we are starting from (0,0) bottom left corner. We can't move outside the activity area. Please suggest an optimized algorithm that takes care of following edge cases and fill the grid(White area) in minimum possible time:
- Grid could have already wrongly filled boxes, which should be placed somewhere else before filling that position.
- We can't move over a box but we can pick it up.
- We could be blocked from all sides by boxes so we need take care of that.
algorithm matrix grid adjacency-matrix game-theory
algorithm matrix grid adjacency-matrix game-theory
New contributor
New contributor
edited Nov 21 at 15:09
M Oehm
21.3k31731
21.3k31731
New contributor
asked Nov 21 at 14:31
Pandey
1
1
New contributor
New contributor
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Pandey is a new contributor. Be nice, and check out our Code of Conduct.
Pandey is a new contributor. Be nice, and check out our Code of Conduct.
Pandey is a new contributor. Be nice, and check out our Code of Conduct.
Pandey is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53414333%2foptimized-algorithm-to-place-objects-in-a-nxm-grid-according-to-given-pattern%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown