Fibonacci applied to the Score system

0

Good!

I am in a situation where I must apply the Fibonacci assignment in a scoring system.

The exercise sounds simple, but I'm not finding the best way to do it, so I decided to buy opinions

I have something done so far. But with one of the problems that I find, is to be able to take account of the X ships destroyed.

Here I leave what I have done so far.

 public  int fib(int n)
{
       if (n < 2)
       {
           return n;
        }
       else
        {
            return fib(n - 1) + fib(n - 2);
        }
        setScoreToPlayer.Score(n);
    }
    
asked by Pablo Palma 05.02.2016 в 23:01
source

1 answer

2

You could apply the Fibonacci formula simply and the value you multiply by 10

Formula fibonacci

The Fibonacci Numbers

There are several types of implementations, some use recursion

It would be something like

int nave = 2;
int puntos = nave + (Fibonacci(nave) * 10);
    
answered by 06.02.2016 в 01:14