Earlier quoted context omitted.
Well, there were those bored days with a TI-83... shudders at TI-BASIC
My son spends a ton of his class time programming games into his TI-83. He even built his own Final Fantasy type game (when he really should have been doing classwork). He built a battle system, and even a merchant/vendor for buying upgrades. I had a lot of fun playing his game, and offered him some ideas for improvement (which, again, were made during class time). And yet, I can't get him to sit down and put any tim…
Show HN: 3D shooter in your terminal using raycasting in Awk
41–50 of 57 posts
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#42Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#43Ill never forget the day I realized its true power was in shortness of code. I took a one page perl script I couldnt get to work and turned it into a one line awk script that worked.
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#44This could actually be used to build a file explorer, not sure for what, but it would be fun to explore directories this way.
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#45Earlier quoted context omitted.
Ah but awk is great! It's parsimony when processing structured text files is hard to beat. Such a pity the next step on from it is perl. Perl is snot certainly.
No, the next step from awk is ruby :-D. Anyways, I was talking about how this thing totally misappropriated awk, not awk itself.
After looking at the code I'd agree that it's not really idiomatic Awk. But come on, snot? I would've said a humble yet more dignified medium, such as match-sticks.
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#46Earlier quoted context omitted.
No, the next step from awk is ruby :-D. Anyways, I was talking about how this thing totally misappropriated awk, not awk itself.
In all seriousness, Ruby is Awk's grandchild borne of a virtuous union between Perl and Python. After looking at the code I'd agree that it's not really idiomatic Awk. But come on, snot? I would've said a humble yet more dignified medium, such as match-sticks.
This is your father's awk. An elegant weapon for a more... civilized age. :-)
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#47Earlier quoted context omitted.
I used to write a fair amount of AWK code back in the day. It was great for one-liners, but I wrote some more elaborate programs in it too. I treated it seriously, like a real programming language, and it served me well. My favorite AWK program was probably my LaserJet II code listing program from 1991. I wrote this out of frustration with the terrible default listings I got when I printed source code. The AWK code d…
Years ago I wrote a compiler (for bytecode) in awk. Ummm... http://cowlark.com/mercat , although you'll need to wade through zip files to get at the source. It was 1.6kloc for a fully typed algolish language producing stack-based bytecode. awk's a lovely little language, and deserves to be better known than it is. Its two big failings are local variable syntax and absence of structured types... and the standard libra…
So the embedded FORTH compiler written in AWK reads the FORTH code in a comment like this:
//@C SPACES
// \ n --
// BEGIN
// DUP 0>
// WHILE
// SPACE 1-
// REPEAT
// DROP
and compiles it into C code like this (reformatted here to help illustrate): COM(
spaces_word, codeword, "SPACES", &space_word,
(void*)&dup_word, (void*)&more0_word,
(void*)&branch0_word, (void*)(&spaces_word.payload[0] + 8),
(void*)&space_word, (void*)&sub_one_word,
(void*)&branch_word, (void*)(&spaces_word.payload[0] + 0),
(void*)&drop_word,
(void*)&exit_word
)Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#48Needs bash and gawk, bash you can avoid by changing cmd = "bash -c 'read -n 1 input; echo $input'" to cmd = "saved=$(stty -g); stty raw; var=$(dd bs=1 count=1 2>/dev/null); stty \"$saved\"; echo \"$var\"" all credit to izabera from #bash on freenode
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#49Earlier quoted context omitted.
Years ago I wrote a compiler (for bytecode) in awk. Ummm... http://cowlark.com/mercat , although you'll need to wade through zip files to get at the source. It was 1.6kloc for a fully typed algolish language producing stack-based bytecode. awk's a lovely little language, and deserves to be better known than it is. Its two big failings are local variable syntax and absence of structured types... and the standard libra…
That is brilliant! So the embedded FORTH compiler written in AWK reads the FORTH code in a comment like this: //@C SPACES // \ n -- // BEGIN // DUP 0> // WHILE // SPACE 1- // REPEAT // DROP and compiles it into C code like this (reformatted here to help illustrate): COM( spaces_word, codeword, "SPACES", &space_word, (void*)&dup_word, (void*)&more0_word, (void*)&branch0_word, (void*)(&spaces_word.payload[0] + 8), (voi…
It all means that the C source can just be compiled in a single step --- gcc -o fforth fforth.c --- without needing a precompilation stage, which makes it vastly easier to manage.
It's even portable!
Re: Show HN: 3D shooter in your terminal using raycasting in Awk
#50I was wondering how you'd read a key in raw mode in awk. The answer, I found with a mix of horror and admiration is 3 forks. Two stty and one bash (presuming read and echo are builtins)
It's sad that languages rise and fall by the feature base present in their standard libraries.