Reply 80 of 93, by Harry Potter
I have to admit that I don't know how to use AI but have a project that's AIish.
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
I have to admit that I don't know how to use AI but have a project that's AIish.
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Try https://claude.ai/, it's great for code. It can analyse your code and then you can ask it questions about how to improve specific things - you just ask questions like you would ask a person.
ChatGPT or even Copilot can be very helpful too.
Life? Don't talk to me about life.
Good news: Earlier today, I gained .7% compressibility in my text adventure's text and decreased its total main parts' size from 8.32k down to 8.27k. 😀 That's not much but is something.
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Down to 8.25k due to tweaking and optimizing. 😀 I had 8.24k but don't know what happened to it. 🙁
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Harry Potter wrote on 2026-03-07, 15:31:but don't know what happened to it.
Are you using source control? Make a note of the performance with each change you check in and then you'll never be wondering what happened.
Life? Don't talk to me about life.
I'm sorry about this, but what's "source control"?
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Git, Subversion, CVS, etc.
Keeping a log of the changes of your source and documentation and allow you to compare, merge, rollback different versions of your source tree as well as individual files.
If you're not using source control then you really should be.
My collection database and technical wiki:
https://www.target-earth.net
I do back up my works but often not diligently enough. 🙁
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Earlier today, I found where the numbers went: they went to a different version of the C compiler I'm using. 😀
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Earlier today, I managed to decrease the size of the test code but only slightly. I have no idea what I'm doing wrong, but my best compression technique only approaches 50%. 🙁 Maybe it's with the way I'm handling tokens.
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Still little progress, but tokenization is doing a little better. Here's the current code for tokenization:
unsigned parsetokens1main (void){int i, j, k, l, m, o;unsigned curstrlen, curtoklen;unsigned newtok;int n;int bestcurtok, bestcurtoklen;//struct tok2buf * besttok[16];struct string_buffer *teststr;char *besttokptr;char* tokstr;unsigned toklen;curstr=strings;while (curstr) {curstrlen=curstr->inlen-1;for (i=0; i<curstrlen;) {bestcurtok=-1; newtok=1; bestcurtoklen=3;m=0;for (j=i-1; j>=0; --j) {l=getlenmatch(&curstr->in[i], &curstr->in[j]);if (l==bestcurtoklen) {newtok=0;bestcurtok=j;bestcurtoklen=l;} else if (l>bestcurtoklen) {newtok=1; m=1;bestcurtok=j;bestcurtoklen=l;}} if (curstr->prev) {teststr=curstr;while (teststr=teststr->prev) {if (teststr->inlen>=3) {for (k=teststr->inlen-3; k>=0; k--) {l=getlenmatch(&curstr->in[i], &teststr->in[k]);if (l==bestcurtoklen) {newtok=0;bestcurtok=j;bestcurtoklen=l;} else if (l>bestcurtoklen) {newtok=1; m=1;bestcurtok=j;bestcurtoklen=l;}}}}}newtok=1;for (j=0; j<tok2bufsize; j++) {if (bestcurtoklen==tok2buf[j].len && !memcmp(&curstr->in[i], tok2buf[j].token, bestcurtoklen)) {newtok=0; break;}}if (newtok && bestcurtoklen>=4) {addtotok1 (&curstr->in[i], bestcurtoklen);} else {tok2buf[j].occur++;}if (bestcurtoklen>=4) i+=bestcurtoklen;else i++;
}curstr=curstr->next;}sorttokens1();compresstoks();compresstoks2();curstring=strings;while (curstring) {complit_5a();curstring=curstring->next;}writetokstofile();writestrs();writedeclstrs();return 0;}void sorttokens1 (void){unsigned i, j, k, l;struct tok2buf tmpswaptok;for (i=0; i<tok2bufsize; i++) {tok2buf[i].saved=((tok2buf[i].len)*(tok2buf[i].occur));if (tok2buf[i].occur<3) tok2buf[i].saved=0;}for (i=0; i<tok2bufsize-1; i++) {k=i;for (j=i; j<tok2bufsize; j++) if (tok2buf[j].saved>tok2buf[k].saved) k=j;if (k!=i) {memcpy (&tmpswaptok, &tok2buf[i], sizeof(tmpswaptok));memcpy (&tok2buf[i], &tok2buf[k], sizeof(tmpswaptok));memcpy (&tok2buf[k], &tmpswaptok, sizeof(tmpswaptok));}}for (i=0; i<tok2bufsize; i++) {if (tok2buf[i].saved<20) {tok2bufsize=i; break;}}collecttokens();}
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
I was wrong: I implemented the attached code, and it cost me some compressibility. 🙁 I recently managed to buy some points in one version of PrintTok2, though. 😀 Any other ideas I can implement?
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
Hi! I was recently told on another forum that PrintTok2 was actually much better than I thought: until then, I didn't have an accurate comparison. However, one version is not doing as well as I'd like. 🙁 I recently gained 25 bytes there by shortening a token comparison from the size of the token to the four bytes. The compressed size in the experiment is now 2,863 bytes, but I want that number to be down to 2,850 bytes or better. Other than tokenization, I'm using BPE and a form of Static Huffman Codes on lower-case letters and certain punctuation. I'm using LZ77 on another version of PrintTok2 but deprecated it here, as it would require way more code and data to decompress than I gained via better compression.
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community
BTW, I forgot to mention that the text adventure is now down to 7.92k. 😀
Joseph Rose, a.k.a. Harry Potter
Working magic in the computer community