5 ms·
Very cool. To try and understand it I reformated it to make it somewhat readable: https://gitlab.com/snippets/1832264 https://gitlab.com/snippets/1832264
by yourfate 8y ago
Very cool.
To try and understand it I reformated it to make it somewhat readable:
https://gitlab.com/snippets/1832264 https://gitlab.com/snippets/1832264
- benj111 8y agoThanks... But someone was there first, with expanded macros. https://gist.github.com/femto113/28f69626acddc70a002ecead0b311da4 https://gist.github.com/femto113/28f69626acddc70a002ecead0b3...
- homarp 8y agohttps://gist.github.com/munificent/ce8f7a9e6b09938ca8d2d43fa62f9864 https://gist.github.com/munificent/ce8f7a9e6b09938ca8d2d43fa... (from the author) https://gist.github.com/femto113/28f69626acddc70a002ecead0b311da4 https://gist.github.com/femto113/28f69626acddc70a002ecead0b3... (from https://news.ycombinator.com/item?id=19290841 https://news.ycombinator.com/item?id=19290841 )
- codetrotter 8y agoHopefully without sounding like I am trying to boast or anything... I find the difference in readability and clarity dramatic between those two on one hand and my own deobfuscated, refactored and commented version of the OP. https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb0280#file-dungeon-c https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb02...
- homarp 8y agoregarding your comment: >// Probably plus means a locked door, and single quote means unlocked, or the other way around. http://angband.oook.cz/stuff/manual.txt http://angband.oook.cz/stuff/manual.txt gives ' An open /broken door + A closed door $ Gold or gems A Angelic being ~ Light sources, Tools, Chests, Junk, Sticks, Skeletons, etc
- codetrotter 8y agoNice, thanks. I've updated the comments with the information you provided here :)
- codetrotter 8y agoBeen spending the past hour deobfuscating it a bit. https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb0280/14375eb385e48947999bb370dbcd514f0041ee4c https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb02... Meanwhile others have posted fully deobfuscated versions that the original author and someone else has published in the past. Oh well :P
- codetrotter 8y agoEither way, deobfuscating this is fun so I'll keep going. The link above goes to the first revision. Here is a link to the most recent revision at all times: https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb0280 https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb02...
- codetrotter 8y agoPretty much done deobfuscating, refactoring and commenting the code now. I think at this point most of it is pretty understandable. https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb0280 https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb02...
- codetrotter 8y agoI worked a little bit more on it, and thanks to my refactoring I have identified a bug in the original code (which I have intentionally retained in my own code because the point is to produce the same output as the original version, all the way down to and including bug-for-bug compatibility). Description of bug, which I also posted as a comment on the OP gist: > Player and other entities will never be placed on the rightmost column of the room floor, nor on the bottom-most row of the room floor. See https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb0280/3088bc0b79eae9ac29190e7dde012e3097cd1e16#file-dungeon-c-L177 https://gist.github.com/ctsrc/fef3006e1d728bb7271cff0656eb02... [...]. In my refactored version of your code the bug is explained at the line I linked to in this comment. https://gist.github.com/munificent/b1bcd969063da3e6c298be070a22b604#gistcomment-2854636 https://gist.github.com/munificent/b1bcd969063da3e6c298be070...