Is it a good idea to simulate a baby's cognition in Ruby without any planning whatsoever?
Tags: ruby
Published: 2019-10-30 00:04:19

No, but I'm trying to anyway, so I've documented my rapidly expanding scope so far. 

I started *way* ahead from the start and had to backtrack to lay down my framework. I made a class called BabyHead and started listing down various properties I wanted it to have. I gave it health and a hunger that would motivate it's actions later, long and short term memory, an emotion variable that I didn't have any ideas for at the time, and then I was really reaching with irrelevant things given the emptiness of the project like a tolerance hash representing a person's ability to cope with various stressors like hunger.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/s82gohu66pwaawzjcn1c.png)

I then saw the need to make an object representing the environment this baby lives in and put together a loose interpretation of an immediate  local area, giving it just a color and things array. Then it made sense to create the MaterialCog class to make objects of any type and material, like a "wood" "tree" or a "stone" "rock". I still am torn between going more in depth with outside objects and focusing entirely on forming an independently thinking entity in a very poorly defined space.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/4tic0rsn7ohgtx84us1p.png)
![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/bmwhomb8iklc4ji1y60b.png)

To create thoughts in response to outside stimuli with hard coding every possible reaction, I needed some basic universal understandings like the need to eat, and then have the baby have a feeling related to that need and then perform an action that would lead to getting food. To do that, I needed the baby to draw a connection between a sources of food and being fed, and then make its own response out of its abilities. I made an associations key in long term memory to represent things that are relevant to each other to facilitate the drawing of connections pointing to an empty hash. This will without a doubt become bloated with loads of information with time and enough input, but this was inevitable at some point in the architecture of the intelligence given that even young children have an encyclopedia's worth of knowledge on the plants that grow around them, things that are clearly scary or dangerous, as well as their family and friends and all kinds of things about them. They store what things look like, what they do, and how they feel about them. 

I made a method with which a baby can observe its immediate surroundings and add knew objects to its knowledge based on its apparent traits. by looking around, the baby sees things that are unfamiliar and starts to take the idea of an object into it's cognition to start taking info on an object as it learns more about it.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/g87wubxj0f7ysk7fk1r3.png)

To make it draw up associations, the baby needs to think that trees are involved with wood and that wood relates to trees. I figured the object's type would be the most practical key to store relevant associations and added to the look at to making some actual thinking possible.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/1iirlkql76mkkds4cr6s.png)

By about now I also try to make a diagram of what I want to having working, and things quickly looked bigger than I was hoping. Even a proof of concept is going to be messy.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/llosit5rs6se1fipzay1.jpg)

Now this thing still needs to get food to satisfy its hunger. The baby needs to know what it's capable of and have an understanding of why it would perform those actions. What I plan to do is hard code basic action associations that this infant should already know like crawling and eating, and then write a method that determines the baby's goal through weighing on the many desires it may have and prioritizing eating in the case. I would've taken this much further but it's already a bit late and I wouldn't be against taking a look at this over the week.