Mutant bouncing baby bits
It’s Saturday night, and I’ve got some coding to do. I’d really like to get a figure to self-reproduce tonight, but I don’t know if I can pull it off or not. Last time, in the middle of creating the realm, I realized that there was and is some stuff that needs doing with the ports and methods I’ve already created. The figures could use some feedback on how a given operation has worked.
It’s really easy to setup. I can set b to zero or less for one result, one or higher for the other. It actually doesn’t matter, since this happens from a set command. The value I give to b will only be used to choose one or the other branch, and won’t be saved. I’ve already got the test code in place, and moved b to a global scope for the Figure class. I’m thinking of moving the other internal values for what is, at the moment, the run method to the global scope as well. Right now, it’s all about the set method, but I have no idea what future implementations or extensions might need or want to do. I think it’s best to go for maximum flexibility, especially for the node system which I’ve yet to talk about, let alone implement.
Ports are used for special commands, Nodes are used to add new ports and abilities. The goal is to create a tunable emergent system. I don’t just want digital life; I want digital life that can solve problems and do tasks for me. It’s artificial life that is also artificial intelligence.
Alrighty then, here we go.
For innerPaste, you get a -1 if the buffer was empty, a 1 otherwise.
For innerCut, you only get a -1, if the inner head is at the end of the figure, or the memory array is empty—when reading gives you an empty buffer.
Note to self, the next one to add this to is innerWrite.
I just realized that I can do the rest of these methods later. All I needed was to make sure that changing the value of b will cause the figure to branch, depending upon the result of the operation. I can also start using the ports class in switch statements and the like. That way, if I decide to change what port is called with which number, I only need to change one place.
That joins the documentation, and a growing pile of clean up chores. Which I’ll do after one of my creatures manages to self-replicate. Which I can do with a couple more methods and a couple more ports.
No problem.
Apparently, I can’t use constants from another class in a switch statement. How sad. Guess if I want to change a port’s number, it will have to be the hard way.
Screw it. I wanted to have the ports in a certain order, but I don’t think it really matters. I’ve always got the node system if I want to do something like change the probabilities.
11:48PM: saw the first baby figure. It wasn’t the first one, but the first one I could see. So far, its memory is empty, and so it isn’t a copy, or mutated copy, of anything.
I was hoping to get this done before midnight, but it’s not going to happen. Really damn close though so I might not bother making a new entry for it.
HA!
11:52PM: first self-replicating program self-replicated.
The size of the realm=2
Getting find empty.
Setting find empty.
Searching for a new home for baby.
Going down.
Baby’s new home at 1.
b=1. Moving pointer to address 3.
b=-12. Moving pointer to address 6.
Getting outer write.
setting outer read/write
Should get your stuff out there.
Writing out 12.
A child is born!
Writing to figure 1.
b=12. Moving pointer to address 9.
b=0. Moving pointer to address -1.
Figure 0 memory={-4, -17, 3, -9, -13, 6, -8, -18, -1, -1, -1, -1}
Figure 1 memory={-4, -17, 3, -9, -13, 6, -8, -18, -1, -1, -1, -1}
I took a short break to share the moment with the internet. To make the first slightly mutated baby, all I have to do is add one more command to the seed figure.
Old version:
{P.ONE, P.FIND_EMPTY, 3, P.SIZE, P.INNER_HEAD, 6, P.N_SIZE, P.OUTER_HEAD, -1, -1, -1, -1}
Making mutated children:
{P.ONE, P.FIND_EMPTY, 3, P.SIZE, P.INNER_HEAD, 6, P.N_SIZE, P.OUTER_HEAD, 9, P.N_THREE, P.OUTER_HEAD, -1, -1, -1, -1}
12:14AM first mutated baby.
The size of the realm=2
Getting find empty.
Setting find empty.
Searching for a new home for baby.
Going down.
Baby’s new home at 1.
b=1. Moving pointer to address 3.
b=-15. Moving pointer to address 6.
Getting outer write.
setting outer read/write
Should get your stuff out there.
Writing out 15.
A child is born!
Writing to figure 1.
b=15. Moving pointer to address 9.
Getting outer write.
setting outer read/write
Should get your stuff out there.
Writing out 3.
No children?
Writing to figure 1.
b=3. Moving pointer to address 12.
b=0. Moving pointer to address -1.
Figure 0 memory={-4, -17, 3, -9, -13, 6, -8, -18, 9, -3, -18, -1, -1, -1, -1}
Figure 1 memory={-4, -17, 3, -9, -13, 6, -8, -18, 9, -3, -18, -1, -1, -1, -1, -7
, 12, 16}
Where it says, “No children,” is a message to let me know the figure that is being written to is already there. This time, it happens to be the newborn, one command old copy that was just made.
I’m a bit passed midnight now. There is much more testing and the like to be done, but I got where I wanted to get, and that’s enough for now.