Home

t3knomanser's Fustian Deposits

More drek than you can pull from an elephant's arse.

How Random Babbling Becomes Corporate Policy

IOCCC Original Winner

Mad science gone horribly, horribly wrong(or right).

November 24th, 2008

Homework

Add to Memories Tell a Friend
IOCCC Original Winner
Part of my interest in Prolog has come about because I've decided to learn a bit about AI programming. Prolog is popular for that, although the book I'm using to learn from has more of an OOP bias. That book, by the way, is Artificial Intelligence: A Modern Approach. Good book, so far. The topics are broad primers for all the major areas of AI work, which is exactly what I was looking for.

In any case, this is my first major programming "assignment" out of the book. A basic environment simulator to house a simple reflex agent. A simple reflex agent is the simplest approach to AI one can take- look at the world around me and decide on an action to take. Simple reflex, because it doesn't have any memory, or take any steps to model the world. It just looks around and does something. It doesn't have any ability to formulate goals or even find an optimal path to its desired goal.

It's an interesting bit of Prolog code, and it really shows off many of the major features of the language. Heavy use of recursion, tail-call optimizations, and even a prolog-esque approach to making it vaguely object oriented. Lists, some basic IO calls. The whole kit-n-kaboodle.

I'm kinda proud of it, largely because this lays a decent enough framework for a lot of the future exercises from my AI book.

November 23rd, 2008

Introduction to this Tutorial

A bit ago, I ranted about tail call recursion and talked a bit about Prolog- a programming language that relies heavily on recursion, and hence benefits from tail call recursion. Buried in the CompSci complexities, I promised a tutorial on Prolog targeted towards non-programmers.

This is that tutorial. Whether you've programmed or not before, I am going to do everything I can to make this tutorial accessible to the average person. I strongly believe that everyone can write programs, and that everyone would benefit from learning a little about it. Between the technical skills, the problem solving-skills, and the general "cool" factor1, it's a good skill for everyone to pick up.
This is a long-un )
In this lesson, we discussed what a program is, and mentioned a few of the different varieties of programming languages. We set up our computer to run Prolog, and now we've looked at a simple Prolog program.


1Programmers are cool, right? I think so, but my opinion has a bit of bias.
2There's a hypothetical computer known as a Turing Machine. Alan Turing proved, mathematically, that his hypothetical computer could solve a certain broad class of mathematical problem. Any programming language that can solve those problems is known as "Turing Complete". Nearly all languages in common use are "Turing Complete". This means they can all do the same things, in a general sense. But they may be better at one task than another language.

November 8th, 2008

I want to make coffee. To do that, I need to put six scoops of coffee into our french press. If I were writing this repeated effort as a program, I could do it in two different ways: iteratively or recursively.
The contents of this post involve recursion, and may not be suitable for minors )I've been learning Prolog with an eye towards learning a bit about AI design, and I learn best by teaching. And that means I intend to take you with me.

I'm going to start a round of Prolog tutorials to explain the basics of programming. I'll start from the ground up, which means you don't need to know anything about programming to get into them. All you need to do is download a Prolog interpreter, and for my examples, I recommend SWI Prolog. It comes with an integrated text editor that makes it very easy to try out programs and query them.
Powered by LiveJournal.com