Abstract
In this paper, we consider two kinds of matchstick puzzles. In both puzzles, matchsticks can be placed only on the edges of a square grid. The first problem is to make a given placement of matchsticks by moving the designated number of matchsticks. We show an algorithm to solve this problem using string matching with errors that is faster than exhaustive search. The second problem is to make the designated number of squares by moving the designated number of matchsticks. We show that this problem is NP-complete by reduction from circuit-SAT. We also show that the problem can be solved in polynomial time if the width of the grid is bounded by a constant.
Similar content being viewed by others
References
Hearn, R.A., Demaine, E.D.: Games, Puzzles, and Computation. A.K. Peters, Natick (2009)
Andersson, D.: Hashiwokakero is NP-complete. Inf. Process. Lett. 109(19), 1145–1146 (2009)
Kölker, J.: Kurodoko is NP-complete. J. Inf. Process. 20(3), 694–706 (2012)
Takenaga, Y., Aoyagi, S., Iwata, S., Kasai, T.: Shikaku and Ripple Effect are NP-complete. Congressus Numerantium 216, 119–127 (2013)
Ishibashi, A., Sato, Y., Iwata, S.: NP-completeness of two pencil puzzles: Yajilin and Country Road. Util. Math. 88, 237–246 (2012)
Amir, A., Lewenstein, M., Porat, E.: Faster algorithm for string matching with \(k\) mismatches. J. Algorithms 50(2), 257–275 (2004)
Nocolae, M., Rajasekaran, S.: On string matching with mismatches. Algorithms 8(2), 248–270 (2015)
Goldschlager, L.M.: The monotone and planar circuit value problems are log space complete for P. SIGACT News 9(2), 25–29 (1977)
Acknowledgements
This work was partially supported by JSPS KAKENHI Grant number 15K00505.
Author information
Authors and Affiliations
Corresponding author
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
About this article
Cite this article
Takenaga, Y., Mishiba, S. & Sugiyama, H. Matchstick Puzzles on a Grid. Graphs and Combinatorics 36, 347–357 (2020). https://doi.org/10.1007/s00373-019-02078-3
Received:
Revised:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00373-019-02078-3