Last active
February 25, 2016 17:14
-
-
Save QuinnStephens/80ac3e45958a020b21c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
weights = [] | |
weights.append 215 | |
weights.append 275 | |
weights.append 335 | |
weights.append 355 | |
weights.append 420 | |
weights.append 580 | |
limit = 1505 | |
copyArray ^source = { | |
new = [] | |
source.each ^element ^(new.append element) | |
return new | |
} | |
iterate ^total ^order = { | |
weights.each ^weight ^( | |
if (total + weight == limit) ^( | |
order.append weight | |
order.each print | |
println "" | |
) | |
if (total + weight < limit) ^( | |
newOrder = copyArray order | |
newOrder.append(weight) | |
iterate (total + weight) newOrder | |
) | |
) | |
} | |
iterate 0 [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment