Welcome, Guest. Please login or register.

Author Topic: Programming question! :)  (Read 3314 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline bloodlineTopic starter

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Programming question! :)
« Reply #14 from previous page: April 17, 2012, 06:31:02 PM »
Quote from: Leffmann;689077
Actually it's adjusted to do exactly what you want, and can even be optimized further.
Appologies! I only quickly looked over it :) If I had a larger array I would certainly investigate this method... I'm intrigued to see how a tiny microcontroller would cope with this kind of search!

Offline bloodlineTopic starter

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: Programming question! :)
« Reply #15 on: April 19, 2012, 05:43:26 AM »
Quote from: Jose;689458
Another idea that I don't know if it would work. If the values of the curve can be guessed by using a mathematical function you could revert the function and get the x value. Then calculate the rank by dividing by rank x size (of course that assumes rank x size is constant between ranks, as opposed to rank y size which isn't (like you say it's a curve)).
On an 8bit microcontroller, you really want to avoid multiplication and division (unless you can use a power of 2... ie left or right shifts). I really did try to do this mathematically first, but realised that I simply don't have the CPU time :)