1

I was wondering if I should invest my time in learning AI using Prolog. The decision is simple. If it will have any kind of benefit in my career as an iPhone developer, I would do so. Otherwise, I'll skip it.

So, is there any benefit in learning AI using Prolog for an iPhone developer? (especially for building games)

And, if so, how???

Thanks!

Mazyod
  • 22,319
  • 10
  • 92
  • 157
  • For one working implementation of Prolog on the iPhone, as well as an alternative, check out the answers to this question: [Executing prolog code on an iPhone](http://stackoverflow.com/questions/3905542/executing-prolog-code-on-an-iphone) – Brad Larson Feb 05 '11 at 15:16

4 Answers4

6

There are two questions here:

  1. Should I learn AI by using Prolog?
  2. Would Prolog be useful to me as an AI language for iPhone?

I don't know about the second. I am not familiar with iPhone development. My guess is that it would be hard to find an efficient Prolog compiler for iPhone.

As for the first: Prolog is generally considered an AI language because it provides an easy way to write search routines. Prolog's native control flow is a depth-first search. It's cool, but AI does not begin and ends with a simple search loop. I would recommend that you learn AI techniques in a language-independent way, and then decide if Prolog will help you for your specific needs. It fits like a glove for some things, and does not fit at all for other things.

I'm a big fan of Prolog and I've done a good deal of Prolog hacking. However, Prolog is not a silver bullet for AI problems. It's simply a language in which writing search routines is simpler, that's all.

Little Bobby Tables
  • 5,261
  • 2
  • 39
  • 49
  • That's cool, but I am in a way forced to use prolog xP. But since you are a big fan, how did the language affect your way of thinking when you see a (programming?) problem? =) – Mazyod Feb 05 '11 at 15:22
  • Prolog did not affect my general programming - When I see a problem that combines data and functionality I still think about object orientation. W.r.t AI, Prolog gives you discipline when it comes to formulating search problems. If you can phrase the problem in terms of finding an assignment to a set of variables, you got a Prolog program to solve it, hence you immediately benefit from doing things the right way. Also, since that the default behavior of Prolog is to give you all the answers, you get more intuition about what a search space is. – Little Bobby Tables Feb 06 '11 at 08:11
3

The very short answer here is no, the two issues are totally unrelated. There is no benefit at all to your career..

it's that simple.

The excellent answer from Bobby Tables gives you lots of info.

  1. I really don't see any evidence that "Prolog" is central to the ongoing quest for AI in computing devices. If you said, in general (completely forget about the iPhone issue), "I want to be an AI researcher" I don't particularly see that you would rush to learn Prolog.

  2. I can think of a number of well-known iPhone apps that use some form of lite AI (as the phrase is often used in the "AI-in-games" sense). In each of those apps, there is utterly no connection whatsoever to Prolog. in any way, at all.

  3. FWIW (not much) I spend a few days a month "writing AI on the iPhone/Mac" and I for example have never been a Prolog programmer and have no connection to it at all.

it's worth noting that

  1. Saying "AI" is an impossibly broad field. Could you be more specific about what you want to do?

Who's your A.I. hero? Rod Brookes? What sort of "AI" interests you?

Hope it helps! The simple answer here is "no", you're on the wrong track.

Fattie
  • 27,874
  • 70
  • 431
  • 719
  • Hmmm, yes indeed, it helps. But wouldn't learning AI using Prolog be some sort of a door step into the broad AI world? And I can at least get the concepts down from learning AI using Prolog... And I am REALLY sorry, I should have said this 10 hours ago: This is an elective course at college =P. I am not forced to take it, but I can. So, after knowing this, and that I will be building games on the iPhone, will it be useful? =) – Mazyod Feb 05 '11 at 16:24
  • I assume you are about 20 years old. If you are already an **incredibly good programer** (i.e you've been doing it since you were 13), take the course to find out more about more stuff. Otherwise it's a waste of time. Use your time to become better at programming, focus on one thing, objective C. Get really good at one thing before worrying about others!!! – Fattie Feb 05 '11 at 16:34
  • Well, am not an incredibly good programmer xD, but I am not bad either.. But I guess I'll take the course. At least this course could help in some way (I think you said that implicitly..). Anyways, Thanks! (Although ppl think that bobby was more useful?) – Mazyod Feb 05 '11 at 19:37
2

The Prolog variation of Greenspun's 10th rule answers your question. A question which is broad enough to receive both "Yes it will benefit you as an iPhone developer" and "No it will not". The truth of the matter is that as you dive into Prolog (or any other new to you programming paradigm) you will benefit as a programmer, but the way you will benefit out from it is not predictable neither by you or by anybody else.

adamo
  • 3,584
  • 1
  • 18
  • 23
1

I have no experience concerning iPhone development.

I don't think that you will be able to employ Prolog when developing for iPhone. But since Prolog is declarative logic programming you will learn to think differently and this will be a benefit to you as a programmer in general.

Edit

Using Prolog is a completely different from of programming than the usual procedural way. It's similar to how functional programming (which seems to be somehow hip currently) is different, too.

By solving problems in a different way (or by being forced to solve them in differently) you get a better understanding of what programming/solving problems is about. You'll write better Objective C code after learning Prolog or Lisp.

Concerning academic AI: I suggest learning a functional language instead of Prolog, since Prolog is kind of a niche programming language suited for very special problems. The functional languages are a bit more all-round.

ziggystar
  • 28,410
  • 9
  • 72
  • 124