Feb. 4th, 2005

pmb: (Default)
[livejournal.com profile] istgut had an interesting idea to create fighting sorts that run in the same memory space and to see if any patterns develop. It caught my imagination, and now, after dusting off my Java knowledge, here it is, 6 hours later! Now I feel pleasantly like some sort of coding monster (although the code is hackish and ugly) and I feel like I haven't lost my Java chops depite not using them for a few years.

I wrote two applets, and both can be found running at http://soy.dyndns.org/~peter/projects/fun/mep

The grayscale version is initially interesting, but it quickly becomes obvious what is happening. There are 4 different "fighting bubblesorts" that are all manipulating this one space. One is sorting high to low from left to right, one is right to left, one is top to bottom, and the last is bottom to top. If The threads always stayed synchronized, then we would get a neat checkerboard pattern. But threads don't stay in sync, so some patterns develop.

More interesting is the second one which has 12 fighting sorts, where we have up-down, down-up, left-right, and right-left for each color channel (red, green, and blue). This one is complex enough that the patterns are kind of engrossing.

I had a lot of fun making this, I hope it's a little fun to watch. If you don't like applets, the code can be downloaded and run as an application with no changes, due to a bizarre hack. Thanks for the cool idea Mark!

Profile

pmb: (Default)
pmb

October 2009

S M T W T F S
    1 23
45678910
11121314151617
18192021222324
25262728293031

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Aug. 24th, 2025 07:41 am
Powered by Dreamwidth Studios