

A card game implemented in APL - alexcweiner
http://yhnmjuik.com/sols/ChildRummy.apl.html

======
jk4930
While I have a place in my heart for APL and its derivatives, my problem is
that I can't use it outside its finance niche. I have several books on APL and
its applications, looked into some implementations, but I didn't find a way to
bring it into my current projects.

Then the community is kind of dying out, at least over here (Germany).

This is really bitter for me. APL is fun with the intellectual satisfaction
that comes from arranging the symbols, the beautiful theoretical background
and the clear approach to doing things.

~~~
RodgerTheGreat
It doesn't have the nice symbols that APL uses, but I've been tinkering with a
graphical programming environment for K, one of APL's younger cousins. This
evening I wrote a crude version of breakout:

[http://johnearnest.github.io/ok/ike/ike.html?gist=a88a98b2f6...](http://johnearnest.github.io/ok/ike/ike.html?gist=a88a98b2f6da02377ab0)

How hard do you think it would be to write a similar SDL wrapper or the like
for your favorite APL implementation? I'm finding that K can be remarkably
pleasant for solving many of the problems that come up in games- movement,
pathfinding, manipulating raster graphics all fit well into the vector- and
matrix-oriented programming paradigm.

~~~
alexcweiner
This looks really neat. Is the SDL wrapper you wrote publicly available? It
shouldn't be too hard to clone.

~~~
RodgerTheGreat
Sorry, I was being unclear. The environment I wrote my game in is not an SDL
wrapper- it's all javascript and HTML 5. It is called iKe and it is indeed
open-source: [https://github.com/JohnEarnest/ok/tree/gh-
pages/ike](https://github.com/JohnEarnest/ok/tree/gh-pages/ike)

I was suggesting that it might be possible to use some graphics library (such
as SDL) to write an equivalent to iKe for other APL-family languages.

~~~
alexcweiner
This looks really neat. It may even give me a reason to learn K :)

I'm still not sure I totally understand. Are you suggesting that it would be
neat to rewrite things in ok/examples or ok/ike/examples in APL and provide
the draw function? Would that be enough to take advantage of what you wrote?
What else would be needed?

~~~
RodgerTheGreat
iKe works by running a K script, which includes both calculating static data
and defining some selection of functions. It then calls K functions in
response to various events- mouse clicks, key presses, etc. K programs define
handlers for the events they're interested in and ignore everything else. The
"draw" function is the only one which is strictly required, and it returns a
list of tuples which represent some bitmaps to blit to the display. It and
"tick" (if present) are called repeatedly and automatically by the system to
permit animation and so on.

iKe is designed to be similar in usage both to the kOS "Z" windowing library
(details are unknown, but there is one example program available to the
public: [http://kparc.com/edit.k](http://kparc.com/edit.k)) and Processing, a
Java-based environment aimed at beginners and artists.

I'm suggesting that other APLs could be equipped with a similar setup to what
iKe provides- export an APL module with some set of event handlers and at
least a definition of a "draw" method, and then use some cross-platform UI
toolkit to feed the APL events and render its results for the outside world.

Does that make sense?

~~~
alexcweiner
I think so,

It would be easy to make bitmap data with APL. What is the output of the
"draw" being processed by, (or where)? From there, I think it would be easy to
see where to wedge in APL.

~~~
RodgerTheGreat
In iKe's case, the output of draw is used by JavaScript to render to an HTML5
Canvas tag.

[https://github.com/JohnEarnest/ok/blob/gh-
pages/ike/ike.html...](https://github.com/JohnEarnest/ok/blob/gh-
pages/ike/ike.html#L472)

"draw" specifically returns a list of tuples which each consist of a position
(or a vector of positions), a palette of colors and then a single pixel, a
vector of pixels or a matrix of pixels. (Call it a rank 0, 1 or 2 bitmap, if
you like.)

------
RodgerTheGreat
Might gather some interest on
[https://www.reddit.com/r/apljk](https://www.reddit.com/r/apljk)

~~~
alexcweiner
I don't have a reddit account, but feel free to post if you want to.

------
alexcweiner
Hacker News emailed me and told me to repost this.

~~~
dang
Told? Invited!

The original URL is probably more interesting, though, so we've changed it
back from [http://yhnmjuik.com/sols](http://yhnmjuik.com/sols). Interested
readers can look at both.

~~~
alexcweiner
Either way its here. Thank you for fixing up the link :)

