http://timaster.googlepages.com/GameofLife.exe
http://timaster.googlepages.com/GoLpref.ini
Put these two in the same folder.
Open the .exe, then open the .ini.
The .exe will output a pretty pattern!
Now, an explanation of how this works.
Every time you hit space, the game pauses.
Every time you hit enter, the game reads the .ini. So what you may do is change the pattern on the screen as it goes.
Now here’s how the game works:
Each row of pixels is a bunch of numbers from 5 to 0. The game logic reads everything that isn’t a 0 as a 1. The higher numbers exist only for pretty colors.
So, in a 1/0 environment, we start with (for example):
010010100
There are certain rules that define how the next line is printed.
111 → 1#1
101 → 1#1
110 → 1#0
100 → 1#0
010 → 0#0
000 → 0#0
This is the setup for all the rules.
The game looks at every combination of 3 numbers, and depending on the rules set, it writes the middle number of the next line. The game, however, does not differentiate between 100 and 001 (it doesn’t care what side the 1 is on).
If the rule for 101 is is 1, then 101 results in a 1 printed on the next line.
Let’s set the default rules, and see what happens to the previous line.
111 → 0
101 → 0
110 → 0
100 → 1
010 → 0
000 → 0
Now, 010010100 obviously has edges, but we’ll treat it as a circle. The leftmost 0 has a 0 to the left of it.
According to this, 010010100 becomes 101100010
The first numbers is in a 001, so it writes a 1. The next is 010, so it writes a 0. Then 100 is a 1, etc.
If that makes sense, you can start messing with the game!
Here’s a list of all the possible values for each field, what they mean, and when to use them:
x, y: These are the screen dimensions, but these (unlike everything else in the .ini) are only read when you start the game. If you want to change the resolution, close the game before you change these values.
fullscreen: Changes whether the game is fullscreen or not. I recommend setting x and y to your desktop resolution values if you do this in fullscreen.
all: Defines the starting values of all the squares. Preset values are
all0/all1 - The value of every pixel in the initial row is 0 or 1, for all0 and all1 respectively.
rand - Each value is defined anywhere from 0 to randWeight - 1, rounded up. More info under randWeight. Using this option while the program is running will oftentimes result in a single wacky-looking row of pixels. Yes, this is supposed to happen, don’t worry.
alt - The first pixel is 0, the next is 1, the next is 0, etc.
none - Don’t change anything. Useful if you want to modify the rules in the middle of a pattern without resetting the pattern. Do NOT leave it as none when you start the program, though, it will crash. Always start with one of the other options.
randWeight: Changes the chance that the initial row of a randomly initiated pattern is colored. A randWeight of 1 to 0 will result in all initial pixels being 0s. If you want only a few scattered pixels to be 1s, make randWeight 1.05 or so. If you want only a few pixels to be 0s, make randWeight really high. A randWeight of 2 will result in approximately 50/50 distrubution of 0s and 1s in the initial row.
howManySingle: The next few lines are allocated for if you want to set specific pixels. howManySingle tells the game how many specific pixels you want to set.
resetStatic: If you have set static pixels earlier, this will clear them all, and let them be overwritten.
setSingleI#: The location of the pixel you want to set.
setSingleVal#: The value of the pixel you want to set.
setSingleStatic#: Whether or not the pixel you have set is static. If it is static, it will NOT CHANGE until you reset all static pixels, or write a non-static single pixel to the same location later.
rule###: For rule111, setting a value of 1 will mean 111 → 1 as described above. Remember, rule110=0 means that 110 → 0 AND 011 → 0. This is also where you set the colors. Anything that isn’t a 0 is a 1, in terms of rules, so write in any number from 1 to 5 as a 1 to color things a bit.
color#: Every value is output as a color. The default colors are black, white, red, green, blue, yellow, in that order. Change these to whatever you like, they do not affect the actual game logic in any way at all, but sometimes yield prettier results.
Use the formula R*(256^0)+G*(256^1)+B*(256^2) where R, G, and B are numbers from 0 to 255 to get colors.
PLEASE NOTE:
You must save the .ini each time you change something, before you go back to the game screen and hit enter. If you hit enter, and nothing happens, chances are you forgot to save.
Other things to keep in mind are that howManySingle should be 0 whenever you’re planning on not changing anything. Reset its value to 0 every time you use it, so you don’t forget. Same goes for resetStatic. It’s also a good idea to reset all to none every time, so you don’t accidentally reset the whole pattern.
Also, the previous post with 1s and 0s is a list of all of the good 1/0 patterns. Everything else stabilizes or loops within a few pixels.
Read it as:
000100
is
111 → 0
101 → 0
110 → 0
100 → 1
010 → 0
000 → 0
And stuff.
If you don’t get anything, please ask me to explain. I suck at explanation <3