point: {(y;pn[f%20;0.3*x;0.1*y]*-18*sin y*pi%100)}
line: {((30;x)+)'point[x]'!100}
draw: {,(,/line'38+6*!16;cga;1)}----
This K program appears to be defining three functions (point, line, and draw) that are related to drawing a mathematical pattern.
point function: point: {(y;pn[f%20;0.3x;0.1y]-18sin ypi%100)} This function takes two arguments: y and a variable function pn[f%20;0.3x;0.1y]. The function computes a value based on these arguments and returns the result. The expression (f%20;0.3x;0.1y) inside the pn function seems to generate new values for x and y based on the input x and y. The final result is multiplied by -18 sin(y * pi % 100), which can create interesting patterns depending on the input values.
line function: line: {((30;x)+)'point[x]'!100} This function takes a single argument, x, and computes the result of the point function for 100 evenly spaced values of y in the range 0 to 1 (by indexing the point function with x and each value in the range '0 to 99'). The results are then shifted by (30; x) to create a new set of coordinates. The function returns a list of these transformed coordinates.
draw function: draw: {,(,/line'38+6*!16;cga;1)} This function generates a sequence of 16 values (from 0 to 15) and multiplies each by 6, then adds 38. It then computes the line function for each of these values and concatenates the results. The final expression (cga; 1) seems to be related to the color or other visual properties of the pattern, but it is not clear from the given code snippet how it is being used.
Overall, this K program appears to be generating a list of coordinates for a complex pattern by applying transformations to a series of points. The specific pattern depends on the input values and the function pn, which is not fully defined in the provided code snippet.
It's a bit confused by the first function. It takes two arguments, x and y, and returns a tuple. The first value is 'y' and the second value is (sin(pi % 100 * y) * -18) * perlinNoise(frameNumber % 20, 0.3 * x, ), 0.1 * y). I might be a little off on that formula, it's been awhile since I've read k code.
The Eternal September of AI has come earlier than expected.
https://twitter.com/bbcmicrobot/status/1604784926032740352
1MO.4:DIMR(4)
2F.Y=820TO120S.-20
3GC.0,1:MOV.0,Y:DR.1279,Y:F.L=1TO4:R(L)=RND(120):N.L
4F.M=0TO1:GC.0,1-M:Z=Y-8*M:F.L=1TO3:A=200+L*150:MOV.A+R(L)+90,Z+160- R(L+1):MOV.A,Z:PL.81,300,0:N.L:N.M
5N.Y
9PRINT TAB(13,29);"BASIC PLEASURES"
You can click through in the 'Source' link in the tweet and see how it did that - by painting the image filled in white first then filled in black slightly lower.(Re your point about the heights of the peaks - I actually adjusted my program to do this immediately after posting, and IIRC posted that too, but it was the first attempt that got all the likes/rts. I tended to do this all the time with these-just post the very first version that barely works, then regret it. I'm still doing that, this version of the vertigo poster... https://hachyderm.io/@bbcmicrobot@mastodon.me.uk/11010756246... was quickly followed by the fixed one... https://hachyderm.io/@bbcmicrobot@mastodon.me.uk/11010797875...)
Not particularly different, other than that I assume OP's challenge was to see how tiny they could make this and that might expand the code size.
>“EIGHTY SUCCESSIVE PERIODS of the first pulsar observed, CP1919 (Cambridge pulsar at 19 hours 19 minutes right ascension), are stacked on top of one another using the average period of 1.33730 seconds in this computer-generated illustration produced at the Arecibo Radio Observatory in Puerto Rico. Although the leading edges of the radio pulses occur within a few thousandths of a second of the predicted times, the shape of the pulses is quite irregular. Some of this irregularity in radio reception is caused by the effects of transmission through the interstellar medium. The average pulse width is less than 50 thousandths of a second.” From “The Nature of Pulsars,” by Jeremiah P. Ostriker, Scientific American, January 1971.
https://blogs.scientificamerican.com/sa-visual/pop-culture-p...
[1] https://forums.somethingawful.com/showthread.php?threadid=37...
https://codegolf.stackexchange.com/questions/258335/shortest...
EDIT: Actually, my memory failed me. I just took a quick survey of some more questions and 4x or 5x seems typical for golfed vs golfed.
And Ike itself is not a bad environment to play around with K https://johnearnest.github.io/ok/ike/ike.html
It has a repl as well in: https://johnearnest.github.io/ok/ you can find source here: https://github.com/JohnEarnest/ok and manual here: https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual....
If this is the entirety of K - https://kparc.com/k.txt it does fit on a single full-screen page.
it has a well-written manual and is a great jumping off point. the source is written in ~1000 lines of js. so you can look at how each primitive is implemented.
there is a k-enthusiast element.io server[1] where you can ask any question you like. folks are friendly!
EDIT: another commenter shared most of this info. oops :-) i'll add as well ngn-k browser repl[2] which has some docs and a fuller feature-set than oK. this is probably the most-used open source k right now. the author is active in the above element server, and still patches bugs and makes updates.
[0] https://github.com/JohnEarnest/ok
The cover was a stylized visualization of a fast Fourier transform, which this is replicating.