3 ms·
This is excellent and a great teaching tool. I tried putting something like this together a while back as a Java applet for one of my classes but couldn't get t
by primitivesuave 13y ago
This is excellent and a great teaching tool. I tried putting something like this together a while back as a Java applet for one of my classes but couldn't get the color ordering function to work correctly. Did you use HSB?
- lolo_ 13y agoThanks! That's very kind of you :) Yeah indeed, well, hsl with varying hue and set saturation + luminescence - see https://github.com/lorenzo-stoakes/Rainbow-Sort/blob/master/main.coffee#L19 https://github.com/lorenzo-stoakes/Rainbow-Sort/blob/master/.... I experimented with RGB and it really didn't work, HS(B/L) work a million times better. Took a bit of trial and error!
- primitivesuave 13y agoThanks for the link, you're absolutely right that RGB doesn't work. I modified my original one dimensional sort to make it look like your 2D one, and got this: https://www.dropbox.com/s/0pjmjllmqh1x4ap/Screenshot%202014-02-24%2013.41.48.png https://www.dropbox.com/s/0pjmjllmqh1x4ap/Screenshot%202014-... I'm going to experiment with HSL and see if I can get it to work. Thanks again!