Author Topic: Text sprite finder  (Read 9543 times)

0 Members and 1 Guest are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Text sprite finder
« on: October 07, 2011, 06:45:55 pm »
For making graphical TI-BASIC games, I've always kept a 5x5 [tibd]textsprites[/tibd] finder that takes a sprite in the form of a matrix and finds characters whose leftmost columns help build the sprite. I made it back in 2009 or so, and it was nearly four hundred bytes, which for me back then was an achievement. Last year I figured I'd try fixing it up again and got it down to 308 bytes, but today I decided to try again and cut out half of that. So here's my 148-byte text sprite finder. It takes a matrix (in Ans) as input and outputs a string (in Ans), and destroys L1-L5 and I in the process. Here it is in TokenIDE format:
Code: [Select]
Matr>list(Ans,L1,L2,L3,L4,L5
"?
For(I,1,5
Ans+sub(" .?X+çQB^SplotcrossJ|v[s][e]plotsquareTI:?^^x[xhat]CAY?^^2ZV5è[i]",32fPart(sum(expr(sub("L1L2L3L4L5",I,1))10^5-cumSum(binomcdf(4,0))))/32)+1,1
End
sub(Ans,2,5
I know it could be modified to parse faster and not destroy the lists, but that made it larger and involved destroying [A], which I feel is more valuable than L1-L5.
« Last Edit: October 07, 2011, 06:46:09 pm by Deep Thought »




Offline boot2490

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 607
  • Rating: +54/-36
    • View Profile
    • Boot2490's Stuff
Re: Text sprite finder
« Reply #1 on: October 07, 2011, 06:47:14 pm »
Cool! I think I might use it.
I'm not worried about SOPA creating censorship, that will not stand for long. I'm worried that they'll succeed in stopping piracy!

Spoiler For Signature, updated march 23, 11:28 PM EST:















An useful tool!

PM me if you need some help. I am glad to be of assistance and part of the TI Communnity.

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Text sprite finder
« Reply #2 on: October 07, 2011, 06:47:16 pm »
Wow! That's crazy fast and crazy small. Thanks for the code! If I ever get around to finishing my DM utility I'll definitely use this. One question: how does it handle impossible text sprites?
« Last Edit: October 07, 2011, 06:47:34 pm by JustCause »
See you, space cowboy...

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Text sprite finder
« Reply #3 on: October 07, 2011, 06:48:12 pm »
They're outputted as a ?. There are exactly three as far as I know (including the two that have equivalents that aren't three chars wide, which is standard).




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Text sprite finder
« Reply #4 on: October 07, 2011, 06:56:50 pm »
Nice. I think there is only one impossible column though, unless you're counting sixth row ones too. I should probably go back and look over my text sprite maker and see if I can change anything. It's over a year old now and in the depth of the projects forum :P
« Last Edit: October 07, 2011, 06:57:58 pm by meishe91 »
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Text sprite finder
« Reply #5 on: October 07, 2011, 07:00:59 pm »
Lol I still remember yours -- you posted it just as I was posting my first version of mine, and when I saw yours I thought "oh well" XD




Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Text sprite finder
« Reply #6 on: October 07, 2011, 07:04:35 pm »
Ah okay :P Well cool. I need to look at my sprite maker too. I never did add the things I wanted :P
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Text sprite finder
« Reply #7 on: October 07, 2011, 07:08:08 pm »
I thought there was only 1 combination that didn't have a character equivalent?

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Text sprite finder
« Reply #8 on: October 07, 2011, 07:09:26 pm »
I thought there was only 1 combination that didn't have a character equivalent?
I think they all have character equivalents, but not every available character equivalent is three pixels wide. That might break display in a program that assumes that width.
See you, space cowboy...

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Text sprite finder
« Reply #9 on: October 07, 2011, 07:12:46 pm »
I thought there was only 1 combination that didn't have a character equivalent?
I think they all have character equivalents, but not every available character equivalent is three pixels wide. That might break display in a program that assumes that width.

You're partly right. Every combination has one but there are two others that are more than three pixels wide. I think that's what he means.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline JustCause

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 810
  • Rating: +115/-5
    • View Profile
Re: Text sprite finder
« Reply #10 on: October 07, 2011, 07:13:33 pm »
I thought there was only 1 combination that didn't have a character equivalent?
I think they all have character equivalents, but not every available character equivalent is three pixels wide. That might break display in a program that assumes that width.

You're partly right. Every combination has one but there are two others that are more than three pixels wide. I think that's what he means.
I thought that was what I said. Which is, in retrospect, wrong, as I believe there's one combination without an equivalent. *headdesk* :P
See you, space cowboy...

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Text sprite finder
« Reply #11 on: October 07, 2011, 07:15:18 pm »
01011 (vertically) doesn't have a character equivalents. There are two others that have equivalents that are more than three columns wide, but I gave them ?s because I personally don't use anything more than three columns wide. You can always add it in yourself if you want.




Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Text sprite finder
« Reply #12 on: October 07, 2011, 07:48:13 pm »
true i suppose, although I would have included them, and then allowed people to remove them if they wanted to impose restrictions, as removing or excluding tokens is much easier than adding them in :P

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Text sprite finder
« Reply #13 on: October 08, 2011, 10:59:50 am »
true i suppose, although I would have included them, and then allowed people to remove them if they wanted to impose restrictions, as removing or excluding tokens is much easier than adding them in :P

Well it's only really hard to add things if it is a hidden token.
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline mrmprog

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 559
  • Rating: +35/-1
    • View Profile
Re: Text sprite finder
« Reply #14 on: October 08, 2011, 11:14:56 am »
Wow! That is really good. This will make textsprites much easier.