Pushing Blocks by Sweeping Lines

Authors Hugo A. Akitaya, Maarten Löffler, Giovanni Viglietta

Thumbnail PDF


  • Filesize: 2.65 MB
  • 21 pages

Document Identifiers

Author Details

Hugo A. Akitaya
  • University of Massachusetts Lowell, MA, USA
Maarten Löffler
  • Department of Information and Computing Sciences, Utrecht University, The Netherlands
Giovanni Viglietta
  • School of Information Science, Japan Advanced Institute of Science and Technology (JAIST), Ishikawa, Japan


The authors would like to thank the anonymous reviewers for helpful suggestions that greatly improved the readability of this paper.

Cite AsGet BibTex

Hugo A. Akitaya, Maarten Löffler, and Giovanni Viglietta. Pushing Blocks by Sweeping Lines. In 11th International Conference on Fun with Algorithms (FUN 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 226, pp. 1:1-1:21, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


We investigate the reconfiguration of n blocks, or "tokens", in the square grid using line pushes. A line push is performed from one of the four cardinal directions and pushes all tokens that are maximum in that direction to the opposite direction by one unit. Tokens that are in the way of other tokens are displaced in the same direction, as well. Similar models of manipulating objects using uniform external forces match the mechanics of existing games and puzzles, such as Mega Maze, 2048 and Labyrinth, and have also been investigated in the context of self-assembly, programmable matter and robotic motion planning. The problem of obtaining a given shape from a starting configuration is know to be NP-complete. We show that, for every n, there are sparse initial configurations of n tokens (i.e., where no two tokens are in the same row or column) that can be compacted into any a×b box such that ab = n. However, only 1×k, 2×k and 3×3 boxes are obtainable from any arbitrary sparse configuration with a matching number of tokens. We also study the problem of rearranging labeled tokens into a configuration of the same shape, but with permuted tokens. For every initial configuration of the tokens, we provide a complete characterization of what other configurations can be obtained by means of line pushes.

Subject Classification

ACM Subject Classification
  • Mathematics of computing → Permutations and combinations
  • Reconfiguration
  • Global Control
  • Pushing Blocks
  • Permutation


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Labyrinth, 1946. BRIO. https://www.brio.us/products/all-products/games/labyrinth [Accessed 02/16/2022].
  2. Mega Maze, 1995. Philips Interactive Media. Google Scholar
  3. The first mobile game goes viral: Pigs in Clover, 2018. The Strong National Museum of Play. https://www.museumofplay.org/2018/08/01/the-first-mobile-game-goes-viral-pigs-in-clover/ [Accessed 02/16/2022].
  4. Ahmed Abdelkader, Aditya Acharya, and Philip Dasler. 2048 without new tiles is still hard. In Erik D. Demaine and Fabrizio Grandoni, editors, 8th International Conference on Fun with Algorithms (FUN 2016), volume 49 of Leibniz International Proceedings in Informatics (LIPIcs), pages 1:1-1:14, Dagstuhl, Germany, 2016. Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik. URL: https://doi.org/10.4230/LIPIcs.FUN.2016.1.
  5. Hugo A. Akitaya, Greg Aloupis, Maarten Löffler, and Anika Rounds. Trash compaction. In Proceedings of the 32nd European Workshop on Computational Geometry (EuroCG 2016), pages 107-110, 2016. Google Scholar
  6. Hugo A. Akitaya, Erik D. Demaine, Jason S. Ku, Jayson Lynch, Mike Paterson, and Csaba D. Tóth. 2048 without merging. In 32nd Canadian Conference on Computational Geometry (CCCG 2020), pages 285-291, 2020. Google Scholar
  7. Hugo A. Akitaya, Maarten Löffler, Anika Rounds, and Giovanni Viglietta. Compaction games. In Workshop on Combinatorial Reconfiguration (CORE), affiliated with ICALP 2021, page 20, 2021. Google Scholar
  8. Hugo A. Akitaya, Maarten Löffler, and Giovanni Viglietta. Pushing blocks by sweeping lines. arXiv:2202.12045 [math.CO], 2022. Google Scholar
  9. Kazuyuki Amano, Yuta Kojima, Toshiya Kurabayashi, Keita Kurihara, Masahiro Nakamura, Ayaka Omi, Toshiyuki Tanaka, and Koichi Yamazaki. How to solve the torus puzzle. Algorithms, 5(1):18-29, 2012. Google Scholar
  10. Jose Balanza-Martinez, Timothy Gomez, David Caballero, Austin Luchsinger, Angel A. Cantu, Rene Reyes, Mauricio Flores, Robert Schweller, and Tim Wylie. Hierarchical shape construction and complexity for slidable polyominoes under uniform external forces. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2625-2641. SIAM, 2020. Google Scholar
  11. Jose Balanza-Martinez, Austin Luchsinger, David Caballero, Rene Reyes, Angel A. Cantu, Robert Schweller, Luis Angel Garcia, and Tim Wylie. Full tilt: Universal constructors for general shapes with uniform external forces. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2689-2708. SIAM, 2019. Google Scholar
  12. Aaron Becker, Erik D Demaine, Sándor P Fekete, Golnaz Habibi, and James McLurkin. Reconfiguring massive particle swarms with limited, global control. In International Symposium on Algorithms and Experiments for Sensor Systems, Wireless Networks and Distributed Robotics, pages 51-66. Springer, 2013. Google Scholar
  13. Aaron Becker, Golnaz Habibi, Justin Werfel, Michael Rubenstein, and James McLurkin. Massive uniform manipulation: Controlling large populations of simple robots with a common input signal. In 2013 IEEE/RSJ international conference on intelligent robots and systems, pages 520-527. IEEE, 2013. Google Scholar
  14. Aaron T. Becker, Erik D. Demaine, Sándor P. Fekete, Jarrett Lonsford, and Rose Morris-Wright. Particle computation: complexity, algorithms, and logic. Natural Computing, 18(1):181-201, 2019. Google Scholar
  15. David Caballero, Angel A Cantu, Timothy Gomez, Austin Luchsinger, Robert Schweller, and Tim Wylie. Building patterned shapes in robot swarms with uniform control signals. In Canadian Conference on Computational Geometry (CCCG 2020), 2020. Google Scholar
  16. David Caballero, Angel A Cantu, Timothy Gomez, Austin Luchsinger, Robert Schweller, and Tim Wylie. Hardness of reconfiguring robot swarms with uniform external control in limited directions. Journal of Information Processing, 28:782-790, 2020. Google Scholar
  17. David Caballero, Angel A Cantu, Timothy Gomez, Austin Luchsinger, Robert Schweller, and Tim Wylie. Fast reconfiguration of robot swarms with uniform control signals. Natural Computing, 20(4):659-669, 2021. Google Scholar
  18. Erik D Demaine. Playing games with algorithms: Algorithmic combinatorial game theory. In International Symposium on Mathematical Foundations of Computer Science, pages 18-33. Springer, 2001. Google Scholar
  19. Erik D Demaine, Martin L Demaine, Michael Hoffmann, and Joseph O'Rourke. Pushing blocks is hard. Computational Geometry, 26(1):21-36, 2003. Google Scholar
  20. Robert A Hearn. The complexity of sliding block puzzles and plank puzzles. Tribute to a Mathemagician, pages 173-183, 2005. Google Scholar
  21. Robert A Hearn and Erik D Demaine. PSPACE-completeness of sliding-block puzzles and other problems through the nondeterministic constraint logic model of computation. Theoretical Computer Science, 343(1-2):72-96, 2005. Google Scholar
  22. Gareth A. Jones. Primitive permutation groups containing a cycle. Bulletin of the Australian Mathematical Society, 89(1):159-165, 2014. Google Scholar
  23. D Kornhauser, G Miller, and P Spirakis. Coordinating pebble motion on graphs, the diameter of permutation groups, and applications. In 25th Annual Symposium onFoundations of Computer Science, 1984., pages 241-250. IEEE, 1984. Google Scholar
  24. Daniel Ratner and Manfred Warmuth. The (n²-1)-puzzle and related relocation problems. Journal of Symbolic Computation, 10:111-137, 1990. Google Scholar
  25. Joseph J. Rotman. An introduction to the theory of groups. Springer-Verlag, fourth edition, 1995. Google Scholar
  26. Kwon Kham Sai, Giovanni Viglietta, and Ryuhei Uehara. Cyclic shift problems on graphs. IEICE Transactions on Information and Systems, E105-D(3), 2022. Google Scholar
  27. Yinan Zhang, Xiaolei Chen, Hang Qi, and Devin Balkcom. Rearranging agents in a small space using global controls. In 2017 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 3576-3582. IEEE, 2017. Google Scholar