Author Topic: Hibernation  (Read 19871 times)

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hibernation
« on: January 25, 2006, 05:33:07 PM »
Una was originally designed as an experiment into 'hibernating' bots. Using conditionless coding, this version of Una (it's an older version) will hibernate when 1 is placed into location 51

Code: [Select]
'Una
'
'With hibernation command

def hibernate 51
def IDcode 55

cond
start
1 .hibernate *.robage -1 mult 1 add mult store

.tie *.robage -1 mult 1 add mult *.hibernate mult inc
.deltie *.hibernate mult inc

.fixpos *.fixed mult *.hibernate mult dec

*.refveldx .dx *.eye5 sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult store
*.refvelup 60 add .up *.eye5 sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult store

42 .IDcode *.robage -1 mult 1 add mult store
.IDcode .memloc *.robage -1 mult 1 add mult store

-6 .shoot *.eye5 sgn 1 add sgn mult *.eye5 40 sub sgn 1 add sgn -1 add -1 mult mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-8 .shootval sub sgn 1 add sgn mult *.eye5 40 sub sgn 1 add sgn -1 add -1 mult mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store

-6 .shoot *.refpoison sgn mult *.eye5 45 sub sgn 1 add sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-1 .shoot *.refpoison sgn -1 mult 1 add mult *.refshell sgn mult *.eye5 45 sub sgn 1 add sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
-6 .shoot *.refpoison sgn -1 mult 1 add mult *.refshell sgn -1 mult 1 add mult *.eye5 45 sub sgn 1 add sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store

16 .shootval *.eye5 45 sub sgn 1 add sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store

*.refvelup .up *.eye5 45 sub sgn 1 add sgn mult *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.eye5 sgn mult store
*.refxpos *.refypos angle .setaim *.hibernate mult *.memval 42 sub dup mult sgn *.refeye *.myeye sub dup mult sgn add sgn mult *.robage sgn mult *.eye5 sgn mult store

314 rnd .aimdx *.memval 42 sub dup mult sgn -1 add -1 mult *.refeye *.myeye sub dup mult sgn -1 add -1 mult mult *.eye5 sgn -1 add -1 mult add sgn mult *.hibernate mult store

40 .repro *.body 100 sub sgn mult *.nrg 1000 sub sgn 1 add sgn mult *.hibernate mult store
314 rnd .aimdx *.body 100 sub sgn mult *.nrg 1000 sub sgn 1 add sgn mult *.hibernate mult store

100 .strbody *.nrg 500 sub sgn mult *.hibernate mult store
100 .fdbody *.nrg -1 mult 100 add sgn mult *.hibernate mult store

*.tiepres .tienum *.numties sgn mult *.robage 1 sub sgn mult store
.dn .tieloc *.numties sgn mult *.robage 1 sub sgn mult store
32000 .tieval *.numties sgn mult *.robage 1 sub sgn mult store

*.waste .shootval *.waste 10 sub sgn mult *.hibernate mult store
-4 .shoot *.waste 10 sub sgn mult *.hibernate mult store

.delgene inc .delgene inc
stop

It's also nice and broken up to make it more understandable.

All commands in the DNA (except the anti-virus, but it uses inc anyway) have the code *.hibernate mult in them. *.hibernate is set at birth to be 1, but if you set it to zero using the console, the bot goes into hibernation. While in this state it uses no energy whatsoever. The original plan was for Una to release a deadly virus into the population and come out of hibernation later when the pandemic had (hopefully) wiped out everyone else. I never got round to using this feature when I realised that gearing the bot up for hibernation had made it extrodinarily efficient. I eventually removed the *.hibernation command just before joining this forum.

The virus (or a similar virus to the one) that Una was to be using (designed to be as deadly as possible, with the *.myeye being Una's *.myeye):

Code: [Select]
cond
start
100 .vshoot store
*.thisgene .mkvirus store
? .myeye store
*.genes rnd .delgene *877 -500 add sgn 1 add 2 div mult store
877 inc
.delgene dec
stop

What do you think of the concept?

Problem is that if another bot catches you sleeping they will just kill you  :angry:
I tried making a bot that hibernated when its *.nrg fell below 100. It was reasonably sucessful.
« Last Edit: January 25, 2006, 05:33:37 PM by Elite »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Hibernation
« Reply #1 on: January 25, 2006, 05:44:53 PM »
I can see some uses for it, but it's not really a ground pounder.

I think you're on the right track with a virus.  Really any time that you can gain an advantage but outlasting your adversary somethiung like that becomes really useful.

If you added some code to add shell or slime if you're being attacked it would be even better.  If you look at biology, many hibernating organisms create a defensive shell to protect them from predators.

Offline Light

  • Bot Destroyer
  • ***
  • Posts: 245
    • View Profile
Hibernation
« Reply #2 on: January 25, 2006, 06:38:58 PM »
Its funny, when I first came to DB, hibernation was one of the first things I played around with.

I dont think it has a lot of use for the leagues, cause as you rightly said any bot that comes accross it sleeping will just kill it while it sleeps, unless you can find some way of making enemy bots ignore you I.e. virus. I also played around with bots that hibernated when they were low on energy and bots with lots of energy would shoot energy particles towards them, to restart them.

Certainly some interesting ideas, but how usefull they are depends on what you want them to do and how you do it. But you certainly are resourcefull and seem to understand the DB language very well, so I look forward to seeing where this leads.
« Last Edit: January 25, 2006, 06:39:26 PM by Light »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Hibernation
« Reply #3 on: January 26, 2006, 09:47:22 AM »
That was the whole point of the early "spinners" such as Circumversor Algificus that Jez pioneered.

They were in a kind of hibernation state but were constantly spinning on the spot and watching for predators.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hibernation
« Reply #4 on: January 26, 2006, 11:22:52 AM »
Yes, I was thinking too of a 'keeper' bot that would watch over the bot population and wake them if there was a threat (like the wraith from Stargate Atlantis). I was thinking info shot.
Useless for leagues but it would make a great ecosystem. The hibernation bot poputation could go into hibernation when food was scarce and wake (or be woken) in a time of plenty (also like the wraith - they hibernate for thousands of years and then wake to cull their 'human herd', leaving some alive to breed, they then hibernate until the humans are at a reasonably high population again). That way, huge populations could be sustained with relatively little food.
A 'wraithbot' would be cool  :D ...

It would make an interesting little ecosystem wouldn't you think?

You'll be the first to know if I get anywhere  :)



BTW Does anyone here watch Stargate
« Last Edit: January 26, 2006, 11:30:28 AM by Elite »

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Hibernation
« Reply #5 on: January 26, 2006, 12:48:10 PM »
I watched the almost all of the original stargate episodes up to the last season. I also watched the first season of Atlantis but the way they stopped half way through the final 2-part season finale pissed me off so much that I just can't get back into it any more.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Hibernation
« Reply #6 on: January 26, 2006, 01:43:26 PM »
I mostly watch them because they come before Battlestar Galactica.  I'm a neo-Battlestar Galactica addict.  They're just very emotionally resonating to me.

To set up an appropriate simulation where hibernation would be useful, you can use day/night cycles, the veggy repop cooldown timer, or both.  I would recommend the veggy repop cooldown timer.  Set it really high and there'll be alot of cycles elapsing between when all the veggies die and when they get repopulated.

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hibernation
« Reply #7 on: January 26, 2006, 01:44:41 PM »
Go here to participate in the community project  :)  :)  :) !
« Last Edit: January 26, 2006, 01:58:04 PM by Elite »

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
Hibernation
« Reply #8 on: April 15, 2006, 09:20:59 AM »
Somehow I do not get it, there are so many store commands why is it supposed to use no energy when hibarnation is put to zero?

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hibernation
« Reply #9 on: April 15, 2006, 09:54:02 AM »
Storing into a memory location that doesn't exist (0) costs no energy

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Hibernation
« Reply #10 on: April 15, 2006, 12:12:34 PM »
Most impossible actions are free

Offline Welwordion

  • Bot Destroyer
  • ***
  • Posts: 325
    • View Profile
Hibernation
« Reply #11 on: April 15, 2006, 12:55:56 PM »
Which means instead of conditions, I can use a multiplicator which is either 0 or 1 based on a calculation and so save energy if they conditions are false?

Well, that will be alot of work changing my bot into such a form    
« Last Edit: April 15, 2006, 12:56:23 PM by Welwordion »

Offline Numsgil

  • Administrator
  • Bot God
  • *****
  • Posts: 7742
    • View Profile
Hibernation
« Reply #12 on: April 15, 2006, 01:06:53 PM »
Bots that do that are called SG bots, and are IMO almost more work than they're worth.

Offline Elite

  • Bot Overlord
  • ****
  • Posts: 532
    • View Profile
Hibernation
« Reply #13 on: April 15, 2006, 01:32:44 PM »
You can also make them totally immune to viruses using

.delgene inc
.delgene inc

Me and Endy love SG bots. There's a thread about conditionless coding somewhere.

Offline PurpleYouko

  • Bot God
  • *****
  • Posts: 2556
    • View Profile
Hibernation
« Reply #14 on: April 15, 2006, 07:08:42 PM »
Quote from: Elite
Storing into a memory location that doesn't exist (0) costs no energy
Unless the costs have ben dramaticly overhauled recently this should not work.  

Costs for storing are calculated by the program going through the DNA and physically counting all the "store" commands then multiplying that number by the store cost. It should make absolutely no difference if any particular store command is successful or not since the costs are applied outside of the main loop.
There are 10 kinds of people in the world
Those who understand binary.
and those who don't

:D PY :D