A first person shooter in 571 lines of GNU Awk (2016)
github.com
github.com
https://fgiesen.wordpress.com/2012/04/08/metaprogramming-for...
Nov 12, 2020 https://news.ycombinator.com/item?id=25043199
Aug 8, 2019 https://news.ycombinator.com/item?id=20635640
May 13, 2014 https://news.ycombinator.com/item?id=7739599
AFAIK the people behind kkrieger tried to push their tool for commercial use at some point but it didn't seem to catch on - but that was years ago.
I enjoyed the video. However for me it’s not about the game being small, it’s about implementing anything 3d (or any game for that matter) in awk!
At least, as far as I am aware, there is no programmatic interface
The embedder can decide what variables and functions to provide for each invocation of the script. You could get something like Wireshark filters out of the box:
ip && port==1234 {print size, time}
Graphviz includes a tool "gvpr" which essentially implements this idea for processing graphs but of course, they end up reimplementing a large part of awk.A project that's using it that way is Benthos, a "stream processor" written in Go. Awk is one of the "processors", the components that filter and transform data: https://www.benthos.dev/docs/components/processors/awk
Edit: I see that you have: https://github.com/benhoyt/goawk/issues/152
I am not totally sure if this is what you mean or not, but it's much nicer than embedding the script into a bash source file.
and article on how to use:
https://www.codeproject.com/Articles/5264205/Embedding-AWK-i...
I found this snippet on stackexchange showing how exactly that is possible on Linux.
> echo hello | gawk '!length{exit(0)} {print; print substr($0,2) >"/dev/fd/3"; fflush()}' 3>/dev/fd/0
This "renders" on stdout then feeds itself more input on /dev/fd/3.
See also "AWK As A Major Systems Programming Language — Revisited" also linked from that article: http://www.skeeve.com/awk-sys-prog.html
Show HN: 3D shooter in your terminal using raycasting in Awk - https://news.ycombinator.com/item?id=10896901 - Jan 2016 (55 comments)
It's honestly worth giving the mawk and gawk manual a skim just to see what all they can do. I want to read through The AWK Programming Language as well.
Brendan Eich said as much: "JS’s function keyword did come from AWK" [1].
[1]: https://brendaneich.com/2010/07/a-brief-history-of-javascrip...
Lists projects like "CHIP-8 emulator", "A console videoplayer", "Draw 3D objects" etc
The SPARK subset of Ada enforces purity of functions at compile time.
SPARK also allows partial purity, i.e. you can declare that a procedure has side effects, but only in the sense that it uses the wall clock as an input, or only in the sense that it writes to a global variable. You can specify in some detail exactly which side effects are allowed to happen in a procedure.
__attribute__ ((pure))
__attribute__ ((const))
The 'pure' attribute imposes similar but looser restrictions on a function's definition than the 'const' attribute: 'pure' allows the function to read any non-volatile memory, even if it changes in between successive invocations of the function.BTW: gawk installation instructions for NetBSD and OpenBSD but not FreeBSD? That's a new one.
# pkg install gawkI went back recently and read more on it and now I understand: it was an excellent interpreted programming language that gave semiskilled programmers some things C didn't, like associative arrays, all nicely packaged within the UNIX frame of mind. In an alternative universe, perhaps awk, instead of perl and then python, would become the scripting language of choice.
At least for scripts longer than 30-40 lines where sh looks clunky with too much var substitution and clunky sed regexen.
Perl is something between sh and C on syntax, but easier and with builting match/replace capabilities.