Take a look at it. You may be thinking, "Well it's just an array. What's so special about it?". Well the fact is, it DNA (Kind of).
I took me about an hour of work, and It paid off. So what does it do? Well, it mimics natural selection.
Within each cell is an array, or "DNA" if you will. The DNA controls the cell's size, alpha, breed rate, life span, and movement speed. Each one of these determines how well it will survive and create a child.
You are the predator, simply clicking on the cell kills it, thus eliminating its chances of passing on it's genes. The cell spawns another cell with similar DNA.
Does it work? Why of course it does. After toying with it for about 5 minutes you may notice that the cells will become smaller, faster, and dimmer. I've even created an exact way to measure this. I added a
piece of the script that allows it to take the average of all the cells DNA.
Before Predation.
[1.474669232731685 ,2.845904463902116 ,137 ,137.63117529451847 ,0.3327539700549096]
[0.9836245548445731 ,2.0978369620162995 ,141.6 ,309.32201278591526 ,0.4108339709043505]
[0.9388599204986046 ,2.07245667312139 ,142.6 ,336.01265944987534 ,0.37586487626346465]
[0.8492967823068752 ,2.1645641694259314 ,136.6868686868686 ,369.6431425355582 ,0.36942785137492895]
[0.7653473002696409 ,2.222876532301307 ,134.33 ,398.6704018855188 ,0.3671380105968568]
[0.7174894966503453 ,2.3454245825877833 ,117.86734693877551 ,431.16441458188075 ,0.35961712562735704]
After Predation.
[0.7436614844272844 ,2.5163062159041876 ,104.91 ,467.1113160784869 ,0.4056801602789201]
[0.44020992366597056 ,2.712807661402039 ,55.35 ,523.4675777946459 ,0.39466535274544745]
[0.40022512410068883 ,2.8448938027000987 ,40.59 ,541.2977979342313 ,0.3946652915789749]
[0.32873030388262126 ,2.9693017766345293 ,26.55 ,561.1919197970303 ,0.415266771607567]
[0.3310742474603467 ,3.1435384194948712 ,13.55 ,570.9248711973149 ,0.460117161015049]
[0.2943195825838484 ,3.178501337370835 ,4.82 ,583.9013258700725 ,0.5005997988614255]
[0.23204775807913391 ,3.2680840010032988 ,1.12 ,598.3112366043217 ,0.5137212244248951]
[0.2121786629059352 ,3.2933589843381195 ,0 ,603.2740213429415 ,0.5167193985828198]
[0.1966122092306614 ,3.249354674380738 ,-0.56 ,608.7654778995364 ,0.5085924967420288]
[0.13454850030131638 ,3.286368337541353 ,-1.45 ,616.1810469966615 ,0.4986694704983383]
[0.12021581941284239 ,3.2749694645171985 ,-1.22 ,621.567563584121 ,0.491266982260626]
[0.07122604317963123 ,3.3480347882723436 ,0.59 ,633.716921256776 ,0.4904466022043488]
The gene that controll size drops from 1.5 all the way to .05, Speed goes from 2.8 to 3.4, breed rate plummets from 137 to .6, and life span soars to 633 frames. My removal of cells has made the cells
stronger.
I also tried letting the cells propagate without predation. Obviously, the only factions that would change are breed rate and life span. The cells bred for over 7 hours.
Begining...
[1.530007295543328,3.787272580782883,102 .5,169.49112610449083,0.2339601620566100 2]
[1.0825672084465623,3.7273768722079694,1 02,206.07285876804963,0.2045338894240558 7]
[1.2579387475270778,3.5530017025303096,9 2.13333333333334,239.73342795306817,0.20 837065533424426]
[1.2492524539516308,3.601782157656271,87 .81,270.70548023830634,0.218552806356456 13]
[1.320816197488457,3.638526942813769,81.
99,298.09045152280015,0.2074067045077681 9]
[1.1760452885041013,3.5770252447621895,7 1.3,324.4889749379596,0.1851644380046055 2]
[1.0118354496941901,3.4582938547781668,5 5.92,349.8691794113349,0.129299589278176 53]
[1.127776318253018,3.2301048750430343,33 .79,371.7566563213989,0.0378903872556984 9]
[1.3502308961749077,3.152440414270386,13 .19,390.9276788398251,-0.021900418109260 453]
[1.5124216491170228,3.1918537072930486,2 .61,407.6514052302297,-0.036766048204153 74]
End...
[4.965583989878651,2.9834561302955263,-0 .76,3697.7423830848143,0.465434645137282 55]
[4.980971449678764,3.0276264990493655,-0 .52,3698.7742001862034,0.458982656161299 46]
[4.947543821381405,3.074515298125334,-1.
05,3699.6520629651936,0.4546139568928612 7]
[4.922342830754351,3.042213344096672,-0.
66,3700.437108122036,0.45440934227173985 ]
[4.978031043543015,3.0298157997080124,-1 .05,3702.040093773934,0.4372694892701677 3]
[4.983746115211398,3.0202037557261066,-1 .09,3703.236686241012,0.4409239029036819 4]
[4.979713250799104,3.038325157689396,-1.
4,3704.16662720575,0.4381305619454928]
The breed rate goes from 102 to 1.4 (Absolute Value), and the average life span soars to 3700 frames!!!
Here is the flash. (Give the cells time to multiply before killing, and sometimes the breed rate is higher than the life span, so just reload the page.)
Continued...