Em Andamento

Translate small code snippet from Ruby to PHP

I need to translate this small portion of Ruby code to PHP. It must be tested to output equivalent data to the original code. 10$ for thw work



[["David", "Helen"], 0],

[["David", "Vicki"], 1],

[["Helen", "Vicki"], 2],

[["Joseph", "Vicki"], 4],

[["Helen", "Joseph"], 5],

[["David", "Joseph"], 8]


def optimize(pairings, names, pos, posmax, maxweight=nil)

bestpairs = nil

maxweight ||= [url removed, login to view] ** 2 + 1

while pos < posmax

pair, weight1 = pairings[pos]

break unless weight1 * ([url removed, login to view] / 2).floor < maxweight

pos += 1

if names & pair == pair

names1 = names - pair

if [url removed, login to view] < 2

bestpairs = [pair]

bestpairs << names1 unless [url removed, login to view]

return [weight1, bestpairs]

elsif (rv = optimize(pairings, names1, pos, posmax, maxweight - weight1))

maxweight, bestpairs = rv

maxweight += weight1

bestpairs << pair




return bestpairs && [maxweight, bestpairs]



See for details:

[url removed, login to view]

Habilidades: PHP, Ruby on Rails

Veja mais: work translate, return ruby on rails, i need to translate, id to code, code 8 com, code 8, code 30, david data, translate com, ruby on rails 5, 2 translate, translate, the return of david, snippet, rv, ruby, return of david, php ruby, php pos, nil, need to translate, joseph, c# to php, c to php, optimize php code

Acerca do Empregador:
( 0 comentários ) NY, Canada

ID do Projeto: #601807

Concedido a:


Hi I can do it for $10 in 1 day

$30 USD em 1 dia
(1 Comentário)

4 freelancers estão ofertando em média $60 para esse trabalho


Dear Client, I've good experience in both ruby and PHP. Please allow me to translate the code. Thanks. Regards, Adil Shoukat

$100 USD in 3 dias
(0 Comentários)

i'll porting the Ruby code to PHP for < 1 day, but i need to test and integrate to your live site for 1 day (max 2 days)

$60 USD in 2 dias
(0 Comentários)

Hi please See pm Thank you

$50 USD in 2 dias
(0 Comentários)