August 5th, 2024

Tic-tac-toe in a single call to printf

A C implementation of a tic-tac-toe game, created for the 2020 International Obfuscated C Code Contest, features highly obfuscated code using a single `printf` statement and checks for game conditions.

Read original articleLink Icon
Tic-tac-toe in a single call to printf

The GitHub repository features a C implementation of a tic-tac-toe game, notable for its highly obfuscated code that utilizes a single `printf` call. Created for the International Obfuscated C Code Contest (IOCCC) in 2020, the project exemplifies advanced techniques in format string manipulation. The game allows two players to take turns entering digits from 1 to 9 to make their moves, while the code checks for wins, ties, and illegal moves. The obfuscation techniques employed include various format specifiers and tricks that manipulate memory and control flow, illustrating the concept of "printf-oriented programming." To use the program, users must compile the code with `gcc` and then run the executable. The game displays a tic-tac-toe board and prompts players for their moves, checking for winning conditions or ties after each turn. The code is licensed under GPL v3, permitting redistribution and modification under specified conditions. This project serves as an intriguing example of creativity in C programming, particularly for those interested in programming challenges or obfuscated code.

- The tic-tac-toe game is implemented in a single `printf` statement.

- It was created for the 2020 International Obfuscated C Code Contest.

- The game checks for wins, ties, and illegal moves during play.

- The code is licensed under GPL v3, allowing for redistribution and modification.

- It serves as a creative example of obfuscated programming techniques.

Link Icon 1 comments
By @basementcat - 2 months
Link to the Usenix paper that shows that printf() and fputs() are Turing complete.

https://www.usenix.org/conference/usenixsecurity15/technical...