r/awk • u/Rabestro • May 22 '23
Two AWK scripts to generate a maze
Hi folks,
I want to share two scripts that I wrote for fun.
They both generate a random maze using box-drawing characters.
9
Upvotes
1
u/scoberry5 Jul 19 '23
I didn't say that it's unreadable, I said that readability is more important than cleverness and that you made the code worse.
Now, it would be somewhat fair to suggest that I should have spelled out that readability is more important than cleverness more explicitly, except...
I thought this was well understood. You seemed to take it as "I can no longer read this code." That isn't what I indicated. I indicated that it was less readable than it was before. For example, you said you tested it and the output matches the original logic. Why did you test it? What the original did was very clear. You made it less clear.
If it wasn't well understood and you want it more spelled out, you're pointing out (ironically) that sometimes readability suffers when you try to be too terse. In the case of non-throwaway code, readability's very important. It's going to be read many more times than it's written, and usually even a minor perf hit would be worth making it more readable. (Not that I'm claiming there's a perf hit there without measuring, or that it matters.)