rgb400_ungolfed
· 1.4 KiB · Text
Brut
Playground
|--| Are we at the end of a line?
| end of line?,x|x,~ end of line| end of line?| end of line
|--| Are we at the end of the screen?
| end of screen?,y|y,~ end of screen| end of screen?| end of screen
|--| Co pixel_y the pixel coordinates from `x/y` to `@pixel-x/@pixel-y`.
| pixel_x=x,x|*x,@pixel-x, pixel_x=x
| pixel_x=x|
| pixel_y=y,y|*y,@pixel-y, pixel_y=y
| pixel_y=y|
|--| Compute some pixel colors based on the `x/y` coordinates.
|--| r = x, g = y, b = x + y
| pixel_red=x,x|*x,@pixel-r, pixel_red=x| pixel_red=x|
| pixel_green=y,y|*y,@pixel-g, pixel_green=y| pixel_green=y|
| pixel_blue=x+y,x|*x,@pixel-b, pixel_blue=x+y
| pixel_blue=x+y,y|*y,@pixel-b, pixel_blue=x+y
| pixel_blue=x+y|
|--| Copy temporaries back to their respective variables.
|*x|x|*y|y
|plot_pixel| pixel_x, pixel_y, pixel_red, pixel_green, pixel_blue,ps
| pixel_x| pixel_x=x:399
| pixel_y| pixel_y=y:399
| pixel_red| pixel_red=x:399
| pixel_green| pixel_green=y:399
| pixel_blue| pixel_blue=x+y:399
|ps|@set-pixel
|--| Move the `x/y` coordinates.
|x-,x||x-||y-,y||y-|
|--| Main loop.
||x:399,y:399
|draw, end of line,x|draw, end of line,draw
|draw, end of line|draw, end of screen?, @display
|draw,~ end of line|plot_pixel,x-,draw
|draw, end of screen|plot_pixel,x:399,y:399
|draw,~ end of screen,x|draw,~ end of screen
|draw,~ end of screen|y-,x:399,draw
|draw| end of line?,draw
|--| clean up remaining facts
|x||y|
||draw
| 1 | |--| Are we at the end of a line? |
| 2 | | end of line?,x|x,~ end of line| end of line?| end of line |
| 3 | |
| 4 | |--| Are we at the end of the screen? |
| 5 | | end of screen?,y|y,~ end of screen| end of screen?| end of screen |
| 6 | |
| 7 | |--| Co pixel_y the pixel coordinates from `x/y` to `@pixel-x/@pixel-y`. |
| 8 | | pixel_x=x,x|*x,@pixel-x, pixel_x=x |
| 9 | | pixel_x=x| |
| 10 | | pixel_y=y,y|*y,@pixel-y, pixel_y=y |
| 11 | | pixel_y=y| |
| 12 | |
| 13 | |--| Compute some pixel colors based on the `x/y` coordinates. |
| 14 | |--| r = x, g = y, b = x + y |
| 15 | | pixel_red=x,x|*x,@pixel-r, pixel_red=x| pixel_red=x| |
| 16 | | pixel_green=y,y|*y,@pixel-g, pixel_green=y| pixel_green=y| |
| 17 | | pixel_blue=x+y,x|*x,@pixel-b, pixel_blue=x+y |
| 18 | | pixel_blue=x+y,y|*y,@pixel-b, pixel_blue=x+y |
| 19 | | pixel_blue=x+y| |
| 20 | |
| 21 | |--| Copy temporaries back to their respective variables. |
| 22 | |*x|x|*y|y |
| 23 | |
| 24 | |plot_pixel| pixel_x, pixel_y, pixel_red, pixel_green, pixel_blue,ps |
| 25 | | pixel_x| pixel_x=x:399 |
| 26 | | pixel_y| pixel_y=y:399 |
| 27 | | pixel_red| pixel_red=x:399 |
| 28 | | pixel_green| pixel_green=y:399 |
| 29 | | pixel_blue| pixel_blue=x+y:399 |
| 30 | |ps|@set-pixel |
| 31 | |
| 32 | |--| Move the `x/y` coordinates. |
| 33 | |x-,x||x-||y-,y||y-| |
| 34 | |
| 35 | |--| Main loop. |
| 36 | ||x:399,y:399 |
| 37 | |draw, end of line,x|draw, end of line,draw |
| 38 | |draw, end of line|draw, end of screen?, @display |
| 39 | |draw,~ end of line|plot_pixel,x-,draw |
| 40 | |draw, end of screen|plot_pixel,x:399,y:399 |
| 41 | |draw,~ end of screen,x|draw,~ end of screen |
| 42 | |draw,~ end of screen|y-,x:399,draw |
| 43 | |draw| end of line?,draw |
| 44 | |
| 45 | |--| clean up remaining facts |
| 46 | |x||y| |
| 47 | |
| 48 | ||draw |
| 49 |