Author |
Message |
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 01 Jan 2008 04:14:48 pm Post subject: |
|
|
I may have found the fastest text-wrapper to-date. Not wordwrapping, but text-wrapping (where newlines are defined by characters in the string).
:1→A
:For(Z,1,length(Str1
:A+6→A
:inString(Str1,"/",Z
:Text(A,1,sub(Str1,Z,Ans-Z
:Ans→Z
:End
The newline char is "/" and the string to be wrapped is Str1.
At least, I think it's the fastest...
Last edited by Guest on 30 Jul 2010 05:39:06 am; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 01 Jan 2008 04:24:26 pm Post subject: |
|
|
That should probably use :Ans+1→Z for it to work properly. Also, moving this to "Routines and Source Code".
Last edited by Guest on 30 Jul 2010 05:39:22 am; edited 1 time in total |
|
Back to top |
|
|
Harrierfalcon The Raptor of Calcs
Super Elite (Last Title)
Joined: 25 Oct 2006 Posts: 2535
|
Posted: 01 Jan 2008 04:31:57 pm Post subject: |
|
|
Oh no, this is a For( loop. Z gets incremented when it loops to the beginning.
Last edited by Guest on 30 Jul 2010 05:39:35 am; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 01 Jan 2008 04:34:53 pm Post subject: |
|
|
Oh. Missed that.
It does require a "/" at the end of the string, though.
It might be faster to store the line breaking points in a list (use ΔList( to get the lengths), but only marginally.
Last edited by Guest on 01 Jan 2008 04:36:24 pm; edited 1 time in total |
|
Back to top |
|
|
nitacku
Advanced Member
Joined: 23 Aug 2005 Posts: 408
|
Posted: 01 Jan 2008 08:12:56 pm Post subject: |
|
|
Since there isn't a topic dedicated to xLIB, I guess I'll post this here.
I wrote a short compilation of some cool effects and tricks you
can do with xLIB. I tried to pack in a few of the coding tricks that I know as well.
If anyone is curious as to what is possible in Basic+xLIB, here is a little example program.
Here is an animated screenshot of one of the effects.
[attachment=2068:attachment] |
|
Back to top |
|
|
El Jaque
Member
Joined: 01 May 2008 Posts: 122
|
Posted: 12 May 2008 12:24:11 pm Post subject: |
|
|
nice... do you know of any tutorials for xlib animation? |
|
Back to top |
|
|
nitacku
Advanced Member
Joined: 23 Aug 2005 Posts: 408
|
Posted: 12 May 2008 05:47:35 pm Post subject: |
|
|
There are tutorials that cover the basic techniques and commands, but I don't think there are any tutorials that specifically cover xLIB animation, especially scrolling backgrounds and 4 level grayscale. I sort of pioneered the scrolling background with xLIB, therefore finding a tutorial on it is going to be difficult.
If you want, you can read my post, it covers the basics of the process.
Also, feel free to ask me questions.
I've still got a few xLIB tricks that I haven't shown anyone yet. |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
|
Back to top |
|
|
elfprince13 Retired
Super Elite (Last Title)
Joined: 11 Apr 2005 Posts: 3500
|
|
Back to top |
|
|
El Jaque
Member
Joined: 01 May 2008 Posts: 122
|
Posted: 14 May 2008 01:02:24 am Post subject: |
|
|
thanks for the tutorials,but i am still confused about having moving tiles, like an animated water tile...
thanks! |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
Posted: 14 May 2008 08:46:45 pm Post subject: |
|
|
Well, if you want to animate something, you have two options:
-For actually moving the thing
Xor it on, update (eXclusive OR {set the drawing method to XOR})
Xor it off, don't update
Xor it on a different place, update
Xor it off, don't update
...
-or if you want the illusion of moving
make two forms of the sprites, A and B
then just switch between the two. |
|
Back to top |
|
|
El Jaque
Member
Joined: 01 May 2008 Posts: 122
|
Posted: 15 May 2008 01:41:43 am Post subject: |
|
|
yes, i thought it had somehting to do with switching sprites... that looks like the best option for me! |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 28 May 2008 10:10:25 am Post subject: |
|
|
Weregoose wrote: I've noticed that while using [font="courier new"]seq(, the calculator can still interpret keypresses and store them to getKey. Based off that idea, here's yet another simple password routine—The keys should be typed in the correct sequence before time expires, and the password is "HELLO" in this case:
[font="courier new"]ClrHome
0→dim(L[size=9]1
seq(getKey,X,1,200→L2
Disp "Validating...
For(A,1,dim(L2
L2(A
If Ans
Ans→L1(1+dim(L1
End
If 5=dim(L1
If max(L1≠{55,52,64,64,72
Stop
DelVar L1DelVar L2"Success![/size]
[post="51052"]<{POST_SNAPBACK}>[/post] I dug up this little routine from almost exactly three years ago, with an improvement. As it stands, the difficulty of implementing this routine is that you have to create a huge list to have enough time to input a reasonable password. This can be fixed by replacing seq(getKey,X,1,200 with something that goes a little slower:
seq(getKey+0rand,X,1,100)
seq(getKey+0dim(rand(2)),X,1,100)
...
and so on, until the desired speed is achieved.
This does lose a bit of sensitivity - but this isn't a huge problem, because the routine has a lot of sensitivity to begin with. Even adding +0dim(rand(2)) left the code still sensitive enough that it recorded every keypress of me simply brushing a finger across the keyboard of my TI-83+.
Put this together with the idea that we don't want to store the password itself, but rather a hash of the password (this was brought up in another topic a few days ago). This is easier than extracting the nonzero elements of a list. For example, sum(√(Ans is a decent option that doesn't care about the order of the keypresses. If you want an option that does, take cumSum(Ans)not(not(Ans first - this multiplies the last keypress by 1, the next-to-last by 2, the one before that by 3, and so on.
Sample program:
ClrHome
Disp "INPUT PASSWORD
seq(getKey+0dim(rand(2)),I,1,50
If 106.322402=sum(√(cumSum(Ans)not(not(Ans
Then
"YES!
Else
"NO!
End
Ans
This responds YES! to the password AWESOME, and NO! to any other entry.
Last edited by Guest on 30 Jul 2010 05:42:42 am; edited 1 time in total |
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 28 May 2008 12:23:39 pm Post subject: |
|
|
And this little guy will assist you in making that hash:
{0→L1:0
Repeat Ans=105
If Ans
Ans→L1(1+dim(L1
getKey
End
sum(√(cumSum(L1
DelVar L1Ans
Input your password and then press [ENTER] to get the appropriate number to test against.
Example password: HAL
Hashed result: 29.8632681
By replacing 106.322402 in the sample program in DarkerLine's post with 29.8632681, the password will be reconfigured to HAL.
Last edited by Guest on 30 Jul 2010 05:44:36 am; edited 1 time in total |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 28 May 2008 12:25:59 pm Post subject: |
|
|
Of course, the method I suggested is by no means ideal. It works, but the size of the resulting number gives an idea of the number of letters in the password. Maybe taking only the fractional part would be better. |
|
Back to top |
|
|
jameskanjo
Newbie
Joined: 19 Apr 2008 Posts: 5
|
|
Back to top |
|
|
Weregoose Authentic INTJ
Super Elite (Last Title)
Joined: 25 Nov 2004 Posts: 3976
|
Posted: 05 Jun 2008 02:24:12 am Post subject: |
|
|
jameskanjo wrote: He would have had to jump into a time machine to read that page back then – it wasn't created yet. |
|
Back to top |
|
|
jameskanjo
Newbie
Joined: 19 Apr 2008 Posts: 5
|
Posted: 05 Jun 2008 02:30:36 am Post subject: |
|
|
Weregoose wrote: jameskanjo wrote: He would have had to jump into a time machine to read that page back then – it wasn't created yet.
[post="124255"]<{POST_SNAPBACK}>[/post]
Then it's clear to me that he owns a time machine |
|
Back to top |
|
|
DarkerLine ceci n'est pas une |
Super Elite (Last Title)
Joined: 04 Nov 2003 Posts: 8328
|
Posted: 05 Jun 2008 10:04:43 am Post subject: |
|
|
jameskanjo wrote: Ah, thanks for pointing that out. Page fixed, because that just isn't true. |
|
Back to top |
|
|
luby I want to go back to Philmont!!
Calc Guru
Joined: 23 Apr 2006 Posts: 1477
|
Posted: 30 Jun 2008 09:34:19 am Post subject: |
|
|
Anybody who wants a dirty keypress optimization:
X+(K=26)-(K=24→X
17 bytes
X+⌂list(K={24,26→X
15 bytes
Source: darkstone knight
As for speed... I haven't checked yet. I'd guess the bigger one by a tiny bit.
Last edited by Guest on 30 Jul 2010 05:38:46 am; edited 1 time in total |
|
Back to top |
|
|
|