I ran across this article recently (https://www.gatesnotes.com/meet-bill/source-code/reader/microsoft-original-source-code) and it has a great opening piece of ASCII Art. I have a screenshot here:
For some reason, I thought, “I should do this in SQL”.” Then I thought, can the AIs help?
Let’s see.
This is part of a series of experiments with AI systems.
SQL Prompt AI
My first instinct is to use Claude first, but here I decided to ask SQL Prompt AI for help. I generically asked for a function that would take a word as a parameter and then produce ASCII Art. I ended up with a function and a procedure. I won’t show all the code, but I ended up with this result.
I thought this might be cutting off the message, but “Hello” produced “Helo”. So I asked SQL Prompt AI to alter the function to fix this. It tried, but it put a CTE in a subquery, which isn’t valid.
I pasted in the error message, but it returned me advice, not new code.
I suspected this might be because I had a few batches in this query window, so I copied just the function to another window, then pasted in the error and things got fixed.
Claude
While SQL Prompt was working, I opened a tab for Claude and asked a question: I want a generic MSSQL function that returns ascii art for a character passed in
I got the results, which were good, but only for one letter. Good, but I realized I had done a poor job of specifying my intention.
I then added another prompt to this chat: can I get a wrapper here that let’s me pass in a word and get the word returned as one result set?
This returned me a wrapper function with an explanation. The code is in my repo (linked below).
When I tested this a bit, it worked well, including with spaces.
Summary
I added this to my AIExperiments repo under the ASCII Art folder. You can check out the code and play if you want, or ask your own AI to do this.
This is a big waste of LLM compute, and really SQL Server core compute, but it’s fun. It was something I could have written, but how tedious is it to produce a function to do this? Even if I were to try and write an algorithm to produce letters from art, I could, but it’s not really worth the effort other than as an exercise to solve the problem.
This is also something I would guess many programming students work through. I haven’t had this, but I had to shuffle a deck of cards and other types of simulation exercises to help me learn to think in algorithms.
I do think working through algorithms is a good use of your time. It helps you think and learn and doing this will absolutely help you better judge the quality of other code, including that written by AIs.
However, I have done some of this work, and it’s not a good use of my time. Or likely the LLMs, but it was fun. I’ll likely use this in some Question of the Days in the future somehow.