Don't have an account? Register now to chat, post, use our tools, and much more.
Latest Headlines
Online Users
There are 85 users online: 1 member, 56 guests and 28 bots. Members: PinSeventy. Bots: Spinn3r (1), MSN/Bing (1), Magpie Crawler (3), VoilaBot (5), Googlebot (16), MSN/Bing (2).
RSS & Social Media
SAX
You must log in to view the SAX chat widget
|
| Author |
Message |
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 03 Nov 2011 06:41:28 pm Post subject: Using Logic Problems Instead Of Code |
|
|
Weregoose Is helping me learn to use boolean algebra instead of code in certain situations. If you would like to learn as well feel free to join in. _________________

 |
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2418 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 03 Nov 2011 06:51:26 pm Post subject: |
|
|
Well by "Logic Problems" instead of "Code", I think you mean to say "More densely-packed logic in code instead of using more structured, less efficient code". Both entities are code
But yes, densely-packed logic in code is really fun to work with; in many cases, if you drop conventional structure, you can use a lot less variables and lines of code and potentially make your code faster and more streamlined; however, the consequence is easy comprehensibility and readability. _________________ -Ashbad |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 03 Nov 2011 06:52:10 pm Post subject: |
|
|
That is why I am learning it. _________________

 |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
|
| Back to top |
|
|
souvik1997

Guru-in-Training

Joined: 19 Apr 2010 Posts: 2870
|
Posted: 03 Nov 2011 07:06:24 pm Post subject: |
|
|
You'd probably want to wrap that in some kind of loop, so you can actually move it around. _________________ CALCnet Tournament-38%
deviantArt
 |
|
| Back to top |
|
|
lafferjm

Calculator Deity

Joined: 14 Mar 2006 Posts: 1529 Location: at my house
|
Posted: 03 Nov 2011 07:33:13 pm Post subject: |
|
|
It is in a loop. _________________
 |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 03 Nov 2011 07:33:50 pm Post subject: |
|
|
It wasn't in a loop. I put it in a loop as that was posted. _________________

 |
|
| Back to top |
|
|
tifreak8x

Guru

Joined: 16 Mar 2005 Posts: 9071 Location: Sol System
|
Posted: 03 Nov 2011 07:34:01 pm Post subject: |
|
|
Aes is simply updating his post instead of creating new ones after replies are being made, hence the confusion. _________________ Projects: AOD Series: 70% | FFME: 80% | Pokemon: 18% | RPGSK: 60% | Star Trek: 70% | Star Trek 83+: 40% | TI-City: 5%
Look here for Assembly Resources. |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 04 Nov 2011 02:47:16 pm Post subject: |
|
|
Ok update. I was working on writing a program to display the Fibonacci number increasing till the calculator explodes.
Here is my code
Code:
:ClrHome
:ClrDraw
DelVar
While 1
Text(1,1,"LOCAT. NUM, FIBB NUM.
Text(7,9,N,"
Text(7,43,(N-(N>1)+N(N>2)-2((N>2)
Pause
:N+1→N
End
//I know abit redundant But I am grasping at straws. It works.
//The number out puts are as follows
//0,0::1,1::2,1::3,3::4,5
//Then it stops working here from here::5,7::6,9::7,11 Etc wrong numbers.
//
I am confused while it works half way then stops working.
For some reason the numbers only add 2 each time enter is pressed.. Which stinks. And Makes my head hurt. _________________

 |
|
| Back to top |
|
|
Ashbad

... I think redheaded girls are kind of cool

Joined: 01 Dec 2010 Posts: 2418 Location: Stomp Stomp Stomp, The Idiot Convention
|
Posted: 04 Nov 2011 07:30:12 pm Post subject: |
|
|
Just as a hint to what might be going on, you only increment N by one in the loop -- from what I can see on Wikipedia about the Fibonacci Sequence, it should be incrementing by something less constant -- I'll leave the rest of the figuring out where and how to fix this to you  _________________ -Ashbad |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55773 Location: Earth, Sol, Milky Way
|
Posted: 04 Nov 2011 08:44:22 pm Post subject: |
|
|
I think you still don't understand the sequence. I'll say it again:
Each Fibonacci number is the sum of the two previous ones. The first two are 0 and 1
So 0, 1, [0+1]=2, [1+2]=3, [2+3]=5, [3+5]=8, [5+8]=13, ... _________________
 |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 04 Nov 2011 08:45:44 pm Post subject: |
|
|
I understand that. That is why N-1 and N-2 are in there just as conditionals. would using abs be better for that? _________________

 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55773 Location: Earth, Sol, Milky Way
|
Posted: 04 Nov 2011 08:48:06 pm Post subject: |
|
|
| Aes_Sedia5 wrote: | | I understand that. That is why N-1 and N-2 are in there just as conditionals. would using abs be better for that? | But it's not just N-2, it's FN-2, which is the second previous FN. You have to keep running track of the two previous Fibonacci numbers in two variables. _________________
 |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 04 Nov 2011 08:49:17 pm Post subject: |
|
|
OH it is the 2 previous Fibonacci numbers. I thought is was Just N-2 not N-2 on the fibonacci sequence. No wonder. thanks KErmM _________________

 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55773 Location: Earth, Sol, Milky Way
|
Posted: 04 Nov 2011 08:50:03 pm Post subject: |
|
|
| Aes_Sedia5 wrote: | | OH it is the 2 previous Fibonacci numbers. I thought is was Just N-2 not N-2 on the fibonacci sequence. No wonder. thanks KErmM | Excellent, glad we made that mental breakthrough. Now go see if you can code it up. _________________
 |
|
| Back to top |
|
|
Weregoose

Cemetech Expert

Joined: 23 Oct 2009 Posts: 464
|
Posted: 04 Nov 2011 08:50:48 pm Post subject: |
|
|
You've gathered that the measure of increase towards the next number in the sequence as preordained by the present number would require an infinite chain of testing. Maybe this will solidify one approach:
Leonardo and Pisano are sitting at a table across from each other; between them, a bottomless bowl of jelly beans. Leonardo takes one and, knowing of his friend's jealousy, gently sets it down on the table. (Leonardo has 0+1=1, Pisano has 0.)
Pisano, who is more than a little proud, tells his companion, "I'll take as many as you have in your pile." With this, he swipes a jelly bean from the bowl and places it next to himself. (Leonardo has 1, Pisano has 0+1=1.)
Leonardo, taking delight in his alter ego's game, decides to reciprocate his behavior. "I'll take as many as you have in your pile," he says with a smile as he grabs yet another jelly bean from the bowl. (Leonardo has 1+1=2, Pisano has 1.)
Pisano, never to be outdone, makes his move without hesitation. "I'll take as many as you have in your pile!" he bellows as he reaches for two jelly beans and adds them to his first. (L:2, P:1+2=3)
Leonardo, unfazed as ever: "I'll take as many as you have in your pile." He looks at the three jelly beans from across the table, picks out as many from the bowl, and stashes them with his other two. (L:2+3=5, P:3)
Pisano, in full rivalry now, repeats his original utterance as he transfers five jelly beans from the bowl to his end of the table. (L:5, P:3+5=8)
Leonardo nonchalantly does the same, incorporating a heap as numerous as his opposition into his former pile of five. (L:5+8=13, P:8)
Pisano furiously tallies Leonardo's thirteen jelly beans and gathers a matching number from the bowl. (L:13, P:8+13=21)
Leonardo readily accumulates an additional twenty-one jelly beans from the center and slides them into his pile. (L:13+21=34, P:21)
Pisano takes 34. (L:34, P:21+34=55)
Leonardo acquires 55. (L:34+55=89, P:55)
And so on and so forth.
"Leonardo Pisano" is actually the full name of Fibonacci – you might have heard of him through these numbers. There is an endless supply of algorithms to create them, but this way is probably more familiar to a programmer. Now, go write some code! _________________ Common Errors in English · How To Ask Questions The Smart Way |
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
Posted: 04 Nov 2011 09:48:45 pm Post subject: |
|
|
Code:
:ClrHome
:ClrDraw
:DelVar NDelVar ADelvar BDelvar C
:Text(1,1,"LOCAT. NUM, FIBB NUM.
:While 1
:While N=0
:Text(7,9,N,"
:Text(7,43,"0
:Pause
:1→N
:End
:While (N<=2 and N>0)
:Text(7,9,N,"
:Text(7,43,"0
:Pause
:1→A
:1→B
:1+N→N
:End
:A+B→C
:Text(7,9,N,"
:Text(7,43,C,"
:N+1→N
:Pause
:B+C→A
:Text(7,9,N,"
:Text(7,43,A,"
:N+1→N
:Pause
:C+A→B
:Text(7,9,N,"
:Text(7,43,B,"
:N+1→N
:Pause
:End
Edit:
Condensed to this
Code:
:ClrHome
:ClrDraw
:DelVar NDelVar ADelVar B
1→A
:While 1
A+B→A
Disp A
Pause
B+A→B
Disp B
Pause
End
_________________

 |
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55773 Location: Earth, Sol, Milky Way
|
|
| Back to top |
|
|
Aes_Sedia5

Minor Calculator Deity

Joined: 01 Sep 2011 Posts: 1002 Location: Where Nightmares end and Dreams begin
|
|
| Back to top |
|
|
KermMartian

Site Admin

Joined: 14 Mar 2005 Posts: 55773 Location: Earth, Sol, Milky Way
|
Posted: 06 Nov 2011 09:09:46 am Post subject: |
|
|
Did you look at the two programs I posted for you related to your Fibonacci challenge and think about and understand how they work? _________________
 |
|
| Back to top |
|
|
|
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
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
© Copyright 2000-2013 Cemetech & Kerm Martian :: Page Execution Time: 0.042970 seconds.
|