Log In  

Cart #hg-6 | 2019-11-12 | Code ▽ | Embed ▽ | No License

Hold (O) to see the cycle of life.
TO LOAD THIS CART in immediate mode type:

load #hg

While the cart I'm working on now (and have been for several days) is quite a bit bigger than 560-bytes (hundreds of lines), seeing Conway's life program reiterated reminded me of my Father.

For years ago he wrote a program in Turbo Pascal he called the "Cycle Of Life."

In it, he had 3-different colored pixels randomly appearing on the screen in a 640x480 screen.

He told me that one pixel chases the other and the last chases the first. I really didn't understand him so he explained it to me.

Red chases yellow.
Yellow chases green.
Green chases red.

I thought about it for a-while and thought that was a pretty nifty thing. He later went on to make a very complex program he simply called, "LIFE." where there were gray dots all moving on the screen. If one got boxed in though he would turn red and start killing the gray.

If enough people saw red dots (bodies), they would take it upon themselves to become a policeman (turning blue), and running into the killer would apprehend him. (turning him into a white pixel), imprisonment my Dad said. Where he could not move from that spot but could still be seen by other citizens.

Then if they moved for a long time without finding any killers (red dots), they would revert back to gray (citizen) and the life program would continue, although the prisoner would remain.

At the time I thought it was a very complex thing and really beyond what I could code.

But I did understand the earlier program he wrote where 3-colors chased each other.

Thinking to the chess game, the foxes and the geese, I thought it would be interesting to change it from colored dots to actual pictures. Where red was the fox, yellow was not geese but rabbits as I liked drawing rabbit icons back then (S1), and the green was the grass.

So the new cycle of life was:
Foxes eat rabbits.
Rabbits eat grass.
Grass eats foxes.

When I wrote this back in QBasic so many years ago, someone questioned how the grass could eat the foxes. A valid question !

I told them that the foxes were carnivorous and grass means no meat, so they die out if it encroached on their territory. Ah, a good enough answer for the time I thought. :D

And thus is what you have here, tweetable, meaning it is 560-characters or less.

I think it demonstrates an interesting idea that is quite a bit different than "Conway's" game of life.

It also includes the sprites for the grass, foxes, and rabbits, as part of the source-code so it runs right out of the box ! I call it, "The Hunting Grounds."

Here is the source-code, exactly at 560-chars.

-- hunting grounds
-- written by dw817 (11-12-19)
for i=0,167 do sset(i%24+8,i/24,"0x"..sub(s,i+1,i+1))end
for i=0,224 do mset(i%15,i/15,r(3)+1)end
if m(h,v)==e[w]then n(h,v,w)end
c=(c+1)%32if c==31 then cls()map(0,0,4,4,15,15)repeat flip()until btn(4)end until z

Hold down the (O) key and watch the CYCLE OF LIFE ...

VVhat's going on ?

Random foxes, rabbits, and grass are drawn first on the playfield.

A random position is chosen.

A random direction is chosen. One of up, down, left, or right.

If that random spot can "eat" in that single direction chosen, it will convert that food to the same identity as itself thereby "spawning."

Then the cycle is repeated.


  • The foxes will win if the rabbits eat all the grass.
    [Predator] Foxes
    [Food] Rabbits


  • The rabbits will win if the grass manages to push out all the foxes.
    [Predator] Rabbits
    [Food] Grass


  • The grass will win if the foxes eat all the rabbits.
    [Predator] Grass
    [Food] Foxes (They encroach on their area and drive them out).

And WHO WILL WIN ? Will it be the foxes, the rabbits, or the grass ?
It is entirely possible for one to fill the field entirely.

P#69852 2019-11-12 20:31 ( Edited 2019-11-13 02:05)


looks like alan turing theory about dots in animals

P#69883 2019-11-13 19:52
:: dw817

Hm ? Alan Turing. That's quite the compliment, @prismo18.

Thank you. But no, not really, at least I hope my little forest isn't that complex.

Now Dad, well he was the founder of PWP, Singles Scene, helped Sam the monkey to get shot into space as he did behavioral research back at General Dynamics, Ph.D. degreed psychologist, licensed air pilot, received Mensan Of The Year award, The Renaissance Award, and even once received Father Of The Year award - that was so many years ago.

I think he was way ahead of his time for most of his ideas and models. Many of which were put into business practice before and after he passed on.

I think at some point I'm going to try and recreate what he did with the people and crowding and label it, "My Father's Society."

There are so many projects I am working on right now. Bits and pieces. Not nearly enough hours in the day to cover what I want. I'll get there - eventually. :)

P#69890 2019-11-14 02:25

the winner was grass

also please make your dad's game

P#71212 2019-12-19 02:52
:: dw817

Hi @Roninnozlo. Thanks for trying out my cart. Glad you played it to the end. As for "Society." I will. Once I slow down a bit I have planned to write that in 2020 upcoming. I also wanted to bring back my GFA interactive ant-farm. Not topview but sideview like you have with the glass ant farm.

P#71215 2019-12-19 03:17 ( Edited 2019-12-19 03:27)

You may very much like the videos on this channel. They are son of my favorite on YouTube.


P#71229 2019-12-19 15:07

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-08-08 09:24 | 0.044s | 2097k | Q:39