"Prologging"...
It's been a long, long two weeks.
Right now, I'm halfway through my Principles of Programming Languages class, and one of the assignments involves writing a Tentaizu puzzle solver.
For those that are unfamiliar with it, Tentaizu (Celestial Map) is a numbers' game with a 7 by 7 grid of numbers dotted around it, and the objective is to fill the map with ten stars that satisfy the rules of its boundary. For instance, a number 0 denotes that 0 stars are allowed in the eight or so squares around it, and so on.
This sounds like a moderately difficult project, right? I mean, put in about two-hundred lines of Java and it's a cakewalk, right? Well, here's the kicker.
Since we're learning about different paradigms, we have to write the entire puzzle in Prolog. For those of you that have never heard of it, Prolog is a unique, logic-based language, in which you simply tell it what is true about your world. It has a lot to do with First Order Predicate Calculus. For logicians, this language is ideal. For those of us used to C, C++, Python, Java, and pretty much every other object-oriented/procedural language, this language will eat you alive.
Simply the way you have to think about problems has to change, since you can no longer rely on an algorithm to solve problems.
In summation, I was able to make some strong headway as far as getting the thing to work, but it doesn't look like it will work properly. I can't tell it what's true about Tentaizu that makes any canonical sense to myself or Prolog - I had a plan to set up boundaries, in which if it ran into a 'border', it would ignore it, but otherwise, look to find all valid places to place a star within it. Getting the border to work properly took the better part of a 3 day weekend; getting a single predicate (that's what they call statements of fact - predicates) to work to reflect that is still painful.
I've come a long, long way with my Prolog, but I'll be honest - if the assignment is something you genuinely can't understand, and the professor didn't go over it as well as you'd have enjoyed, then what else can you do? I've asked most everyone in my class to lend me a hand, and I've given what advice I could on the project, but the fact of the matter is that I did my best, and I can't solve it. There are two or three others in the class that could do Prolog, and they offered me their source, but since I'm more concerned with concepts than code, I declined for two weeks. It does me no good to have the answers without any foundation.
I'm the kind of guy that doesn't like to quit or give up, so I'm going to still keep at it. I'll learn Prolog here and there, and figure out how it's done.
So anyway, that's that, I suppose. I think I might try to unwind and tinker a bit with Ubuntu Karmic.
5 Comments
Recommended Comments