Logical thermometers, beyond temperature
Image by Markus Winkler retrieved from Unsplash
The Thermometer Puzzle is an original logic puzzle where cold calculation meets spatial design. Here, capacity constraints and the physical continuity of fluids come into play.
The goal is to determine which cells of an $m \times n$ grid contain mercury. The grid is completely covered by thermometers of various shapes and lengths. Each thermometer occupies a sequence of adjacent cells (horizontally or vertically) and has a clearly identifiable base or “bulb”.
Formal description of the problem
Given an $m \times n$ grid of cells grouped into different thermometers, we must decide the fill level of each one while respecting the following physical and logical rules:
- Row and column requirements: The grid margins indicate exactly how many cells must be filled with mercury in each row and in each column.
- Continuous filling (Gravity/Thermometer physics): Thermometers are always filled from the bulb (start) towards the tail end. This implies a strict condition: if a cell contains mercury, all preceding cells in that same thermometer (closer to the bulb) must also be filled. Likewise, if a cell is empty, all subsequent cells in that thermometer must be empty.
Consider the following example of an $8 \times 8$ board:
Would you like to try solving it logically before checking its mathematical modeling?
The magic of this puzzle lies in crossing the information from marginal totals with the directional rigidity of the thermometers. How do we model this apparent “fluid physics” mathematically? By using the elegance of binary linear optimization.
Want to keep exploring the world of Operations Research? Discover more posts on the topic here.
If you found this useful, please cite this as:
Martín-Campo, F. Javier (Jun 2026). Logical thermometers, beyond temperature. https://www.fjmartincampo.com/blog/2026/thermometers/.
or as a BibTeX entry:
@misc{martín-campo2026logical-thermometers-beyond-temperature,
title = {Logical thermometers, beyond temperature},
author = {Martín-Campo, F. Javier},
year = {2026},
month = {Jun},
url = {https://www.fjmartincampo.com/blog/2026/thermometers/}
}
Enjoy Reading This Article?
Here are some more articles you might like to read next: