so i am writing a genetic algorithm ai and part of it needs to be able to run a function a lot, so what i am trying to emphasize is this function needs to be extremely efficient. And I don’t think this yandere dev code will help. I just don’t understand how else I could. I tried finding some formula online for converting binary to text but all I found was this video
local function computeFitness(chromosome)
local chromosomeArray = string.split(chromosome, "")
local bitValue = 0
for i= #chromosomeArray, 1, -1 do --Iterate from the end of the byte
if i == 1 then
bitValue += 64 * chromosomeArray[i]
elseif i == 2 then
bitValue += 32 * chromosomeArray[i]
elseif i == 3 then
bitValue += 16 * chromosomeArray[i]
elseif i == 4 then
bitValue += 8 * chromosomeArray[i]
elseif i == 5 then
bitValue += 4 * chromosomeArray[i]
elseif i == 6 then
bitValue += 2 * chromosomeArray[i]
elseif i == 7 then
bitValue += 1 * chromosomeArray[i]
end
end
local text = utf8.char(bitValue)
return text
end