
As the semester comes to a close, I look upon what has been given to me through Dr. Brown and the book Nature of Code. To thoroughly assess the skills I have attained, I must look back at what I knew coming into this course this semester. I came in with a general knowledge of coding, able to create small projects that once seemed like an epic feat, but now I am able to look back at those with a small grin. I thought I was a skilled individual at that time, and maybe I was, but I have come far this semester. One thing that lacked from the intro to java was the visual aspect of coding. Messing around with a Finch may be fun, but we found ourselves pushing its limits towards the end. I have heard that numerous languages require quite a bit of skill to become visual, and I wasn’t sure if I would be able to create visual projects at the end…. Well here we are. Pretty much everything has been visual throughout the semester since the start, and it has been very fulfilling for me.
The first week of this class we were brought outside to truly marvel at nature, taught to take in what it is. We found ourselves looking at nature in a different light, in mathematical way. This influence has been within me throughout the semester. Nature isn’t any less magical than it was before, if anything it is more magical. I find myself enjoying the natural beauty around us a bit more thanks to this. Either way, we did walk a thin line between science and dare I say… spirituality.
I now have quite a large tool-kit in coding, with code that can be applied to anything from video games to a program for a company payroll. Not to sound rude, but I expected this from the class. I know Dr. Brown will always provide a great learning environment and gives the feeling of “being ahead” of other classes by pushing us in a new way. That’s why I have stuck with his classes. One thing I did not expect was to be enlightened as an individual. We have debated numerous figures in the science community, from bull-headed mathematicians, to mushroom eating “hippies”. The class has been extremely serious at times and humorous during others, but at all times it has left you thinking. Often people misconceive a person’s rants as factual information due to credentials. I have seen this personally with family members and politicians… ALWAYS QUESTION THE MAN! Just kidding, but I have learned to become more independent with my outlook on life. So WHY AM I HERE TAKING THIS COURSE? I recall this question from the beginning of the semester. Earlier in the semester I would say selfish interests – and those are still present. I still like how this major keeps you on top of technological advancements. I like how we are dependent on technology. I still want to turn this knowledge into profit at some point… but it’s really to be able to share my thoughts and imagination with others. Doing this normally turns into knowing yourself even better. Either way, if I was “naturally” wealthy for some odd reason – I’d still want to be a part of this coding community. Being able to create creatures and worlds is truly fulfilling. On that note – Here is my FINAL PROJECT at last. I’m sure I will be updating this blog as I take the advanced course! Farewell!
Week 14 – Final Thoughts
Week 13
The last week in our book, an exciting yet sad time. I have honestly enjoyed the Nature of Code textbook, it has managed to put some somewhat mind blowing areas in perspective for me. This week was neural networks, yes that is right… A form of AI. I really wanted to do something stand alone for this, but implementing this into my program was an obvious choice. I originally planned on keeping my gatherers random, but what else am I to do with this! So I have been working on implementing the neural network example of seeking into my gatherers. I have somewhat failed, and somewhat succeeded. I know – kind of weird, but that is how I would explain what I have accomplished with this thus far. I found myself deep into coding it, too many errors occurring, losing touch with my plan. Restart! I now have the neural network in my gatherers, working, just not doing exactly what I want it to. The good news is I know the problem and simply need more time to fix it. I need to use an iterator to go through each of the targets – which would be my turkey array. I have only implemented this for one side of my “good vs evil” battle, mainly because I wanted to see and compare the differences of having one castle using completely random aka wandering gatherers versus that of a castle using gatherers that use neural networks.

A link to my unfinished code for this week is here
Week 12
Genetic algorithms! This is another subject that I didn’t expect to be dabbling in during an intermediate class. I am currently working on a mouse maze type of program, it’s just not where I want it to be exactly. Apparently once I have this one going it will “click” for me and it will be easier the next time. I have experienced this “clicking” many times in programming, I remember when calling functions was a challenge… I realize we just accomplishing remedial tasks with GA’s, but they are still tricky. I can’t imagine building one for jet engines!
Dr. Brown brought up some great side points about GA and it has me thinking about life again, typical! There are so many people out there who state that everything can be explained, everything about our existence is simple, anyone who dares to “break the mold” by saying otherwise is uneducated and should be kicked out of the “science” community. Reminds me of Mandlebrot! I believe life is far too complicated to be explained – end of story. I dare say that it really can’t be explained and never will be.

Week 11
I had to spend some time thinking about what to say about fractals… It takes time to comprehend just what is going on with the mandlebrot set. The best thing I can say that sums up my view of this would be “Being able to see infinity”. That is how I explained it to my wife, and I believe it really does convey the meaning. You can theoretically zoom in to a mandlebrot set an infinite amount of times, never ending. This brings me to thinking about the universe and just how small we really are.
On a side note I will not be implementing this in my environment, but I will be continuing to play around with this knowledge. I have never been much of an art guy, but I do enjoy what we have done with spiral and again with fractals. Mixing math, programming, visuals… Awesome!
Anyways, here are some of the pictures that I took for myself, hope you enjoy them!

Week 9
So we have arrived at cellular automata – something that I fully understand but have a hard time coding. When it comes to understanding the general principle the task seems simple. It’s just binary – we went over this in the intro class – but coding it is extremely tricky! Luckily Dr.Brown coded an object oriented version of this during class with us, I honestly would not have been able to do this at my current point in learning coding. I understand what recursion is, but knowing when to use it in my mind is quite the task. I honestly do not know when to implement a recursive call. I wasn’t able to implement this in my current program, and only was able to mess around with the running program with noise and random colors. The effect is quite trippy though.
You can now see some working weather in my project, the weather changes randomly too. I think this sets me apart from some of the class, which gives me a slight sense of accomplishment. I know we are all at different points in our skills of coding, I feel a bit behind compared to some, but I guess that is how life is. You are never going to be the fastest/strongest person. I also updated my gatherers to be true wanderers, they no longer bounce off of walls, I really enjoy this. I feel like I have come a long ways in coding – it’s no longer things bouncing off of walls or being attracted… Things now move more realistically.
My next tasks: Sound and the implementation of my “warrior”. I also need to figure out how to know when gatherers are within trees, stones, and turkeys. I have tried to implement this to no avail, it’s tricky because gatherers are called within m castle class, and my resources are created within my main.. I may need to move my gatherers to my main to make this easier… Until Next Week!
Download my cleaned up commented code here.
Week 8
Autonomous agents, I had no clue I was NEEDING these to be honest. Prior to this we have been creating attraction forces, everything moving off of something else. Amazing for insects and what not, but what about larger animals? This is where autonomous movement comes into play… You can create creatures that move about without attraction, even make the movement somewhat random, but still have the movement appear clean and realistically.

As you can see from the picture above, new creatures now roam my environment – humans! The movement is somewhat simplistic for now, but most of the hard work is out of the way. These will be my “gatherers” for the castles. I have tinted them according to the castle they are aligned with to make the environment a bit more followable. With this I can add some isWithin statements and have them gathering. I’m still thinking about how to send them home once they gather, but I’m sure it will come to me, probably a boolean though.
I was thinking about redoing my turkeys to be autonomous, but that is not how I see the world when I truly think about it. Right now the turkeys are attracted to a random tree every update of your screen, they appear to wander, but I noticed when my environment creates trees close to one another, the turkeys stay closer to the bundle of trees. I see this as more realistic, and also can give a castle an advantage in the beginning… But that’s life!
As you can see I haven’t done much with crowd simulation, but since I created fire with m particle system I will remain cliche and create water with the crowd knowledge I obtained this week.
Download my project here.
And my source here.
Week 7

Things have changed a bit as you can see! My battlefield has some creatures scampering about and I have done some tidying up with my code. I have been removing what is not needed in the driver, and placing it in the correct class. Anyways, it isn’t noticeable but it makes my life much easier. Here is a new shot of my project structure thus far.![]()
I added turkeys, boulders, and trees all extending object – so all of these are ISA. I mentioned having gatherers/fighters last week, well I haven’t created those just yet. I have been caught up in how to keep track of how many of each resource has been gathered. It is in the very primitive stages, but I can tell you that each turkey/boulder/tree has a random value of 1 to 10, when gathered it will be added to the castle’s running total.

I also mentioned having the “Heart Fire” of each castle represent the strength of that castle… I have done this by having the fire use X amount of particles, where X equals the castles food, stone, and lumber combined. Here is the snippet of code…
![]()
I have done a bit of trial and error trying to figure what prevents my project from running – it would be particle systems. Even a simple fire program will not run on here! Seems like there is always something haha! Anyways, I am attaching aZIP HERE
So we have been learning about imitating physics and what not, sometimes it’s a bit overwhelming… Guess what? Someone has already created something quite amazing by the name of box2d. If you wiki this, bah here is a link, you can see how many games have used this library. Quite extraordinary! On a side note, I’m starting to feel like I’m not simply saying “Hello World!” at this point… I’m beginning to feel confident based on what we are using, and what has been done with it.
Week 6
So this week we dabbled in particle engines… This may be my favorite week thus far. You wouldn’t imagine a small gif such as this
being used to create a somewhat realistic fire, but it can be!

Here is a screen shot linking to a *hopefully* running program with my code, it’s really just a mildly edited example from our book. But this had me thinking, how am I to bring a particle system into my bee world? Do I want to even keep my bee world with the *lack of fun* associated with it thus far due to being 3D?

Of course not! I have an idea that I feel enthusiastic for once again, this is one of the few… Well… The only class where I can literally create whatever I wish as my grade.
My new idea – 2 battling castles complete with weather. The weather will be rain/snow/nothing. The weather will change the movement speed of the people of the castle. The people of the castle will be gathering resources for the castle to make it stronger. The strength of the castle will be visual with a heart like fire in the center that grows/shrinks. I am going to create atleast 3 resources to gather… Once a certain amount has been obtained the people of the castle are upgraded as well, but maybe not all of them (still unsure). Anyways, you see where this is going – the two castles will be competing with one another for resources/fighting one another. It’s basically an Age of Empires type of project.
So far I have snow, but I need to create something random to choose between the other 2 weather types… The castles are complete – which took quite a bit of time! I have been primarily dealing with 3D spheres and textures, this is my first “free-hand” type of work in processing – very tedious, but it is much more fulfilling. The “heart” fires are working but I need to incorporate a way to change the size, and I already have an idea for that. Instead of growing every aspect of the size, I will simply add a higher lifespan to the fire images. It would look as if it is burning higher/stronger without having to re-size the castle constantly. Eventually I want to have the castles upgrading their gathers/warriors, equipping them, and creating more of which ever they need!
Week 4
My virtual world is driving me insane! I now have a a pendulum sun that swings in and flickers, bees, a hive that can be moved with the mouse, and a black sphere that represents a bear.

The bear is attracted to the hive, but repelled by bees (I actually have gravity be applied to him when bees are close). I like what I have accomplished, but I need to keep things simple. I have had fun in 3D, but I have had numerous problems – one of which is uploading my project for you to enjoy. I have attempted to find fault in my code, and narrowed my classes/driver from this
down to this
I then went through the code in my driver, killed the twinkling sun, bear, background, and went down to a single bee. THAT is the problem. Without a bee I can export my project and have it run. This entire time I have been creating 3d objects, when all along 3d objects kill the option of people playing with my project on my blog. Lesson learned!
Anyways, here is a link to my project where you can copy the source and see it for yourself http://ps11.pstcc.edu/~c1520a06/bees/
I will now be transferring my class hierarchy to be 2d, keep it simple and clean. I want to be able to share my creations with friends and family. I’m still happy that I spent this time on 3D, otherwise I would have regretted not doing it.
I will narrowing my classes back… The overall goal is to create a hive with bees. These bees will seek out flowers for themselves AND for the hive. The bear will be attracted to hives, but repelled if too many bees are currently inside the hive. I am also thinking about adding a “sun” type of object that flowers will grow around, and if the sun doesn’t come close to them for awhile have them die out. The sun would be optional though, as I could simply just give the flowers a life span.
I have found myself “attracted” to creating art with spirals, who knew math could be pretty? Plus it’s something you can actually run, finally.

I’m having fun with randomness and perlin noise… There’s so much you can do with it, the hard part is being creative.
A bit discouraged, yet still having fun – I guess this is my life story with programming thus far. No more 3D! No more Harlem Shake!
Week 3
This week we learned about force, I wish my previous math classes were similar to this. Instead of messing with numbers which convey no meaning, these numbers actually mean something… You can see it as well. My goal for this next step was to begin creating my class hierarchy. Last week I found myself highly modifying the examples and simply using whatever classes were already there.
I ventured a bit farther this week, I did not modify movers or attractors at all. I have not fully read the entire chapter yet, but I noticed the examples which deal with multiple attractions. They modified the movers class, I did not want to do this. Instead, I created TexturedSphere which extends Mover, and TexturedCone that extends Attractor. TexturedCone is not exactly where I want it to be yet, it actually just creates a sphere for now. I am close to being able to create some custom shapes though, mainly with help from this blog. Of course MyEnviro is my main driver… Which I can happily say contains very little code. I am still not sure where I am going with this, I keep finding myself seeing whats on the screen as insects. Hence the continuation of the bees, but this time the code can easily be changed to adapt to anything. TexturedCone and TexturedSphere are passed a PImage, so I can easily change the textures. I am thinking about adding some more parameters such as size so they can be more “global” in use. Maybe even some parameters to change the movement speed/style. Then I could use TexturedSphere as a bouncing basketball, orbiting planet, etc etc.
This is a shot of what I have been working on, I’m pretty impressed – and it looks “pretty”. The bees swarm around the hive at first, exciting. Then I found out if I do not check edges and move the hive a bit, they will eventually gain speed and spread out – looks as if they are leaving/coming back. Since I am stuck on this bee thing I suppose my next step would be to add flowers, have them create a pull on the bees as well. Hopefully the bees will then appear to go from the hive to the flowers. For this I think I will be “zooming out” and really starting to create a world type of feel. May the force be with you







