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).
Ten hours of work have paid off
Moderator: S2k Moderators
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
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.
I think I'm done with this version. It's been fun.
0 likes
Who is online
Users browsing this forum: No registered users and 15 guests