by simias · 6y ago · 0 comments
But it's actually a lot more clever than that.
I feel like this would be a lot more impressive if it was written in simple and clear C since then you'd see that there really isn't any tic-tac-toe logic being explicitly implemented the way you'd expect.
https://gist.github.com/hugomg/73e91ebca7ced3c5c6f955e9e830b...
E.g.
/usr/src/cmd/sh/mac.h:
#define IF if(
#define THEN ){
#define ELSE } else {
#define ELIF } else if (
#define FI ;}
#define BEGIN {
#define END }
#define SWITCH switch(
#define IN ){
#define ENDSW }
#define FOR for(
#define WHILE while(
[1] https://research.swtch.com/shmacroOne of my favourite accidental features in Rust is that macros are so annoying and cryptic to write that people think twice before abusing them.