TicTacToe in SQL (Postgres)
bitbucket.orgTaking it to the next level -
Injecting a Chess Engine into Amazon Redshift
http://www.michaelburge.us/2017/09/10/injecting-shellcode-to...
Here is a version you can play with online: https://dbfiddle.uk/?rdbms=postgres_11&fiddle=71940aadda50f5...
Yep. Recursive CTE are most bad ass feature of SQL which makes it do stuff that LISP and Haskell does but more declaratively
This Single SQL Query Solved My Sudoku In Seconds
original link: https://technology.amis.nl/2009/10/13/oracle-rdbms-11gr2-sol...
Why are you linking it to a third party site.
Not OP but my guess; OP remembered they read an article about this, googled it, found the first result and linked it. Third party site is winning the SEO game.
Yes true, even this third-party site has given credit to the original link.
Cool, I’m curious, does anyone know - which langauge would use fewest number of characters, to create TicTacToe?
The special purpose language, TicTacToe-inator, where an input of zero length compiles to TicTacToe.
I love how cynical this comment is. You're absolutely right though, every language solves a specific problem, so it's kind of arbitrary what language does something in the shortest amount of letters.
Well, this is trivia about our craft that we enjoy talking about and comparing. Consider that nobody is impressed by the TicTacToe DSL if it appeared among C, JS, and other languages we use. Not very cynical. It’d be a “heh” and move on.
If you want to be critical, it’s the stupid statements and interpretations people make from the comparisons. Like the Perl guy coming out of the woodwork to point out how we’re a bunch of idiots for not seeing the beauty of the Perl oneliner. Or how it demostates that Go doesn’t need generics and how JS web coders aren’t real developers.
The "higher" the language and more declarative. "Higher" because all the lower level work of data structures/etc are taken care of or even embedded into the language itself. "Declarative" because in declarative languages you just express what you want, not how to get it ( which imperative languages have to do ).
Compare "SELECT * FROM TBL1" with what you would need to do in an imperative language.
You would have to open data connection, set up data structures and have to specify step by step what you want. Even if you had libraries doing most of the work, you would still need to specify step by step what you want to be done. Whereas with SQL, you specify what you want and let the language/interpreter/optimizer/engine figure out the rest.
That's only considering "number of characters". Now if you measured "executable size" or memory size or any other impact, it might be different.
There are code golfs for at least checking the game states:
- https://codegolf.stackexchange.com/questions/32383/determine...
- https://stackoverflow.com/questions/2245801/code-golf-tic-ta...
You could probably add an extension to HQ9+[0] that'll get the job done pretty quick
APL/J
k