Staredit Network > Forums > SC1 UMS Theory and Ideas > Topic: Building Logic Gates in SC
Building Logic Gates in SC
Apr 21 2011, 10:29 pm
By: Sacrieur  

May 7 2011, 5:52 am Sacrieur Post #21

Still Napping

Quote from Kaias
Quote from Sacrieur
Quote from Wormer
Quote from Sacrieur
I found an application for logic gates in trigger-based AI... Effectively using flowcharts to determine action.
Gratz, but this topic isn't about applicatioin *of* logic gates in trigger-based AI. Also, don't call random flowcharts a logic gate circuit, which has an appointed meaning.

So XNOR has no application in a flowchart? And the topic says logic gates in SC =P. I figured I would just post on this thread rather than make another thread.
Wormer is right- these aren't circuits and logic gates, and posing basic trigger logic as some sort of newfangled logic gate system is ineffectual. I don't mean to be excessively harsh here, but, what's the point of this thread?

Perhaps it is that you don't quite understand what a logic gate is or how it operates. "Basic" trigger logic is far from the truth, since triggers run off of conditions/actions, they're a glorified modus ponens. The definition of flowchart specifically employs the use of analyzing data as its main function. Where there is analyzing, there are logic gates because this is the only way for computers to analyze data.

It is interesting to note, because a flowchart is simply a visual representation of logic. It has an input (or several) and an output (or several). The input runs through the logic gate and then arrives at an output. Represented by 0 or 1 (or false and true, respectively). We can apply this directly to our trigger system with the following method:

Logic has several different conditionals used in logic gates. I shall list them:

AND: conjunction (& or ∧)
OR: disjunction (∨)
NOT: negation (~ or ¬)

Using negations, we can construct inverses:

NAND: inverse conjunction [¬(A ∧ B)]
NOR: inverse disjunction [¬(A ∨ B)]

Additionally, there are two others, making use of the exclusive use of the word or (one or the other, but not both).

XNOR: inverse exclusive disjunction (A ≡ B)
XOR: exclusive disjunction [¬(A ≡ B)]

---

Now if we design a trigger system based on these seven logic gates, we can obtain output values in complex fashions. This is useful in the area of Trigger-based AI, where complex decisions must be made (and can be made) with logic. Draw up several triggers for each. More than 2 inputs require much, much more triggers, so we should avoid that scenario. If we look at the logic outputs of AND we see this:

A B | A ∧ B
1 1 | 1 1 1
1 0 | 1 0 0
0 1 | 0 0 1
0 0 | 0 0 0

This means we need only four triggers to get full functionality for every function. We avoid redundancy by adding markers. Values for As and Bs will be set by death counters. Additional death counters will be used to mark which function is running the data. By using switches, we run through our conditions first, and once a flag is set (which means conditions have been met) these run through the functions for which the operator flags are set, churning out an output affected by actions, which then also uses switches to avoid confusion with other triggers. This is essentially a rudimentary processor. We may speed up the process by creating multiple processing units, essentially making a multi-core processing system.

Still pointless or unrelated?



None.

May 7 2011, 9:52 am Wormer Post #22



Related, but still pointless.

Thank you Sacrieur, I understand what is a logic gate, because mathematical theory of integral circuits is the thing I'm professionally concerned. I am glad you understand all these. However, the task of emulating a microprocessor is meaningless. Why would one want to do it anyway? It's still a concept of a spherically symmetric horse traveling in a vacuum.

I don't understand what do you want to say? What do you want to discuss with people? What is the point of posting this? It sounds like: "Oh look, I'm so awesome I realized we can make a microprocessor on SC!" And the only answer that might be is "Oh cool!" Very fruitful discussion, eh?

Once again, I mean no offense. Excuse me if I'm too straightforward.
I am all up to doing little useful things, but against grotesque pointless discussions.


One little useful thing that follows from these math which I often use on practice is the application of the De Morgan law to reduce the number of triggers. Let's say I want to do something like (A ∨ B ∨ ... ∨ Z => Do something.). I can't implement this as a single trigger because we (unfortunately) don't have the disjunction connective in triggers. The straightforward implementation will need 26 triggers. We however do it with only 3 triggers:
T0 = (Always. => Preserve Trigger. Clear switch S.),
T1 = (¬A ∧ ¬B ∧ ... ∧ ¬Z => Preserve Trigger. Set switch S.),
T2 = (Switch S is clear. => Do something.).

If you then need to have multiple conditions of the form A ∨ B ∨ ... ∨ Z, they all share trigger T0 to reset switches. That way, the method is not really worse by triggers quantity than using trivia implementation whether there are only 2 disjuncts of more. But it's even better in the way that "Do something" isn't copied among triggers, and it's easy to change "Do something" on "Do something else" when you need it later (and sooner or later you will need).

Still have to be very care about A and ¬A, because there are cases when you can't simply construct ¬A from A (for instance "Bring at most N" doesn't always equivalent to ¬"Bring at least N+1"). It's really simple and I believe many people use this, but at least it's a useful thing.


P.S. http://www.staredit.net/?p=shoutbox&view=1322
Quote
Wormer -- Sac! Beware! Triggers number is theoretically unlimited but practically limited with SCMD and the LAG.
Wormer -- *nothing else to do in life
Wormer -- Is he really serious about implementing this thing? This man has nothing to do in life :P
Wormer -- Jack, I wonder too!
Jack[RCDF -- Sac. Why would we want a CPU in SC wheb we can have one OUTSIDE of SC that's better?


P.P.S. More shoutbox reading reveals something.
Quote from Wormer
However, the task of emulating a microprocessor is meaningless. Why would one want to do it anyway?

http://www.staredit.net/?p=shoutbox&view=1323
Quote
Sacrieur -- creating a processor inside starcraft enables us to perform complex decision making and increase the capabilities of triggers. It actually changes the trigger system from If A, then B to Input A -> Input B
IskatuMesk -- As I am not a mapper you would have to explain to me the advantages of doing this
Sacrieur -- voila, working SC processor.
Sacrieur -- anyway, if we find the schematics of a primitive processor we can adapt that into a trigger style fairly easily, and then implement it into SC in under 40 hours of work

The art of making triggers in SC consists in making a close to optimal number of triggers that won't lag the map for the aim one needs to achieve. And believe me, optimality doesn't include first (God forfend!) implementing a meta-microprocessor and second writing a meta-program. There is already a free embedded "processor" which is called SC Triggers Subsystem. Learn to use it well and you're the winner!

Also, triggers system is an event driven mechanism in contrary to control driven algorithms. But it's exactly what one needs when he makes an SC map!

Post has been edited 7 time(s), last time on May 7 2011, 11:00 am by Wormer.



Some.

May 7 2011, 9:14 pm Kaias Post #23



Quote from ClansAreForGays
Quote from Kaias
Lethal_Illusion and I had actually worked out the framework for a 2 Player 3D shooter, dividing the minimap in half for display for each player- similar to what you're suggesting- 2.5 years ago. We decided not to pursue it further than that, as it wasn't really worthy of our time compared to other projects we had planned.

And iirc, the minimap updates much slower than the 12 frames a second, giving you both a low framerate and low resolution.
So how much of that epic you+lethal map did you get done? I'll take it off your hands.

And I'm talking about the last stand RPG contest thing.
Not too far unfortunately. We spent almost all of our time making Nightfall's (the RPG) core systems, and almost none of it actually making content so there isn't much to see (no more than a couple minutes worth of gameplay). It's all fragmented into a bunch of maps sporting different parts of it (most effective way for us to co-work on it). Your inquiry prompted me to talk with Lethal_Illusion and we decided we'd go back, blow off the dust, merge the different systems into one map and let people see it. We'll do this after exams are over, of course.

"Take it off [our] hands" as in, you just want to see it, or as in you'd like to potentially work with it?

Post has been edited 1 time(s), last time on May 7 2011, 10:04 pm by Kaias. Reason: wording



None.

May 7 2011, 10:01 pm Vrael Post #24



Cut the guy some slack. Don't you all remember when you discovered something cool with mapping and you wanted to let everyone else know about it? I think we've all been there. Just because you haven't thought of a use for an extra microprocessor doesn't mean he won't :P



None.

Oct 24 2011, 10:24 am Lanthanide Post #25



The early posts in this thread were talking about making movies in the minimap, but said that the framerate was severely limited.

I found out earlier while trying to debug a bizarre JYD problem in my map, that actually when your units are under attack the minimap starts updating much more frequently, possibly as fast as 12 FPS.



None.

Oct 26 2011, 6:13 pm Tempz Post #26



I don't believe it until i see a test map.

Post has been edited 1 time(s), last time on Oct 26 2011, 10:44 pm by Tempz.



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[10:34 am]
NudeRaider -- SEN doesn't rely on spammers initiate its sleep cycle. It hat fully automated rest and clean-up phases. Please understand that this is necessary for the smooth operation of the site. Thank you.
[03:45 am]
Sylph-Of-Space -- Does the shoutbox get disabled when there's spammers?
[2024-5-17. : 6:47 am]
NudeRaider -- lil-Inferno
lil-Inferno shouted: nah
strong
[2024-5-17. : 5:41 am]
Ultraviolet -- 🤔 so inf is in you?
[2024-5-17. : 4:57 am]
O)FaRTy1billion[MM] -- my name is mud
[2024-5-17. : 4:35 am]
Ultraviolet -- mud, meet my friend, the stick
[2024-5-16. : 10:07 pm]
lil-Inferno -- nah
[2024-5-16. : 8:36 pm]
Ultraviolet -- Inf, we've got a job for you. ASUS has been very naughty and we need our lil guy to go do their mom's to teach them if they fuck around, they gon' find out
[2024-5-16. : 5:25 pm]
NudeRaider -- there he is, right on time! Go UV! :D
[2024-5-16. : 5:24 pm]
lil-Inferno -- poopoo
Please log in to shout.


Members Online: 4gabriellae242eb1, Roy, 8charlottee392ee2