Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
United-TI Archives -> TI-Basic
 
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Author Message
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 15 Nov 2009 12:51:43 am    Post subject:

fpart()
takes the fraction part of a number
ie: fpart(6.25)=.25
Ipart does exactly the oppisite returning 6

but you will have to wait for Ed to explain the code its over my head


Last edited by Guest on 15 Nov 2009 12:53:05 am; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 12:54:27 am    Post subject:

yeah i kinda know what fpart() does but i just cannot contemplate what it does here Razz

Last edited by Guest on 15 Nov 2009 12:56:45 am; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 15 Nov 2009 12:56:55 am    Post subject:

He lost me with that code you could try


Code:
For(A,2,16
Output(1,A,"A
Output(2,A-1,"B
Rand(6
Clrhome
end


Last edited by Guest on 15 Nov 2009 01:12:05 am; edited 1 time in total
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 15 Nov 2009 12:57:40 am    Post subject:

First of all, try the program with the following two lines removed:
:If not(fPart(I/10) and fPart(I/15))
:ClrHome

As you can see, the point of the two lines above is to clear the screen before either letter moves.

But try the program with just :ClrHome, and not the If conditional. The problem with this is the letters are flickery, and the reason for this is when the program runs, the letters are cleared and redrawn 10 or 15 times before moving. Thus, we want to clear the screen only when the counter I is a multiple of 10 or 15.

Take a look at the commands fPart( and not( on TI-Basic Developer, and try and figure out how the :If conditional runs only when I is a multiple of 10 or 15.
http://tibasicdev.wikidot.com/fpart
http://tibasicdev.wikidot.com/not

By the way, in the future, when you encounter a command that you don't know of, I recommend looking it up on the TI-Basic Developer wiki before asking others in a forum. The wiki is a great resource, and a lot of work has been put into it. It would be a shame to put that work to waste by asking questions that perhaps the wiki could have answered for you.


Last edited by Guest on 01 Jul 2010 10:31:30 am; edited 1 time in total
Back to top
dxfan101010


Member


Joined: 31 Mar 2008
Posts: 194

Posted: 15 Nov 2009 01:02:58 am    Post subject:

Your code gives me a domain error at theline that ouptuts A


Code:
For(A,2,16
Output(1,A,"A
Output(2,A,"B
Rand(6
Clrhome
end

does the same thing unless i misss typed your code


Last edited by Guest on 15 Nov 2009 01:12:45 am; edited 1 time in total
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 01:15:11 am    Post subject:

okay im pretty sure I get why the not() and fPart() work together, but why this?

For(I,16,240) ?

why these values?
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 15 Nov 2009 01:27:19 am    Post subject:

Try changing 240 to 120. Or change 15 to 100.
Back to top
dudedangrich


Newbie


Joined: 14 Nov 2009
Posts: 13

Posted: 15 Nov 2009 01:31:19 am    Post subject:

okay when you change 15 barely (by about 5 or so, but add 5, don't subtract) it does almost nothing. When set it as 100, It starts about halfway through the screen. When you change 240 to 120, it stops about halfway through the screen.

I can only guess that these are the pixel numbers for the screen?
Back to top
Ed H


Member


Joined: 30 Nov 2007
Posts: 138

Posted: 15 Nov 2009 01:59:27 am    Post subject:

They are the starting and ending values of I in the For loop.
Back to top
kinkoa


Member


Joined: 28 Jul 2009
Posts: 103

Posted: 18 Nov 2009 09:40:50 am    Post subject:

ive used most of these in making a slot machine
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    » Goto page Previous  1, 2
» View previous topic :: View next topic  
Page 2 of 2 » All times are GMT - 5 Hours

 

Advertisement