Jump to content
  • entries
    10
  • comments
    22
  • views
    14042

"Prologging"...


Makoto_the_Phoenix

1049 views

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

It's definitely fun to do. I'm learning so much more about theory than programming, which is enjoyable anyway - there's no sense in learning C if all you're trying to do is rewrite Bubble Sort. :D

 

If you're interested in it, look into a specific paradigm of it - this being information systems, programming, data analysis, computational theory, or networking. CS is more or less a blanket term, but it has a nice mix of theory and actual programming.

Link to comment

Half of the difficulty of Prolog is getting your base predicates right. Hang in there - it takes rewiring your brain a little to think in Prolog. It's been 5years since I used it, so my brain has reverted.

 

I have a Masters degree in CS, so feel free to PM me if you need any assistance.

Link to comment
Is this puzzle the same thing as minesweeper? :o

 

Yeah - ironically enough, most of us in the class were likening this puzzle to Minesweeper. I was never very good at it, anyway...

Link to comment
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.