Fun Slot Machines and Transformations of Words Avoiding Factors

Authors Marcella Anselmo, Manuela Flores, Maria Madonia

Thumbnail PDF


  • Filesize: 0.74 MB
  • 15 pages

Document Identifiers

Author Details

Marcella Anselmo
  • Dipartimento di Informatica, University of Salerno, Fisciano (SA), Italy
Manuela Flores
  • Dipartimento di Informatica, University of Salerno, Fisciano (SA), Italy
Maria Madonia
  • Dipartimento di Matematica e Informatica, University of Catania, Italy

Cite AsGet BibTex

Marcella Anselmo, Manuela Flores, and Maria Madonia. Fun Slot Machines and Transformations of Words Avoiding Factors. In 11th International Conference on Fun with Algorithms (FUN 2022). Leibniz International Proceedings in Informatics (LIPIcs), Volume 226, pp. 4:1-4:15, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2022)


Fun Slot Machines are a variant of the classical ones. Pulling a lever, the player generates a sequence of symbols which are placed on the reels. The machine pays when a given pattern appears in the sequence. The variant consists in trying to transform a losing sequence of symbols in another one, in such a way that the winning pattern does not appear in any intermediate step. The choice of the winning pattern can be crucial; there are "good" and "bad" sequences. The game results in a combinatorial problem on transformations of words avoiding a given pattern as a factor. We investigate "good" and "bad" sequences on a k-ary alphabet and the pairs of words that witness that a word is "bad". A main result is an algorithm to decide whether a word is "bad" or not and to provide a pair of witnesses of minimal length when the word is "bad". It runs in O(n) time with a preprocessing of O(n) time and space to construct an enhanced suffix tree of the word.

Subject Classification

ACM Subject Classification
  • Mathematics of computing → Combinatorics on words
  • Theory of computation → Design and analysis of algorithms
  • Theory of computation → Formal languages and automata theory
  • Isometric words
  • Words avoiding factors
  • Index of a word
  • Overlap
  • Lee distance


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


  1. Marcella Anselmo, Manuela Flores, and Maria Madonia. On k-ary n-cubes and isometric words. Preprint, 2021. URL:
  2. Marcella Anselmo, Manuela Flores, and Maria Madonia. Quaternary n-cubes and isometric words. In Thierry Lecroq and Svetlana Puzynina, editors, Combinatorics on Words, pages 27-39, Cham, 2021. Springer International Publishing. Google Scholar
  3. Marcella Anselmo, Dora Giammarresi, Maria Madonia, and Carla Selmi. Bad pictures: Some structural properties related to overlaps. In Galina Jirásková and Giovanni Pighizzini, editors, DCFS 2020, volume 12442 of Lect. Notes Comput. Sci., pages 13-25. Springer, 2020. URL:
  4. Marie-Pierre Béal and Maxime Crochemore. Checking whether a word is hamming-isometric in linear time. arXiv preprint arXiv:2106.10541, 2021. Google Scholar
  5. Zvi Galil and Raffaele Giancarlo. Improved string matching with k mismatches. ACM SIGACT News, 17(4):52-54, 1986. Google Scholar
  6. Frank Harary, John P. Hayes, and Horng-Jyh Wu. A survey of the theory of hypercube graphs. Computers & Mathematics with Applications, 15(4):277-289, 1988. URL:
  7. W. . Hsu. Fibonacci cubes-a new interconnection topology. IEEE Transactions on Parallel and Distributed Systems, 4(1):3-12, 1993. URL:
  8. Aleksandar Ilić, Sandi Klavžar, and Yoomi Rho. Generalized fibonacci cubes. Discrete Mathematics, 312(1):2-11, 2012. URL:
  9. Sandi Klavžar. Structure of fibonacci cubes: A survey. Journal of Combinatorial Optimization, 25, May 2013. URL:
  10. Sandi Klavžar and Sergey V. Shpectorov. Asymptotic number of isometric generalized Fibonacci cubes. Eur. J. Comb., 33(2):220-226, 2012. Google Scholar
  11. Gad M. Landau and Uzi Vishkin. Efficient string matching in the presence of errors. In 26th Annual Symposium on Foundations of Computer Science, pages 126-136. IEEE, 1985. Google Scholar
  12. Weizhen Mao and David M. Nicol. On k-ary n-cubes: theory and applications. Discrete Applied Mathematics, 129(1):171-193, 2003. URL:
  13. Jianxin Wei. The structures of bad words. Eur. J. Comb., 59:204-214, 2017. Google Scholar
Questions / Remarks / Feedback

Feedback for Dagstuhl Publishing

Thanks for your feedback!

Feedback submitted

Could not send message

Please try again later or send an E-mail