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 Your Projects 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. Project Ideas/Start New Projects => Your Projects
Author Message
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 12 Nov 2008 06:01:38 am    Post subject:

I typed the TI-OS program into my calculator exactly as it appears in the book (well, I removed the StorePic 6 and replaced it with Disp so I could see when it had finished by bouncing me back to the home screen). The BBC BASIC version is as direct a translation as I can get. IF statements in BBC BASIC must fit on a single line (rather than having a terminator), though you can do multi-line IF statements using line numbers like this:


Code:
   10 IF N<=1/3 THEN 20 ELSE 40
   20 X=.5*X
   30 Y=.5*Y
   40 :

If you could produce an optimised version of the original program I'd be glad to try again, but if we're trying to get it as fast as possible I could be very unfair and do this:


Code:
   10 DIM SIERPINS 256
   20 P%=SIERPINS
   30 [
   40 OPT 0
   50; Hand-optimised assembly version in here.
   60 RET
   70 ]
   80 CALL SIERPINS

Though I think that would be considered cheating. :P

BBC BASIC uses a faster floating-point number format (a 4-byte base-2 mantissa with a one-byte exponent rather than TI's packed BCD affair) with special optimisations when it notices that you're storing integers in reals. This probably helps it a lot in this example.
Back to top
darkstone knight


Advanced Member


Joined: 07 Sep 2008
Posts: 438

Posted: 12 Nov 2008 06:19:30 am    Post subject:


Code:
:FnOff :ClrDraw
:PlotsOff
:AxesOff
:0→Xmin:1→Xmax
:0→Ymin:1→Ymax
:rand→X:rand→Y
:For(K,1,3000)
:rand
:If ans≤1/3
:Then
:.5X→X
:.5Y→Y
:else
:If 6^-1>abs(ans-.5
:Then
:.5(.5+X)→X
:.5(1+Y)→Y
:else
:.5(1+X)→X
:.5Y→Y
:End
:End
:Pt-On(X,Y)
:End


optimized a bit, is probaly faster
i smell a brain teaser >_>
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 12 Nov 2008 11:24:15 am    Post subject:

Did you time it on a regular 83+?

An optimised BBC BASIC version (removing the redundant conditionals, using ELSE) looks like this:


Code:
   10 REM Sierpinski Triangle.
   20 CLG
   30 X=RND(1):Y=RND(1)
   40 FOR K=1 TO 3000
   50   N=RND(1)
   60   IF N<=1/3 THEN X=X/2:Y=Y/2 ELSEIF N<=2/3 THEN X=(.5+X)/2:Y=(1+Y)/2 ELSE X=(1+X)/2:Y=Y/2
   70   PLOT 69,X*96,64-Y*64
   80 NEXT K

It takes 1 minute and 56 seconds to run (6MHz TI-83+) rather than 2 minutes and 21 seconds.
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 13 Jan 2009 11:40:55 am    Post subject:

The first beta has been released for testing. You can download it here - I look forwards to reading your comments.
Back to top
arjan


Newbie


Joined: 14 Jan 2009
Posts: 3

Posted: 14 Jan 2009 05:03:24 pm    Post subject:

Quote:
The board requires you to be registered and logged in to view this forum.


Why is that? It's the only part on MaxCoderz I can't visit :S
Back to top
benryves


Active Member


Joined: 23 Feb 2006
Posts: 564

Posted: 14 Jan 2009 05:24:20 pm    Post subject:

I assumed (incorrectly) that newly created forums would give guests read-only access. Many apologies, you should be able to view the forum without registering an account.
Back to top
Builderboy2005


Advanced Newbie


Joined: 19 Apr 2009
Posts: 51

Posted: 09 Jun 2009 09:37:47 pm    Post subject:

For some reason, when I use inkey(0) it won't respond to the arrow keys, 2nd, alpha, mode, del, vars, or the top 5 f1-f5 keys. Is this a feature or bug? Am i doing somthing wrong? My code specificaly

:10 Repeat
:20 Print inkey(0)
:30 Until False

Not that complicated...
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, 3
» View previous topic :: View next topic  
Page 3 of 3 » All times are UTC - 5 Hours

 

Advertisement