Yet Another Darn Counter - Bidirectional NCB counter

YEDC.
These are two simple 4 bit binary NCB counters. b10 represents the increment bit, and b11 the decrement bit. The value is stored in binary form in b1-b4, with b1 the high bit.
The second counter will not rollover if you try to increment and it's at 1111 or you try to decrement it at 0000.
Yall can see how to extend these to more bits.
These are very slightly more expensive in terms of cron count, because you need the final cron at the end to unset b11 and b10, but you only need one of these reseting crons nomatter how many of these counters you use.
standard Azratax Bidirectional Counter (ABC)
Cron 1:
- EnableOn: ((b10 & (b2 & (b3 & b4)))|(b11 & (!b2 & (!b3 & !b4))))& !(b10 & b11)
- OnStart: ^b1
Cron 2:
- EnableOn: ((b10 & (b3 & b4))|(b11 & (!b3 & !b4)))& !(b10 & b11)
- OnStart: ^b2
Cron 3:
- EnableOn: ((b10 & b4)|(b11 & !b4))& !(b10 & b11)
- OnStart: ^b3
Cron 4:
- EnableOn: (b10 | b11)& !(b10 & b11)
- OnStart: ^b4

Azratax Roll-Over Proof Counter (AzROP)
Cron 1:
- EnableOn: ((b10 & (!b1 & (b2 & (b3 & b4)))) |(b11 & (b1 & !(b2 | (b3 | b4))))) & !(b10 & b11)
- OnStart: ^b1
Cron 2:
- EnableOn: ((b10 & (!(b1 & b2) & (b3 & b4)))|(b11 & (b1 | b2) & !(b3 | b4))) & !(b10 & b11)
- OnStart: ^b2
Cron 3:
- EnableOn: ((b10 & (!(b1 & (b2 & b3)) & b4)))|(b11 & (b1 | (b2 | b3)) & !b4)) & !(b10 & b11)
- OnStart: ^b3
Cron 4:
- EnableOn: ((b10 & !(b1 & (b2 & (b3 & b4)))|(b11 & ! (b1 | (b2 | (b3 | b4)))) & !(b10 & b11)
- OnStart: ^b4

In either case, you need a final reset cron. This one might want to be cron 639 (the last cron that can ever run - cron index number 511).
EnableOn: b10 | b11
OnStart: !b10 !b11

Why do we need that final cron instead of just unsetting the bits in the last of the counter crons and removing the !(b10 and b11) from all the enableon fields?
Wierd stuff will happen if it was told to both increment and decrement.

Enjoy all.
-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.

Hmmm... interesting...

Just a quick question, though- this is basically a RANC, with the crons modified to do double duty, based on whether or not you have b10 (go forward), or b11 (go backward) set, right? I'm just looking at the logic and want to make sure I'm drawing the correct parallel.

As it stands, this counter will increment (forwards or backwards) once a day, correct? Unless neither b10 nor b11 are set, or they both are, right?

Hmm... I'm having some interesting ideas involving cyclical RBITs. "The power of the universe is always in flux- it grows and wanes every 32 days..." (for a 4-bit counter :))

------------------
~Charlie
Sephil Saga Homepage: (url="http://"http://www.cwssoftware.com")www.cwssoftware.com(/url)

Quote

Originally posted by Masamune:
**Hmmm... interesting...

Just a quick question, though- this is basically a RANC, with the crons modified to do double duty, based on whether or not you have b10 (go forward), or b11 (go backward) set, right? I'm just looking at the logic and want to make sure I'm drawing the correct parallel.

As it stands, this counter will increment (forwards or backwards) once a day, correct? Unless neither b10 nor b11 are set, or they both are, right?

Hmm... I'm having some interesting ideas involving cyclical RBITs. "The power of the universe is always in flux- it grows and wanes every 32 days..." (for a 4-bit counter :))

**

Yeah. I forgot to mention that. Yes, its based on a RANC, but it extends it significantly,
I like your idea with the cyclical RBITs. Never thoughta that. You could do this with... 5 crons (4 for the counter, and one that looks like this, and no final one to remove the decrement/increment bit):

EnableOn: ((b1 & ( b2 & (b3 &b4;)))& b10)|(!(b1 | ( b2 | (b3 | b4)))& b11)
OnStart: ^b10 ^b11
-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.

Oh man, I'm trying to figure out an excuse to use some kind of cyclical anything... but alas, no. I suppose I'll have to throw everyone else a bone with that one 😉

I have an interesting counter-related discussion topic. NeonSoldier asked me the other day what counters in general are good for, seeing as how we spend so much time and effort talking about them. Well, my first reaction was, "Well, lots of things. Like..." and I couldn't get past that. Now, I know there have been some great uses for counters discussed in the past, (and the if-then-else counter, particularly, would have been nice, especially for the division problem), but right now they seem like the Laser was originally- a solution looking for a problem. What DO we use counters for, anyway?!

------------------
~Charlie
Sephil Saga Homepage: (url="http://"http://www.cwssoftware.com")www.cwssoftware.com(/url)

Quote

Originally posted by Masamune:
**Oh man, I'm trying to figure out an excuse to use some kind of cyclical anything... but alas, no. I suppose I'll have to throw everyone else a bone with that one;)

I have an interesting counter-related discussion topic. NeonSoldier asked me the other day what counters in general are good for, seeing as how we spend so much time and effort talking about them. Well, my first reaction was, "Well, lots of things. Like..." and I couldn't get past that. Now, I know there have been some great uses for counters discussed in the past, (and the if-then-else counter, particularly, would have been nice, especially for the division problem), but right now they seem like the Laser was originally- a solution looking for a problem. What DO we use counters for, anyway?!

**

Hmmmm. I'm using them for shadiness values as has been discussed (and which needs an ABC as opposed to a RANC - since people can become less shady if they decide to mend thier ways (the walls of a prison cell for a few months tends to do that)), and one as a measure of how close one of the three main governments is to a total collapse.
On a more general note: They are very useful to tally the cumulative effects of multiple missions, which either need be completed many times, or which may not all be done.

For things that happen over a long time scale, the increment/decrement bits can be replaced with token outfits, which sacrifices 2 outf's for the ability to increment and decrement by more than 1 at a time (however, it still only moves at a maximum of +/- 1 per day.
-Az
The govt-destabilization: An AzROP-ABC application.
If during the first X years of game time, the player and random events coincide, a series of missions and crons between years X and X+Y will result in the collapse of the government, switching it's systems such that it ends up getting parceled off into several other govts. The govt in question is somewhat socialist/communistish, and as the stability counter decreases, they are get more and more draconian in an attempt to stay in power (thus making thier collapse less ethicly questionable to contribute to, and more spectacular to watch). On the other hand, as the stability counter is increased, conditions improve within that govt and there is less dissent, and the whole thing may even move a ways towards becomeing a freer place (mabey only if stability hits 1111, else it will just kinda hang on as it was, not alltogether bad, but neither as successful nor as pleasent as the Terran Confederacy (The other govt)).
OOH! Mabey if this govt starts heading towards draconian, i could have ships of a different version of this govt (allied to it) and with a different scanmask with the interceptor AI appear, to simulate things being outlawed.

------------------
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.

My original idea for counters was in response a (url="http://"http://www.ambrosiasw.com/webboard/Forum26/HTML/002780.html")post(/url) by Admiral Benden, which basically laid out a scenario thus:

Benden wanted to create a type of fighter bay that could service two different types of ship - You would buy one bay in the outfitters, and then could buy either, say, fighters or bombers with it. We figured out how to get the purchase of the Fighter bay to also grant a Bomber bay using a combination of G and D operators that seems somewhat obvious in hindsight, but the remaining issue was that each fighter type would obey its own ammo limit - that is, if the Fighter bay had a limit of 4 and the Bomber bay had a limit of 4, then you couldn't buy 8 fighters in lieu of an even split.

To amend this, I proposed the original counter as a means of allowing the player to buy as many of each as he wanted, and cap purchases once the overall limit was reached. OnBuy of a fighter or bomber would activate the "toggle", and when the counter reached the overall limit a new bit would be set to disable further purchases.

Of course, as I suggested this implementation, it wouldn't work very well. For one thing, since I had no way of decrementing the counter (although it wouldn't have been difficult to implement using a similar brute-force method as my original counter) selling fighters wouldn't lower the value stored in the counter. Additionally, there is no way to test if a fighter has been destroyed - Nova can do this for the Vell-os carrier, but only when the total number of fighters drops to zero, using the O test string.

Probably the best way to implement this now, using modern methods, would be to use an BONC for each fighter type, and use a BORC addition test to make sure the binary sum is less than or equal to the overall max.

In the end, though, I think what appealed to people about counters more than their practical utility was the sheer audacity of turning Nova's overpowered yet obtuse NCB engine into a turing-complete calculator. There's a bit of hackish glee in getting a system to do something it clearly wasn't designed for, and people seem to have run with it.

-reg

------------------
"As a rule we believe as much as we can. We would believe everything if only we could."
~ William James

Wow. Regulus, the Father of Counters, posting in my topic :p. I didnt even know if you still roamed these boards.
Another wow: You can really tell how old those posts are - the magic of the NCB system still wasnt common knowledge.

I think you hit the nail on the head about one of the main reasons people like making counters. We do have practical uses for them (I like my govt-destabilize idea), but beyond that, making them is fun in the hackish way you described.
-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.

Just out of curiosity, is there an established central page keeping track of these counters people are coming up with? If not, there certainly should be. Referring to them by acronyms doesn't tell us much unless we have some sort of reference, and simply linking to the associated webboard topics is cumbersome.

If such a page doesn't exist yet, I'd be willing to create one and host it.

------------------
- o n y x -
"I dn't type. I'm a kybard artist "
(url="http://"http://www.pacifier.com/~kkey/shipyard/index.html")Onyx's EV Shipyard(/url)

Quote

Originally posted by Onyx:
**Just out of curiosity, is there an established central page keeping track of these counters people are coming up with? If not, there certainly should be. Referring to them by acronyms doesn't tell us much unless we have some sort of reference, and simply linking to the associated webboard topics is cumbersome.

If such a page doesn't exist yet, I'd be willing to create one and host it.

**

I am planning to make such a page and put it on aznt.com.
Just keep sleeping too much on weekends, and getting distracted by too much other crap. Blah. I hate sleeping - i wasted half my damned weekend sleeping. And I have a GF whom I definately dont hate, and, well, she definatley takes priority over EVN stuff.
-Az
Speaking of hosting: your site is down.

------------------
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 02-02-2004).)

Quote

Originally posted by Azratax2:
**I am planning to make such a page and put it on aznt.com.
Just keep sleeping too much on weekends, and getting distracted by too much other crap. Blah. I hate sleeping - i wasted half my damned weekend sleeping. And I have a GF whom I definately dont hate, and, well, she definatley takes priority over EVN stuff.
-Az
Speaking of hosting: your site is down.

**

Well, since my hosting is apparently flaky anyway, perhaps such a thing should go on your server. You are, after all, more intimately tied to the theoretical-development (a.k.a EV R&D;) sub-community than I. To whomever eventually makes it, I have some ideas of how to structure the page, if anyone is interested.

My site seems to work now, but I have no information on what was up with it earlier. It's supposed to have 5 GB of monthly transfer, so I hope it wasn't overdrawn on bandwidth...

------------------
- o n y x -
"I dn't type. I'm a kybard artist "
(url="http://"http://www.pacifier.com/~kkey/shipyard/index.html")Onyx's EV Shipyard(/url)

The problem with it earlier was the the DNS lookup of the server failed.

The way I will structure it is as a page in the "random info" section of my site (url="http://"http://www.aznt.com/EVN")www.aznt.com/EVN(/url)
-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.