Magic Square program

I’ve been playing around with CLIPS, a rule-based programming system developed by NASA in Houston some years ago. Here’s a program to figure out magic squares – 3×3 groupings of the numbers 1-9, with the sum of each row, column, and diagonal being equal. I needed to use two rules, as a one-rule solution blew up before it could generate an answer. This one only takes a minute or two to solve the problem on my Mac Mini.

Download MagicSquare.clp

Here’s the one-rule version, for your edification. Maybe it will run on your machine.

Leave a Reply