The is a simple logic circuit evaluator, made in only 1 script (no sprites) A logic circuit is like a mathematical expression, but with modifying 0 or 1 (T/F). There are three operators, namely NOT (!), which is 0 if the input is 1, otherwise 1; AND (&), which is 1 only if both inputs are 1; and OR (|), which is 1 if either of the inputs are 1. For example, 1&0 is 0, 1|0 is 1, !0 is 1.

This compiler allows comments in double quotes, random values (#), and inputs. Here is an example program to run, is takes two 4 inputs (two sets of two digits), and adds the two numbers:

???? (:0 & :2)|(:0 & (:1 & :3))|(:2 & (:1 & :3)) + (:1 & :3 & :0 & :2) | (!:0 & !:2 & :1 & :3) | (!(:1 & :3) & !:0 & :2) | (!(:1 & :3) & :0 & !:2) + !(:1 & :3) & (:1 | :3)

So the sum of 01 and 01 is 010 (base 2).

DOWNLOAD or use JAVA for the library to work right.

To learn more about logic gates, visit Wikipedia: http://en.wikipedia.org/wiki/Logic_gate

Working on: Save/load

Here's the library for Flash users:

==Constants==

1/T/t: "true"

0/F/f: "false"

?/I/i: Input

#/R/r: Random (0 or 1)

^: Last computation's result

==Operators==

&: 1 if operands are both 1, eg (1&1)=1

|: 1 if either operand is 1, eg (1|0)=1

!: 1 only if operand is 0, eg !0=1, !1=0

+: Concatenate operands (use only for answer)

==Syntax==

()/[]/{}: groups expressions to be evaluated together

"...": comment; characters between " not evaluated

:x :get input at index X

last: re-evaluate last expression