S
Stephen Duncan
I was working on some code (in Java), which had a somewhat complicated
nested pair of if statements. It occurred to me that I could try to
do some boolean algebra and see if I could simplify the expression.
Since I hadn't done that in probably 7+ years, I screwed up; a lot. I
find myself needing to generate the truth tables (
http://en.wikipedia.org/wiki/Truth_table ) to verify my work fairly
frequently. So I developed a Ruby program to generate truth tables
for me: http://jrduncans.googlecode.com/svn/trunk/truthtable The core
code is here: http://jrduncans.googlecode.com/svn/trunk/truthtable/lib/truthtable.rb
I'd like to say I just whipped this up, but I'm still a Ruby-newbie,
so this took me a few days. I'd love to get some feedback on the
code. I'd also like to know if anybody finds it actually useful for
them, and if so how I should go about making it easier to get/find.
If you run 'rake install_gem', you'll get an executable "truthtable"
that allows you to pass in the expression on the command-line to
generate the truth table.
Thanks in advance to anyone who takes the time to check it out,
-Stephen
nested pair of if statements. It occurred to me that I could try to
do some boolean algebra and see if I could simplify the expression.
Since I hadn't done that in probably 7+ years, I screwed up; a lot. I
find myself needing to generate the truth tables (
http://en.wikipedia.org/wiki/Truth_table ) to verify my work fairly
frequently. So I developed a Ruby program to generate truth tables
for me: http://jrduncans.googlecode.com/svn/trunk/truthtable The core
code is here: http://jrduncans.googlecode.com/svn/trunk/truthtable/lib/truthtable.rb
I'd like to say I just whipped this up, but I'm still a Ruby-newbie,
so this took me a few days. I'd love to get some feedback on the
code. I'd also like to know if anybody finds it actually useful for
them, and if so how I should go about making it easier to get/find.
If you run 'rake install_gem', you'll get an executable "truthtable"
that allows you to pass in the expression on the command-line to
generate the truth table.
Thanks in advance to anyone who takes the time to check it out,
-Stephen