Earlier quoted context omitted.
Impressive. Did you do all this in the past 2 hours?
Yeah, it took me an hour-ish to get the performance and then an hour-ish to figure out how to actually render it correctly. I had never seen the P2/P5 PGM format before so I didn't realize P5 files were binary. :)
The Prospero Challenge
21–30 of 42 posts
Re: The Prospero Challenge
#22Re: The Prospero Challenge
#23> (Spoilers: it also allocates 60+ GB of RAM for intermediate results, so consider reducing the image size before running it on your own machine) The input algorithm is essentially written in SSA form, and it's easy to analyze when each "register" stops being used; then you can drop the arrays after their last use. Turns out the number of live registers never exceeds 160 at any point in time, and with this one additi…
Re: The Prospero Challenge
#24> (Spoilers: it also allocates 60+ GB of RAM for intermediate results, so consider reducing the image size before running it on your own machine) The input algorithm is essentially written in SSA form, and it's easy to analyze when each "register" stops being used; then you can drop the arrays after their last use. Turns out the number of live registers never exceeds 160 at any point in time, and with this one additi…
I don't know why you are downvoted (at the time of this writing). That's a very good point and makes the simple Python solution feasible on many more computers (due to reduced memory footprint). It's also a straightforward pass (once you know what liveness analysis is). Since there are no loops it's just one pass starting from the end and working backwards to determine whether a variable is live or not, and then an e…
Re: The Prospero Challenge
#25Earlier quoted context omitted.
I don't know why you are downvoted (at the time of this writing). That's a very good point and makes the simple Python solution feasible on many more computers (due to reduced memory footprint). It's also a straightforward pass (once you know what liveness analysis is). Since there are no loops it's just one pass starting from the end and working backwards to determine whether a variable is live or not, and then an e…
I think getting downvoted (not by me) because if you scroll to the end of the post, that's the very first submission (by me).
Re: The Prospero Challenge
#26Hash the input, if it matches the expected input output the expected image. Otherwise error. Technically correct.
Just output the expected image in all cases.
Still technically correct. ;)
Re: The Prospero Challenge
#27Re: The Prospero Challenge
#28This is really fun, I'm getting badly nerd sniped by this.
Re: The Prospero Challenge
#29Re: The Prospero Challenge
#30Can you explain how you produce the opcodes from a text/image?