Skip to main content
deleted 10 characters in body
Source Link
Kromster
  • 10.7k
  • 4
  • 55
  • 67

I'm currently developing a city builder with a zoning system similar to Cities  : Skylines. What I would need is an algorithm that would find all the way to fill this grid (in red) but with some constraints  : In this case, one way to fill it would be to have a building on the left (size 4x3) and one building one the right (size 3x4). But to have some variety, I don't want to always minimize the number of buildings, so in this case I would like also to allow 2 buildings of 2x3 on the left + 1 building of 3x4 on the right. Someone pointed me toward the Dancing Links algorithm to solve this.   

enter image description here

I'm currently developing a city builder with a zoning system similar to Cities  : Skylines. What I would need is an algorithm that would find all the way to fill this grid (in red) but with some constraints  : In this case, one way to fill it would be to have a building on the left (size 4x3) and one building one the right (size 3x4). But to have some variety, I don't want to always minimize the number of buildings, so in this case I would like also to allow 2 buildings of 2x3 on the left + 1 building of 3x4 on the right. Someone pointed me toward the Dancing Links algorithm to solve this.  enter image description here

I'm developing a city builder with a zoning system similar to Cities: Skylines. What I would need is an algorithm that would find all the way to fill this grid (in red) but with some constraints: In this case, one way to fill it would be to have a building on the left (size 4x3) and one building one the right (size 3x4). But to have some variety, I don't want to always minimize the number of buildings, so in this case I would like also to allow 2 buildings of 2x3 on the left + 1 building of 3x4 on the right. Someone pointed me toward the Dancing Links algorithm to solve this. 

enter image description here

Source Link

Fill a non rectangular grid with rectangles

I'm currently developing a city builder with a zoning system similar to Cities : Skylines. What I would need is an algorithm that would find all the way to fill this grid (in red) but with some constraints : In this case, one way to fill it would be to have a building on the left (size 4x3) and one building one the right (size 3x4). But to have some variety, I don't want to always minimize the number of buildings, so in this case I would like also to allow 2 buildings of 2x3 on the left + 1 building of 3x4 on the right. Someone pointed me toward the Dancing Links algorithm to solve this. enter image description here