Ten hours of work have paid off

Chat about anything and everything... (well almost anything) Whether it be the front porch or the pot belly stove or news of interest or a topic of your liking, this is the place to post it.

Moderator: S2k Moderators

Message
Author
WidreMann

Ten hours of work have paid off

#1 Postby WidreMann » Mon Jun 09, 2003 2:19 pm

That's right. After wrangling with Visual C++ for ten hours over the course of two days, I have finally produced a program that works (at least on my computer). Much of the work was spent trying to figure out how to make colored buttons and then setting up the interface. The logical part took at most about three quarters of an hour.

What does it do? It's a type of simulation. You start with a line of cells. The cells can be black or white. Then you have a set of rules that determine how the cells will evolve and that forms a new line. Then you repeat down the screen. The result is an interesting looking picture (only some of the time, though, other times it's just boring or nothing at all). The program also supports three colors (white, black and gray), which makes for 7.6 billion possible rules instead of the 256 you get with 2 colors.

I have a few screenshots on my WebShots account: http://community.webshots.com/album/76306642uvHyHj

The actual program you can download from my website (assuming you guys don't overuse the bandwidth and it gets shut down) here: http://www.geocities.com/widremann/CellAuto.zip. You have to right click and select "Save Target As..." and then save it. Open the Zip file with WinZip or other like utility and run the program (CellAuto.exe).

It starts out with a default rule already evolved. To change the rules, you click the "R" on the toolbar (ignore the crap in the menus, that's MFC's doing). This brings up a dialog box with a bunch of little colored boxes and a few check-boxes and some text that describes what you are supposed to do. It turns out that the text in that box can only be 255 characters long, so it got truncated (interestingly enough at "you know?" - I don't know where the question mark came from). Anyways, each rule is a set of four boxes arranged in a sort of t-shape. The top three indicate the conditions on the line above, with the first box being the cell to the top-left, the second box the cell to the top-center and the third one for the cell to the top-right. The box on the bottom is where you actually set the rule. If you set it to, for example, black, that means whenever the cells in the line are configured according to the first three boxes, the cell below them will be black. If you deselect Two Color at the bottom, you can get more rules and have three colors instead.

The boxes Single Color, Fill Color and Random are for initial conditions. If you don't have Random set, then Fill color sets the color of every cell in the first line. If you set single color to something other than the fill color, then there will be a single cell in the middle of the first line that is of that color. If random is set, then the first line will be filled with random cells.

If you find any bugs (and there are likely many), do tell me.

I am planning to upgrade the program to allow different resolutions (right now it is one pixel per cell) and also to allow so-called totalistic rules. For these, the color of the cell on the new line is the average of the colors of the three cells above it (that is, above-left, above-center and above-right).
0 likes   

WidreMann

#2 Postby WidreMann » Mon Jun 09, 2003 2:29 pm

Short of having to edit my post for the fourth time, I will simply post it here:

To change the colors in the boxes, just click the box and it will cycle through the available colors.
0 likes   

WidreMann

#3 Postby WidreMann » Mon Jun 09, 2003 2:32 pm

And one more thing:

To redraw the evolution, press the "D" on the toolbar. You have to do this whenever you change the rules. The evolution automatically redraws when you resize the window or maximize/minimize it. In future versions, I will make it make sense.
0 likes   

User avatar
breeze
Category 5
Category 5
Posts: 9110
Age: 62
Joined: Sat Feb 08, 2003 4:55 pm
Location: Lawrenceburg, TN

#4 Postby breeze » Mon Jun 09, 2003 7:59 pm

That's cool, Widreman! I also like fooling around with those
psychedelic type virtual reality programs that change shapes
when you move the mouse! :D
0 likes   

WidreMann

#5 Postby WidreMann » Mon Jun 09, 2003 8:13 pm

This is addicting. I've been working on it some more this evening. Many of the changes aren't apparent to the user (I cleaned up the code for the rule selector and made it so the evolution continues off the screen to keep wrap-around effects from coming into to play). I also added the ability to have the rule selector generate a numeric code and also be able to use a numeric code to create a rule (for easy recording of interesting rules). Right now, though, that last part isn't working so well.
0 likes   

WidreMann

#6 Postby WidreMann » Mon Jun 09, 2003 9:51 pm

Source code for those who care or dare: http://www.geocities.com/widremann/CellAutoSrc.zip (right click to save target as...)

I think I'm done with this version. It's been fun.
0 likes   


Return to “Off Topic”

Who is online

Users browsing this forum: No registered users and 15 guests