• Announcements

    • Anapsi

      Logging in   05/10/2017

      If you had an account and can't log in as of 5/9/17, this may be because of a change in logins with new forum software. You can log in using your publicly displayed name (not your username) or your email address and the password you used before.   If you have problems with this, please ask any of the mods or admins. 
Sign in to follow this  
Followers 0
sylae

Development
SDF Logic

3 posts in this topic

We should have some nodes to do quick and dirty arithmetic and logic checks.

 

For all the following, Stuff Done Flags is the result, Extra 1x is Input A, and Extra 2x is Input B.

 

  • SDF_ADD: Add SDF A and SDF B, store the result in Stuff Done Flags (A+B)
  • SDF_SUB: Subtract SDF A into SDF B, store the result in Stuff Done Flags (A-B)
  • SDF_MULT: Multiply SDF A and SDF B, store the result in Stuff Done Flags (A*B)
  • SDF_ADD: Devide SDF A into SDF B, store the result in Stuff Done Flags, rounded down (floor(A/B)
  • SDF_POW: Raise SDF A by SDF B, store the result in Stuff Done Flags (A^B) (will SDF limits be a concern?)

 

All of the following assume 0 or -1=FALSE, any other =TRUE

 

  • SDF_AND: Logical AND
  • SDF_OR: Logical OR
  • SDF_NOT: Logical NOT (ignoring SDF B)
  • SDF_NAND: Logical NAND
  • SDF_NOR: Logical NOR
  • SDF_XOR: Logical XOR
  • SDF_XNOR: Logical XNOR

 

With a bit of elbow grease this could allow designers to implement some logic beyond what we have now.

Share this post


Link to post
Share on other sites

Definitely agree, with one exception: I doubt we need logical XOR or XNOR. Actually, logical XNOR already exists - it's called "SDF Equal". :p (I suppose it could differ in treating the SDFs as boolean instead of numeric...)

 

I expect the SDF limit can be dropped entirely, but I'm not sure your logic of where to store the result is good. Why not just use the "pic" field for the result SDF?

 

EDIT: Sorry, "pic" is one field and SDFs need two. Maybe the "message" fields, then. That said, I guess it doesn't particularly matter.

Harehunter likes this

Share this post


Link to post
Share on other sites

Thinking over this again, I think logical AND and OR are completely unnecessary - can't you get the same effect by simply chaining nodes together in the right way?

 

The arithmetic ones I'm currently in the process of adding. They'll probably work like this:

 

SDF1, SDF2 - Output SDF (for division, the quotient)

Ex1a, Ex1b - Input SDF (left operand) - if ex1b is negative, takes ex1a as a literal value

Ex2a, Ex2b - Input SDF (right operand) - if ex2b is negative, takes ex2a as a literal value

Ex1c, Ex2c - For division only, output SDF to store the remainder.

 

EDIT: Note - due to the implementation of pointers, the only guaranteed way for ex1a or ex2b to be negative would for it to have been set to -1; other values might get replaced by pointed-to values.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0