CS371P #9

Yet another computer science figure passed away; John McCarthy, the computer scientist who coined the term “artificial intelligence” in 1955, and founder of LISP died Monday at age 84. http://en.wikipedia.org/wiki/John_McCarthy_%28computer_scientist%29

Apparently exam 2 was tougher than I thought. Actually I don’t think it was hard or tough. “Obviously” I am an awesome software engineer but I suck at test taking. But thanks to the extra credit I am still in reach of my initial grade goal.

Another git episode. So during this project I had the need to do some coding in Darwin.h and my darwin.c++ which was not going to be turned in. I wanted to add some code into Darwin.h to maintain total number of creatures per species, so that I can print out the totals before and after the run to readily see which creature wins. Seems like this “extra” code shouldn’t be part of the turned in source so I wanted to either add it to a branch or just create a separate Darwin2.h file.

After my previous experimentation with git branching I quickly decided it would be easier, in this situation, to just create a Darwin2.h rather than create a git branch. Since the code changes were going to be minimal and since switching git branches has it’s own set of inconveniences I decided it was easier to create a Darwin2.h and just maintain that along side Darwin.h. It seems to me that in order for it to be worth creating a git branch you need to have significant enough code mods to make in order for the benefit to overcome the minor inconveniences that go with branching. That and the fact that this is a very simple 1 or 2 file program. For instance I want to be able to run and work on both Darwin.h and Darwin2.h and it could and would be inconvenient to be switching branches while actively making mods to both branches – you can’t switch branches without first committing any changes. So I don’t think git branching was a good fit in this situation.

Darwin is fun. I’ve been spending a little time learning to program creatures. I ended up adding more code in order to print out some debug info to tell exactly what was going on with creatures, both as a creature learning aid and to make sure the simulator is working correctly. I have it dumping out info like this


best 0 0,22 N if_enemy 2 go 4 if_enemy 2 left
rover 0 1,21 E if_enemy 9 if_empty 7 hop
rover 0 2,12 S if_enemy 9 if_empty 7 hop
best 0 3,24 W if_enemy 2 go 4 if_enemy 2 left

following each turn/grid in order to see exactly what each creature is doing at every turn. Learned several things about how creatures can behave and interact.

First thing I tried was to clone rover, that you can simply clone rover and as it randomly turns out beat rover at his own game. But I didn’t expect that would count as extra credit. So I did manage to come up with a very simple creature that sometimes beats rover, and luckly, does beat him for our srand(0) case. I’ve yet to create one that consistently beats rover over a wide range of games. FWIW I added a command line switch “-srand n” where n can be a number or t for time(NULL) to mix things up and get different behavior i.e. see how a creature really matches up.

Someone mentioned team work and getting them to work together. I’ve been playing with that but haven’t yet come up with anything that doesn’t get chowed down by rover. These scripts get long quick, zap is a must.