Answer set programming · clingo running in your browser

Clingo Garden Planner

Mark where the sun falls on your bed, choose what you want to grow, and a 60-line logic program plans every square foot for spring, summer, and fall. It respects sun needs, companion planting, spacing, and crop rotation, then searches for the plan with the most good neighbors.

Ready

Square details

Click any square in the plan to see why it holds what it does.

Planted vs. wanted

How the program reads

The page turns your bed and crop list into facts, appends them to the encoding on the right, and hands both to clingo. Each rule is a plain statement about a good garden:

  1. One crop per square per season, and only in a season that crop grows in.
  2. Sun: a crop never sits in less light than it needs. A tall crop knocks the square north of it down one sun level.
  3. Bad companions are never neighbors, diagonals included.
  4. Spacing: sprawling crops keep their distance from each other. Two sprawlers with spreads a and b stay at least a+b squares apart.
  5. Rotation: the same plant family never follows itself in a square from one season to the next.
  6. Goals, in priority order: meet your wishlist, then maximize good-companion neighbors and legumes following heavy feeders, then fill open squares.

Clingo grounds the program, then improves the plan until it proves no better one exists or the search time runs out.