最后活跃于 1730513051

修订 7e500358ce1d470e79ffab7763d482e6a61a4e68

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