Code center > Darwinbots Program Source Code

Need fastest possible code to compare dna

<< < (3/5) > >>

JRaccoon:
I highlighted the final edit distance in the picture. To convert to a percent difference, I think the most intuitive way would be to run through the algorithm and then do: percentage = edit_distance/size_of_longest_array * 100 percentage = (1 - edit_distance/size_of_longest_array) * 100

So in the kitten:sitting example you'd get:

--- Code: ---percentage = (1 - 3/7)*100 = ~58%
--- End code ---

And in the Saturday:Sunday example you'd get:

--- Code: ---percentage = (1 - 3/8)*100 = ~63%
--- End code ---

Edit: Fixed the example to correspond to your request. Percentage now represents similarity rather than difference.

JRaccoon:

--- Quote from: Botsareus on February 07, 2014, 05:11:36 PM ---<< is not supported in vb

--- End quote ---

This MSDN page told me that it is present in all versions of VB dating back to VS2005. I guess you can't always trust what you read on the internet.  :blink:

Botsareus:
Wow, this is really cool. I will have to play with it later. Thank you for your help.

Peter:
Isn't VB6 older than that.  :P

Botsareus:
1998. But don't forget that as Testlund pointed out, it took us 10 years to reach alpha.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version