Our current And is not really an And element.
It is a variable number of stacked and elements - what it really is: an "All" element.
Likewise our Or is not really an Or - it is an "Either" or "One".
Just the Not is a Not, because it is bugged with multiple inputs.
Why not just make them be 4 condensed blocks:
Let players just use either NOne, NAll or Even instead of Not
And add 2 new:
It is a variable number of stacked and elements - what it really is: an "All" element.
Likewise our Or is not really an Or - it is an "Either" or "One".
Just the Not is a Not, because it is bugged with multiple inputs.
Why not just make them be 4 condensed blocks:
All=And
NAll=NAnd -- (And->Not)
One=Or
NOne=NOr -- (Or->Not)
NAll=NAnd -- (And->Not)
One=Or
NOne=NOr -- (Or->Not)
Let players just use either NOne, NAll or Even instead of Not
- I guess it has almost no performance impact, as Not should rarely gotten used alone.
And add 2 new:
Odd (XOR)
Even (XOR->Not)
Even (XOR->Not)
JavaScript:
public class Logic_Element
{
// ((super.update))
public int state = 0;
public LinkedList inputs = new LinkedList();
public boolean updating = false;
private static LinkedList updateElements = new LinkedList();
public void update()
{
this.updating = false;
int state = 0;
ListIterator li = inputs.listIterator();
while( li.hasNext() )
{
state = this.process(state, li.next().state)
}
if( (state = this.finalProcess(state)) != this.state )
{
this.state = state;
if( !this.updating )
{
this.updating = true
updateElements.add( this );
}
}
}
private int process(int state1, int state2)
{}
private int finalProcess(int state)
{}
}
public class Logic_All extends Logic_Element
{
public int process(int state1, int state2)
{
return state1 & state2;
}
}
public class Logic_Nall extends Logic_Element
{
public int process(int state1, int state2)
{
return state1 & state2;
}
public int finalProcess(int state)
{
return ~state
}
}
public class Logic_One extends Logic_Element
{
public int process(int state1, int state2)
{
return state1 | state2;
}
}
public class Logic_None extends Logic_Element
{
public int process(int state1, int state2)
{
return state1 | state2;
}
public int finalProcess(int state)
{
return ~state
}
}
public class Logic_Odd extends Logic_Element
{
public int process(int state1, int state2)
{
return state1 ^ state2;
}
}
public class Logic_Even extends Logic_Element
{
public int process(int state1, int state2)
{
return state1 ^ state2;
}
public int finalProcess(int state)
{
return ~state
}
}
Last edited: