Fibonacci funtion

edited October 2016 in Events & Opportunities

Hi i am an amateur programmer with introductory experience. Although i know some programming language, i am simply looking for some one to show me how to produce a fibonacci function starting from the center of the screen. i have ideas i want to manifest and spend my time studying other then programming. i am looking for a partner to produce my code ideas for me.

Comments

  • I have moved the discussion because it has nothing to do with Summer of Code 2016.

    i am simply looking for some one to show me how to produce a fibonacci function starting from the center of the screen.

    Why? What do you hope to get out of this? Certainly not enhance programming skills since you are looking for a partner to do all the programming for you anyway.

    What sort of ideas do you want to study and manifest? Are they commercial? What does the partner get out of this?

  • How do you start the fibonacci from the center? Do you want to start from the center and to spiral out or to go towards the edges symmetrically? Do you want to represent the value of the function as colors or using geometrical figures of different sizes? Do you want it to grow on time or to create the snapshot all at once? It helps if you define your task better from the beginning.

    Kf

  • well i just want to simulate a fibonnacci sequence and see what else i can do with it from there, i have other ideas also. i am just looking for someone who is willing to help me not waste time on learning all the code. i would be willing to do somesort of payment exchange in the event for anything advanced, but for know i would defanately appreciate it. What type of programming do you do?

  • i would like to get the most basic fibonacci spiral out code just so i can see what i can do with it, the ability to spiral out both clockwise and counterclockwise

  • float phi = 1.61803398875;
    
    void setup(){
      size(830, 520);
      background(0);
      stroke(255);
      noFill();
      translate(10,10);
      fs(500);
      noLoop();
    }
    
    void draw(){}
    
    void fs(float x){
      if (x<1) return;
      rect(0,0,x,x);
      arc(x,x,2*x,2*x,PI,PI+HALF_PI);
      rotate(HALF_PI);
      translate(0,-x-x/phi);
      fs(x/phi);
    }
    

    Please send payment via paypal to tfguy44@gmail.com

  • i appreciate this but it isnt what im looking for exactly

  • i was looking for a outward phi spiral simulation/animation to begin with, will you charge me for that?

  • or i guess an inward spiral from a corner

  • i am looking for the function itself in real time

  • I did it once with the help of quark and his QScript library, you have to press space 10 times or so on start up.....

    https://forum.processing.org/two/discussion/13282/qscript-fibonacci#latest

    e.g.

    // test for Fibonacci 
    
    // http : // forum.processing.org/two/discussion/13282/qscript-fibonacci#latest
    // http : // www.openprocessing.org/sketch/135053
    
    import org.qscript.eventsonfire.*;
    import org.qscript.events.*;
    import org.qscript.editor.*;
    import org.qscript.*;
    import org.qscript.operator.*;
    import org.qscript.errors.*;
    
    // ---------------------------------------------
    
    Script script;
    
    int fib;
    int fibprev; 
    
    float x, y;
    
    
    int n1  = 1;
    
    int[] quadrantOrder = new int [] {
      1, 4, 3, 2
    };
    
    final float quarterCircle = 0; // 1.0 * TWO_PI/4.0; 
    
    String[] algor = {
      "IF(nbrTerms < 1)", 
      "  END(1)", 
      "ENDIF", 
      "n1 = 1; n2 = 1 ; count = 2;", 
      "WHILE(nbrTerms > 2)", 
      "  next = n1 + n2", 
      "  count = count + 1", 
      "  n1 = n2; n2 = next", 
      "  nbrTerms = nbrTerms - 1", 
      "WEND", 
      "END(next)", 
    
    };
    
    /// -------------------------------------------
    
    public void setup() {
      size(1200, 750);
    
      x = width  * 0.5;
      y = height * 0.6;
    
      background(0);
    
      // Create the script to evaluate
      script = new Script(algor);
    
      fib = getFibTerm(n1);
      fibprev = fib;
    
      frameRate(222);
    }
    
    void draw() {
    
      // text box: 
      fill(0);
      rect(0, 0, 299, 24);
      fill(255); 
      text("Press any key often. Iteration is "
        + n1
        + " ("
        + fib
        + ").", 14, 14);
      // end of text box
    } // func 
    
    // ----------------------------------------
    
    void keyPressed() {
      n1++;
      if (n1<22) {
    
        fibprev = fib;
        fib = getFibTerm(n1);
    
        drawArc(quadrantOrder[(n1)%4]);
        println("Iteration is "
          + n1
          + " (with Fibonacci value "
          + fib
          + ").");
      }
    }
    
    void drawArc(int quadrant) {
    
      //draws an arc in specific quadrant
      // with current Fibonacci value 
    
      final int q1 = 2; 
    
    
      fill((int)(fib%140) + 100);
      noStroke();
    
      int textSize = (int)(fib * 0.3);
      int textValue = (int)fib /10;
    
      println ("quadrant "+quadrant); 
    
      switch(quadrant) {
      case 1:
        y += (fib - fibprev)/q1;
        arc(x, y, fib, fib, 
          PI+HALF_PI+quarterCircle, TWO_PI+quarterCircle, 
          PIE);
        fill(255);
        // text(textValue, x+(fib*0.05), y-(fib*0.07));   
        break;
      case 2:
        x += (fib - fibprev)/q1;
        arc(x, y, fib, fib, 
          PI+quarterCircle, PI+HALF_PI+quarterCircle, 
          PIE);
        fill(255);
        // text(textValue, x-((textSize*0.7)*(digits(textValue))), y-(fib*0.05));
        break;
      case 3:
        y -= (fib - fibprev)/q1;
        arc(x, y, fib, fib, 
          PI-HALF_PI+quarterCircle, PI+quarterCircle, PIE); 
        fill(255);
        // text(textValue, x-((textSize*0.7)*(digits(textValue))), y+((textSize*0.9)));
        break;
      case 4:
        x -= (fib - fibprev)/q1;
        arc(x, y, fib, fib, 
          0+quarterCircle, PI-HALF_PI+quarterCircle, PIE);
        fill(255);
        // text(textValue, x+(fib*0.05), y+((textSize)));
        break;
      } // switch 
      //
    } // func 
    
    public int getFibTerm(int n) {
    
      // contact to QScript Fibonacci script 
    
      int fibn = 0;
      script.storeVariable("nbrTerms", n);
      Result r1 = Solver.evaluate(script);
      if (r1.isValid()) {
        fibn = r1.answer.toInteger();
      }
      return fibn;
    } // func 
    
    //int digits (int value) {
    //  if (value < 10) return 1;
    //  else if (value < 100) return 2;
    //  else if (value < 1000) return 3;
    //  else return 4;
    //} // func  
    
    // end of sketch
    
  • interesting, i will take a look at this tommorow and get back to you then.

  • the link holds different versions

    probably the QScript stuff could be replaced quite easily

  • i tried to run it in processing 3 and it says the package org.script does not exist

  • ??

    Did you install the lib?

  • hey sorry no ive been busy with school, what do u mean install the lib?

  • The QScript library

Sign In or Register to comment.