A cautionary AI tale

Friday, 15 May 2026 10:27 am
miriam_e: from my drawing MoonGirl (Default)
[personal profile] miriam_e
Sometimes AI is amazing... and other times, not so much. Here is a short, cautionary tale.

I recently installed an emulator for the TI-86 graphing programmable calculator. It's old and discontinued, but is very nice. I wish I'd had something like that when I was a kid. Kids today are so lucky. [sigh]

After running a cellular automaton program someone wrote for the TI-86, I wanted to understand how they'd written it, but the small screen shows just 21 characters across by 8 lines (128x64 pixels), so I had a look at the program file in a text editor on my desktop computer.

Not viewable.

Okay. I looked on the net for information about the format of TI-86 programs, but couldn't find any. I did find quite a few pages describing the file format of programs for the earlier TI-84 and TI-83, so figuring it would be similar I let the problem simmer for a while in my brain. (I often find this lets me come up with easy ways to solve problems.)

However, in this case, after about a day of turning the problem about in my mind, all I could see were ugly, brute-force approaches. I was sure there must be a more elegant approach, so I showed Claude AI the approach I'd been thinking of, and asked it how it would attack the problem.

It surprised me by telling me my approach would decode TI-83/84 programs, but not TI-86 ones, as they have an entirely different encoding scheme. I explained that I'd been unable to find a description of the TI-86 file format.

Claude AI asked me if I'd like it to write a program to decode it. Normally I prefer to do such things myself, but I was pushed for time, so I said yes.

It gave me a surprisingly long and complicated python program, which mostly worked, though there were some strange characters in the output. I figured I could clean it up myself.

I'm not keen on python. I used to write python programs years ago, but not much anymore, so I asked what approach it would use in writing an awk program to do the same thing.

It wrote one, which was much smaller than the python program, which is my usual experience with awk. This program had small problems too, but I figured I'd be able to fix that up pretty easily.

Well, I was trying to track down what some of these characters were by making a hexdump of the original file and I was astounded: the original TI-86 file is already in plain text!!!

It has a weird binary header that chokes any text editor, so I chopped off the header and the whole file could be read easily, except for a few odd characters. I replaced them and I had a simple, text listing of the cellular automaton program. Yay!

It took me just one line to do it:
tail -c +75 prog.86P | sed 's/\xd6/\n/g; s/\x1c/→/g; s/\x1a/−/g' >prog.txt
tail -c +75
cuts off the header of the file retaining everything from the 75th character onwards.

prog.86P
is the program to be decoded. The actual one I was wanting to see is named "CelAutom.86P".

|
pipes the output of the tail command into the next command, sed.

sed 's/\xd6/\n/g; s/\x1c/→/g; s/\x1a/−/g'
looks complicated, but it really isn't. It is really 3 small sed commands joined together using ";". The first part:

s/\xd6/\n/g
substitutes the hex value D6 (which is decimal 214) with the newline character (represented by \n). The g command tells sed to do this every time it encounters D6 on the line.

s/\x1c/→/g

substitutes the hex character 1C (decimal 28) with the arrow character "". It probably doesn't need to be global, since there's unlikely to be more than one on a line, but I made it global just to be sure.

s/\x1a/−/g
substitutes hex character 1A with the negate character "". This was a weird one. The TI-86 uses a different character to distinguish between minus (example: 3-2=1) and negate (example: the negative number −6). Do it globally.

So, there you have it. AI found me information on the net that I'd been unable to locate, but surprisingly didn't notice that the files I wanted to decode were pretty-much already in plain text. To be fair, I wasn't able to find the data online that it did, and I also failed to realise the program was plain text, until I used "hexdump -C" to look at it.

So AI is great, but at times also kinda stupid... like us.

Oh, and the cellular automaton image? You can see, below, an example for rule 30 (my favorite). It is a chaotic universe that self-generates from a single point.

Profile

miriam_e: from my drawing MoonGirl (Default)
miriam_e

May 2026

S M T W T F S
      12
34567 89
10 11 121314 1516
17181920212223
24252627282930
31      

Style Credit

Expand Cut Tags

No cut tags
Page generated Saturday, 23 May 2026 09:17 am
Powered by Dreamwidth Studios