The maze book for programmers!
PragProg Amazon

Algorithms, circle mazes, hex grids, masking, weaving, braiding, 3D and 4D grids, spheres, and more!

DRM-Free Ebook

The Buckblog

assorted ramblings by Jamis Buck

Jun 2016

Truth: Generating Truth Tables

11 June 2016 — A new library for generating truth tables is announced — 2-minute read

The post I was going to write today decided it needed some truth tables to support it, so of course (being the sort of programmer I am) I decided I would first write a utility to parse an expression and display the associated truth table.

(There are other tools out there that do this, some probably better than what I came up with, but I love writing parsers and I really just wanted to write my own. So there.)

So, as a result, I didn’t have time to write the post I was originally intending to write. That’s the bad news. The good news is that instead of that post, you get a post announcing my truth-table generator!

(And I still plan to write that other post. It’ll have to wait for next week, though.)

So, without further ado, allow me to introduce Truth!

There’s no gem for it (for various reasons, the most embarrassing being that the code has no tests yet…), and there are other gems called “truth”, and “truth-table”, so I need to figure out the best way to name it.

If that doesn’t scare you away, and you manage to download the code anyway, you can generate truth tables using the truth utility (in the bin directory):

$ ruby -Ilib bin/truth "(A || B) && C"
(A || B) && C

 A  B  C | =
 f  f  f | f 
 t  f  f | f 
 f  t  f | f 
 t  t  f | f 
 f  f  t | f 
 t  f  t | t 
 f  t  t | t 
 t  t  t | t 

Or, you can do so programmatically:

require 'truth'

table = "(A || B) && C"

Next week’s post will hopefully be more interesting. In the meantime, give this a try and let me know what you think.

The truth shall make you free!

May 2016

Disrupting Your Comfort Zone

28 May 2016 — The value of doing difficult things — 1-minute read

Think You’re Failing? Look Around.

14 May 2016 — A recent article by the author about seeing past our "failure filters" — 1-minute read

The Minimalist Programmer

7 May 2016 — A pointer to a recent article by the author — 1-minute read
Apr 2016

Tapping ActiveRecord Relations

23 April 2016 — A technique is demonstrated, calling Object#tap to reuse an ActiveRecord relation instance in order to accomplish more than one task — 2-minute read

2 April 2016 — 1-minute read

Mar 2016

Introducing the Query Composer

26 March 2016 — 4-minute read

The Poverty of Constraints

19 March 2016 — 1-minute read

Variations on a Theme: "I Becomes We..."

12 March 2016 — 2-minute read

Being a Good Neighbor...

5 March 2016 — 6-minute read

Feb 2016

Implementing a Bloom Effect with Swift+Metal

27 February 2016 — 7-minute read

Don't Feed the Hamster the Whole Stalk

20 February 2016 — 6-minute read

The weakly-flowing stream

13 February 2016 — 4-minute read

Living with Your Eyes Open

6 February 2016 — 6-minute read

Jan 2016

Software Proverbs

30 January 2016 — 4-minute read

Mazes in Swift

23 January 2016 — 4-minute read

A Pretty-Printer for SQL

16 January 2016 — 2-minute read

Don't Assume It's Difficult until It Is

9 January 2016 — 5-minute read

Game Demonstration: Recover the Widgets

2 January 2016 — 6-minute read

Dec 2015

Checking In...

26 December 2015 — 1-minute read

Avoiding "Call Super" with Callbacks

19 December 2015 — 5-minute read

Little Things: Introspecting Block Parameters

12 December 2015 — 1-minute read

Integration API vs. Internal API

5 December 2015 — 3-minute read

Nov 2015

Upsilon Mazes

28 November 2015 — 9-minute read

Representing a Toroidal Grid

21 November 2015 — 11-minute read

Little Things: Refactoring with Hashes

14 November 2015 — 2-minute read

Fifteen Minutes at a Time

7 November 2015 — 5-minute read

Oct 2015

Mazes with Blockwise Geometry

31 October 2015 — 5-minute read

Testing What You Should Have Written

24 October 2015 — 3-minute read

The Dynamic Def

17 October 2015 — 8-minute read

Way Back

The Buckblog Archives

Dating to 2004 — Hundreds more articles