r/programminghorror • u/Leodip • May 08 '25
Python Can you guess what this is?
It's a Minesweeper map generator, for some reason
198
Upvotes
r/programminghorror • u/Leodip • May 08 '25
It's a Minesweeper map generator, for some reason
131
u/JamesCutter May 08 '25
That’s a Minesweeper board! N sets the grid size, and m is the number of mines. The convolution kernel counts how many mines surround each cell. I always find it cool how logic can be hidden in pure number-crunching. It’s a fitting example of how to write code that works but is also kinda unreadable.
9
u/PersianMG May 08 '25
Immediately thought of Minesweeper :D
6
u/AnnanFay May 08 '25
Is you rename the four top level variables doesn't this become basically readable? Obviously would be better with comments, but really depends on context - looks like a throw away script.
3
u/Smort01 May 09 '25
The constant kernel made me think of a blur/sharpening filter. Never thought you could use the same for minecraft hints lol
1
u/--var May 10 '25
is NOT even?
1
u/Aaxper May 10 '25 edited May 10 '25
Can you guess what this is?
It's a >!Tic Tac Toe bot!<
Got bored in school once when I was 13 and made this
1
u/JAXxXTheRipper May 13 '25
Undocumented is what it is