Log In  

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


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)
r,m,n,e,d,c,s=rnd,mget,mset,{2,3,1},{-1,0,0,-1,1,0,0,1},0,"3000000049404940666066600b000000044444006e606e6000300000499999406e606e600000000044a9a44066666660000000300449440006e6e60000000b00004940000666660000003000000e000000676000"
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
repeat
x,y=r(15),r(15)s,w=flr(r(4))*2+1,m(x,y)
h,v=x+d[s],y+d[s+1]
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.

[8x8]
A random position is chosen.

[8x8]
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.

[8x8]

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

[8x8]

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

[8x8]

  • 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 2022-11-13 21:54)

1

looks like alan turing theory about dots in animals

P#69883 2019-11-13 19:52

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

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.

https://www.youtube.com/watch?v=YNMkADpvO4w

P#71229 2019-12-19 15:07

@Cabledragon, what goes around comes around. I just came across this video the other day and the next day I am looking at comments to my posts to see if I have errors in my code - and here it is the very one you suggested. :)

I was also wondering how that would look in Pico-8 today.

Thanks for the link !

P#121115 2022-11-21 18:13

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 18:43:52 | 0.033s | Q:28