Wednesday, May 2, 2012

Simple AI - JavaScript (using jQuery for animations)


First off, I would like to let you know that I am 16 years old and have been programming for a few years (mostly C-based languages, iOS development, web stuff, etc) as a hobby and am now developing an interest for creating a simple AI (most people start off with a tic tac toe game yes, but I am interested in making something using the principals of geneteic programming). The reason I would like the readers to know this is because I would appreciate it if the answers were not too complex (not too hard for a kid to understand since I haven't attended college computer science courses yet).









Here is my goal:





Terms



organsim: a CSS div

population: a group of organisms (5 or 10)

food source: another CSS div





Process



  1. A population is generated, each appearing to possess the same phenotypic attributes initially but differ in their skills (for this, speed)

  2. A single food source is generated (the same each time)

  3. After about 5 seconds of the environment being set up (steps 1 and 2), the population of organisms need to find a way to get to the food source competitively

  4. Only one organism may reach the food item. Upon reaching it, the environment is reset except the organism who found the food item the previous time is now benefitted and its speed level might increment while the others who did particularly terrible may get even slower or be terminated

  5. Process is repeated; the user may observe the traits of the population and see which ones are succeeding evolutionarily, etc.






Additional information



So as you can see, the above steps almost simulate evolution but in a very simple way (less conditions compared to real life situations for animals); Now here is why I'm asking here: I am completely lost. I really have no idea where to start (except for generating the population, I can most likely do that as well as getting them to move via jQuery animations). But being able to make them attract to a food source is what I can't do right now. So, I'd like help getting pointed in the right direction for this.



I appreciate all helpful answers. Thanks.


Source: Tips4all

No comments:

Post a Comment