## Cellular automaton again

As we were doing some logic during the last few lectures (see the post about reasoner), I decided that I wanted to do something usefull with this highly interessting stuff. So as I already had an engine to evaluate propositional logic expressions it was an easy thing to accomplish the following idea:
Consider the following matrix constituting our “world” and initial population:

with

and

To compute a new “generation” the aliveness (1 being alive, 0 dead) of each element is determined by evaluating a certain propsitional expression:

with

being the valuation of the proposition and

being the proposition itself.

with

Have a look at the screenshot to get a better idea on what the program is doing or run it using Java webstart below (may not work on MacOSX or Windows).

Today we we’re talking about binary addition and the twos complement. As our professor really sets a high value on being able to do binary addition and to calculate the twos complement, I decided write a small program to aid practicing those two. Click here to get this started.

Once you’ve filled in all the missing fields (or hit the help me link) hit return to see whether you’ve been right or not.

As I announced yesterday, the reasoner downloads are now available. For now only binary, but the sources will follow:

They’re all roughly 15mb big and you’ll need at least JRE 1.5 to run them. Have fun and if you have any questions or problems, feel free to post in the comments.

## Reasoner – Playing with boolean expressions

One of my lectures deals with mathematical logic. In order to play around with this highly interessting topic I wrote a small program dealing with this. The program is able to

• compute thruth tables
• evaluate expressions with custom input
• render syntax graphs
• check if an expression is satisfiable or a tautology
• Normalize expressions to CNF or DNF

The following operators are allowed:

• &

: AND

• |

: OR

• ->

: SUBJUNCTION

• <->

: BIJUNCTION

• !

: NOT

You may use lower case characters suffixed with integer numbers (e.g.

a, b, c2, d-3

)

Example:

 12345 /**  * This is just a test  */ (((a & b ) -> ((c | (a & c)) <-> d)) & a) <-> (a & (a <-> (b | c)))

Be aware that as I’m just beginning diving into this field all algorithms implemented in this application are NP complete. Meaning that the time it takes to compute certain things grows exponentially to the amount of distinct atoms (e.g. computing a truth tabe for

 1 a & b

is way faster than for

 1 a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t & u & v & w & x & y & z

which produces 67108864 rows).
The program runs on Windows, MacOSX and Linux. Alltough I didn’t test Windows (cauz’ I don’t have that “operating system” running anywhere). I’ll publish the binaries and source as soon as I have access to the University network tomorrow (where I have enough space left to do so).

Fork me on GitHub