The Prospero Challenge
mattkeeter.com
The Prospero Challenge
1–10 of 42 posts
Re: The Prospero Challenge
#2Re: The Prospero Challenge
#3https://samhenrycliff.medium.com/adapting-shakespeares-the-t...
Re: The Prospero Challenge
#4And then we define add(a, b) as sub(a, neg(b)). So then we only need to work out which y values sub(a, b) will return a negative result for.
sub(a,b) is negative when a.
We can have the sub() node asks its 2 child nodes which values they would return a negative result for. Every y coordinate where a gives a negative result and b gives a positive result is a y coordinate where sub(a,b) is negative. Every y coordinate where a is positive and b is negative is positive. For the remaining y values I think we have to actually evaluate the children and find out which ones give a negative result.
Obviously memoise the evaluation so that we don't repeat any work, and turn the expression tree into a DAG by combining any identical nodes. Some subtrees won't contain var-x, so the memoisation of those nodes can persist across different x coordinates.
And then for each x coordinate we ask the expression tree to tell us which y coordinates give negative outputs, and plot those. It's possible that the idea would generalise to 2-dimensional intervals, not sure.
I haven't implemented this yet but I'm planning to try it out, but to be honest I don't expect it to be faster than Matt's GPU version based on recursive subdivision with interval arithmetic. Btw his talk is great https://www.youtube.com/watch?v=UxGxsGnbyJ4&t=80s
And, a second fun challenge would be to reverse engineer the input file to extract the font! I expect the file is basically a union of x/y translations of functions that plot individual letters, so it shouldn't be crazy hard to split out the top-level union, then split-out the x/y translations, and then collect the letters. It's possible that it's more complicated though. In particular, is each character translated in x/y individually, or is each character translated only in x to form each line of text, and then the line as a whole is translated in y? Or something weirder?
Re: The Prospero Challenge
#5Re: The Prospero Challenge
#6I do not understand what this means at all, particularly the bit before the comma.
Can someone explain it differently?
Re: The Prospero Challenge
#7> If you evaluate the expression with (x,y) values in the ±1 square, then color pixels black or white based on their sign I do not understand what this means at all, particularly the bit before the comma. Can someone explain it differently?
Each line starts with a line number (with a leading underscore). This is followed by an instruction, and zero, one, or two arguments. The arguments can be either floating point constants or integers (with leading underscores) which represent the results of those corresponding lines earlier in the function.
The x and y coordinates of each pixel are loaded in the assembly language using the var-x and var-y instructions.
Re: The Prospero Challenge
#8Whoa cool invocation of the magician Prospero! I recently adapted “The Tempest” as a screenplay while in jail and typed it up: https://samhenrycliff.medium.com/adapting-shakespeares-the-t...
Re: The Prospero Challenge
#9> If you evaluate the expression with (x,y) values in the ±1 square, then color pixels black or white based on their sign I do not understand what this means at all, particularly the bit before the comma. Can someone explain it differently?
The expression is (probably) a 2d signed-distance function - https://en.wikipedia.org/wiki/Signed_distance_function
Re: The Prospero Challenge
#10Whoa cool invocation of the magician Prospero! I recently adapted “The Tempest” as a screenplay while in jail and typed it up: https://samhenrycliff.medium.com/adapting-shakespeares-the-t...