Ambrosia Garden Archive
    • Spobs, visbits, and nested loops


      Not sure if this is news to anyone or not, but placing the same spob in multiple systems, only one of which is ever visible, works fine. The spob functions as it should. Isn't selectable by random misns, but a misn targeted at it specifically will select whichever one is currently visible. I imagine a few people are aware of this, but here comes the funky part:

      If you have a misn to such a spob, but the spob goes invisible, then the misn automatically succeeds, triggering the 'OnSucceed' ncbs, giving the reward and changing the legal status. There are operators to fail and abort misns, but none to force success. This works quite nicely and allows us to build if-then checks than run within crons -> we can now do nested loops!

      Thanks to this method, we should now be able to create counters using even fewer crons.

      3bit counter:

      Syst ... Visability
      1 ....... (b1 & !b2) & !b0
      2 ....... !b1 & !b0
      3 ....... (b1 & b2) | b0
      Each syst contains spob 1

      Misn ... OnSuc .... OnFail
      1 ........ b1 ^b3 ... b0 ^b2
      The misn destination is spob 1

      Cron ... Enable ... Start
      1 ........ b11 ........ S1 !b1 F1 S1 ^b2 A1 ^b1 !b0 !b11
      When bit 11 is set, the counter is increased by one

      7 bit counter:
      yst ... Visability
      1 ....... (((b1 & !b2) & b11) | ((b3 & !b4) & b12) | ((b5 & !b6) & b13)) & !b0
      2 ....... ((!b1 & b11) | (!b3 & b12) | (!b5 & b13) ) & !b0
      3 ....... (b1 & b2 & b11) | (b3 & b4 & b12) | (b5 & b6 & b12) | b0
      Each syst contains spob 1

      Misn ... OnSuc .... OnFail
      1 ........ b1 ^b12 ... b0 ^b2
      2 ........ b3 ^b13 ... b0 ^b4
      3 ........ b5 ^b7 ..... b0 ^b6
      The misn destination is spob 1 for each

      Cron ... Enable ... Start
      1 ........ b11 .......... S1 !b1 F1 S1 ^b2 A1 ^b1 !b0 !b11
      2 ........ b12 .......... S2 !b3 F2 S2 ^b4 A2 ^b3 !b0 !b12
      3 ........ b13 .......... S3 !b5 F3 S3 ^b6 A3 ^b5 !b0 !b13
      When bit 11 is set, the counter for the least significant 2 bits is incremented.
      When bit 12 is set, the counter for the nest significant 2 bits is incremented.
      When bit 13 is set, the counter for the most significant 3 bits is incremented.

      Resource Usage:
      n-bit ... m ........... ncb ....... misn ... cron ... syst ... spob
      3 ......... 1 ............ 5 ........... 1 ......... 1 ....... 3 ........ 1
      5 ......... 2 ............ 8 ........... 2 ......... 2 ....... 3 ........ 1
      7 ......... 3 ............ 11 ......... 3 ......... 3 ....... 3 ........ 1
      n ......... (n-1)/2 ... 3m+2 ... m ........ m ...... 3 ........ 1

      As you can see, it's very efficient in resource usage, as well as being quite elegant. A few ncbs can be saved (and the visbits made less complicated!) by using a separate triple system/spob for each m. Changes ncb usage to 2m+2, syst usage to 3m and spob usage to m. Alternatively, a combination of the methods could be used. Setting aside an extra ncb for instance would halve the syst/spob usage. It's a very versatile set-up.

      It is likely that this could be used to reduce cron usage in other calculations.

      ------------------
      (url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)

    • WOAH!
      Jonathan Boyd, you are a genius. Even I cant comprehend what you have come up with (more study nessesary).
      We now have three counter types for plugmakers.
      Aranor-Regulus NCB Counter (ARNC)
      Boyd Outfit Resource Counter (BORC)
      Boyd System Visibility Counter (BSVC)
      Wheee. More dev-toys.
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Quote

      Originally posted by Azratax2:
      WOAH!
      Jonathan Boyd, you are a genius. Even I cant comprehend what you have come up with (more study nessesary).

      Basically, we now have a way of getting a misn to either succeed or fail/abort depending on whether system visibility is changed while the misn is running. A misn will only abort if running, so succeeding a misn via visbit change means that the Fxxx or Axxx triggers won't fire. b0 ensures that once an if-then test has been failed, they will continue to be failed. b11-13 are used to indicate that a bit has been added, so the counter should run. Incidentally, this means that addition functionality is built into the counter - it is possible to add 1, 4, 16, 64 etc. in one day (though not combinations of any of those).

      If you go through the 3-bit counter and understand it then it should be easy enough to extend the ideas to the 7-bit one. And work out how a 5-bit one would work. Try running through it assuming that at the start, !b1 !b2 then try b1 !b2 then !b1 b2 and finally b1 b2.

      In fact, once you understand how they work, you should be able to see how you can get an arbitrarily big counter to function with a single cron. It involves using a lot more misn resources.

      In fact, now that we're armed with this, you could conceivably do a TC that turns Nova into a calculator...

      Quote

      We now have three counter types for plugmakers.
      Aranor-Regulus NCB Counter (ARNC)

      I'm disappointed to see that you haven't adapted my RANC terminology here instead ;^)

      Quote

      **Boyd Outfit Resource Counter (BORC)
      Boyd System Visibility Counter (BSVC)
      Wheee. More dev-toys. **

      How about we call it the BCCC instead? Boyd Cron Conservation Counter. It's the environmentally friendly way to count. After all, it's not using the systems to count, but rather to trigger if-then-else statements. BITESC would be fine too - Boyd If Then Else Statement Counter

      ------------------
      (url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)

    • Quote

      Originally posted by Jonathan Boyd:
      **How about we call it the BCCC instead? Boyd Cron Conservation Counter. It's the environmentally friendly way to count. After all, it's not using the systems to count, but rather to trigger if-then-else statements. BITESC would be fine too - Boyd If Then Else Statement Counter

      **

      Ooh, RANC is more approriate actually - since Regulus made it and Aranor improved it.
      I hadnt seen you call it RANC.
      BITESC sounds good...
      -Az, who is adding a counter section to his site

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Quote

      Originally posted by Azratax2:
      Ooh, RANC is more approriate actually - since Regulus made it and Aranor improved it.
      I hadnt seen you call it RANC.
      BITESC sounds good...

      On second thoughts, it's a bit of a mouthful. BITEC Is fine. I considered going with a consistent 4 letter BITC, but prefer the pronunciation of BITEC.

      Quote

      -Az, who is adding a counter section to his site

      Until today, I'd never actually checked your site. Handy looking little thing now that I see it. A sight easier to find stuff than here.

      ------------------
      (url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)

    • Very well done, Boyd! You do a lot of C / Assembly hacking?

      (edit:) I'm looking at the 3-bit now. In cron 1, when the second S1 fires, it often happens (it seems to me) that neither of the spobs are visible. What happens then? And what happens if one spob becomes visible just after the S1?

      (edit2:) Or maybe that didn't happen, I just messed up the bits. sorry.

      ------------------
      (url="http://"http://en.wikipedia.org")En Wikipedia(/url)

      (This message has been edited by Engla (edited 01-09-2004).)

      (This message has been edited by Engla (edited 01-09-2004).)

    • Quote

      Originally posted by Engla:
      Very well done, Boyd! You do a lot of C / Assembly hacking?

      I used to do a bit of BASIC on an Atari STE many years ago and a bit of Pascal on some NeXT boxes more recently. That's about it. Well, apart from the eectronics practical where we wired up a subtract instruction for a chip and then programmed it in Assembly to do various things. That was cool.

      Quote

      (edit:) I'm looking at the 3-bit now. In cron 1, when the second S1 fires, it often happens (it seems to me) that neither of the spobs are visible. What happens then? And what happens if one spob becomes visible just after the S1?

      I'm pretty sure there should always be exactly one spob visibble. That said, I did this at 3am. Under what conditions do you think there won't be any visible spobs, or more than one?
      !b1 !b2 !b4 - Syst 2 visible
      b1 !b2 !b4 - Syst 1 visible
      !b1 b2 !b4 - Syst 2 visible
      b1 b2 !b4 - Syst 3 visible
      !b1 !b2 b4 - Syst 3 visible
      b1 !b2 b4 - Syst 3 visible
      !b1 b2 b4 - Syst 3 visible
      b1 b2 b4 - Syst 3 visible

      ------------------
      (url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)

    • Quote

      Originally posted by Jonathan Boyd:
      I'm pretty sure there should always be exactly one spob visibble...

      Upon a second check, it all worked. Somehow, binary processing is not natural for me. You, however, seem to speak binary 😉

      It seems I did my second edit just before you hit submit.

      ------------------
      (url="http://"http://en.wikipedia.org")En Wikipedia(/url)

    • Quote

      Originally posted by Engla:
      **

      Quote

      Originally posted by Jonathan Boyd:
      I'm pretty sure there should always be exactly one spob visibble...

      Upon a second check, it all worked. Somehow, binary processing is not natural for me. You, however, seem to speak binary ;)**

      A pencil, paper and eraser work wonders for these things. And a few hours of thought.

      Quote

      It seems I did my second edit just before you hit submit.

      Heh, always the way. A few times I've submitted a post, gone straight to the Dev Corner main page and noticed someone else has the most recent post.

      ------------------
      (url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)

    • Has this been tested in a plug to demonstrate that it works?
      I know this is a silly question and i dont doubt that you would test something crazy like this before you posted, but i figured i would ask before I started trying to play with it
      Thanks
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Quote

      Originally posted by Azratax2:
      **Has this been tested in a plug to demonstrate that it works?
      I know this is a silly question and i dont doubt that you would test something crazy like this before you posted, but i figured i would ask before I started trying to play with it **

      Part of it has been. Testing has shown that switching visibility causes misns to succeed. The only untested thing is whether the instructions in the cron will execute in order, which I presume they will. Unfortunately I'm flying back to uni today, so I don't have time to test it right now.

      ------------------
      (url="http://"http://homepage.mac.com/jonathanboyd/evn/index.html")Classic4Nova plug-in(/url)

    • I sure hope they will.... I just worked for a few hours early this morning to use your kinda tricks to make a division system (which i will post once i have it well organized).
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Quote

      Originally posted by Azratax2:
      **I sure hope they will.... I just worked for a few hours early this morning to use your kinda tricks to make a division system (which i will post once i have it well organized).
      -Az

      **

      I cant test this. I just discovered that the fxxx operator on a PC doesnt execute onFail, so this doesnt stand a chance of working. Bug reported.
      Anyone wanna test this on a Mac?
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

      (This message has been edited by Azratax2 (edited 01-10-2004).)

    • Uh.. I think I get some of that 😛
      In reference to my program, is it using TravelSpob or ReturnSpob, and does it always auto-succeed?
      e.g. spob 128 is in syst 128 and 129, b1 sets syst 128 visible and 129 invisible, while !b1 does vice versa, each time the mission will succeed?
      (this'll take some more work on my program, I'll end up making it into a fully functional simulation of the WHOLE of EVN :p)

      ------------------
      (url="http://"http://blog.evula.net/Ephialtes")The Blog of Ephialtes(/url)

    • Heh, these sort of topics really make me feel inadequate to moderate this board. 🙂

      ------------------
      (url="http://"http://www.mazca.com/")Mazca(/url) , Moderator, (url="http://"http://www.AmbrosiaSW.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&number;=9&SUBMIT;=Go&urgaylol;=yes")EV Developer's Corner(/url)
      burn burn the truth, enjoy the flames in celebration

    • Quote

      I can't test this. I just discovered that the fxxx operator on a PC doesnt execute onFail...

      Are these bugs going to be fixed in the next PC Nova update?

      ------------------
      Retribution: An Upcoming Plug-in for EVN.
      Visit the (url="http://"http://www.ambrosiasw.com/cgi-bin/ubb/forumdisplay.cgi?action=topics&number;=20&SUBMIT;=Go")Chronicles(/url) today! Be sure to read the short story ' (url="http://"http://www.ambrosiasw.com/cgi-bin/ubb/newsdisplay.cgi?action=topics &number;=20&forum;=*EV/EVO+chronicles&DaysPrune;=100&article;=000262&startpoint;=")Fiery Descent(/url)'!
      (url="http://"http://www.cwssoftware.com")Sephil Saga(/url): An upcoming TC, visit the web page today.| | | Both the best and the worst plug-in editor for Windows! (url="http://"http://www.aznt.com/EVN/EVNEW")EVNEW(/url)!

    • BITEC doesnt work.
      Same behavior on Mac as PC.
      The missions dont try to start until after the whole ncb string gets evaled
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Boyd how the heck did you set up that mission that goes successful when its destination dissapears?
      Doesnt seem to work for me.
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.

    • Quote

      Originally posted by Azratax2:
      **BITEC doesnt work.
      Same behavior on Mac as PC.
      The missions dont try to start until after the whole ncb string gets evaled
      -Az
      **

      We want this to work, right? Isn't there a way we can split the cron set string into a series of auto-aborting missions, that will do this all in sequence and work?

      This cron:
      Cron ... Enable ... Start
      1 ........ b11 ........ S1 !b1 F1 S1 ^b2 A1 ^b1 !b0 !b11

      Is replaced with:
      Misn ... OnAbort
      2 ........ !b1 F1
      3 ........ S1 ^b2
      4 ........ A1 ^b1 !b0 !b11

      Cron ... Enable ... Start
      1 ........ b11 ........ S1 S2 S3 S4

      ?

      ------------------
      (url="http://"http://en.wikipedia.org")En Wikipedia(/url)

    • Engla: That might work, except I cant seem to get the Succeed-when-destination-vanishes effect. Rig up a test yourself.
      I think that the first thing we should be doing is trying to figure out how to reproduce the force-success effect, since it is central to this whole thing.
      I cannot make it work in it's simplest form (a mission with nothing else set other than OnSucc and OnFail, and returnstellar being a transient spob, and an outfit to make the spob's system go poof. )
      -Az

      ------------------
      It is here. EVNEW Public Beta (url="http://"http://www.aznt.com/EVN/EVNEW")www.aznt.com/EVN/EVNEW(/url)
      Stuffit is a piece of .sit.