Adventures in tech 

Home Courses AI @DEIS And the winner is….
formats

And the winner is….

As I mentioned earlier, I am attending an AI course at my faculty, and today’s class was in the lab. What I didn’t mention is that the suggested textbook is AIMA, and today I discovered that we would be using the AIMA library in the lab. Our very kind TA, Eng. Federico Chesani introduced us to three problems that we could try and solve with the help of the library. Our goal then was not to implement search strategies, which can be found in the library, but rather to deal with status representation, goal testing, heuristics and termination conditions.

The three problems were:

The uber-famous MCP, aka Missionaries and Cannibals

Image from Millan.net

Three missionaries and three cannibals come to a river and find a boat that holds two. If the cannibals ever outnumber the missionaries on either bank, the missionaries will be eaten.

How shall they cross?

You can even find a playable version here

A grid-filling problem

Image from the iTunes preview of Logic 10x10

In this problem you have to fill a 10×10 grid with numbers from 1 to 100 according to a few rules: the next number can be only 2 cells away in horizontal or vertical direction, or 1 cell away in a diagonal direction.

The only reference I found is this iPad game, called logic 10×10. If anyone has a better reference, I’ll be glad to know.

The U2 concert problem

How can we cross this bridge in time?

The concert starts in 17 minutes, but we need to cross a bridge, at most two of us can walk through it at a time. Bono can walk fast and can cross the bridge in 1 minute, the Edge almost as fast, in 2 minutes, for Adam it takes 5 minutes but Larry is really slow, 10 minutes to cross the bridge…

I’ve made a bit of search and found that this is a lesser known problem than the first two, but still it’s not really new. I found this article that refers to it. Actually, in our version there was a requirement that said that people had to cross in 17 minutes, while the original problem asks you what is the minimum time, so it was a bit different.

Then our TA put us in a competion: “you have an hour and 15 minutes to complete this. The first person or group that finishes wins pasta and cappuccio (*)  tomorrow morning”. He also added some fun remarks about the fact that he’s older than the students and that when you get old lots of your neurons have already died but the students are young and they had to but their brains at work.

Hey, wait a minute. You, dear TA, you’re younger than me! Maybe just by a few months, but you’re younger! Which means I have less neurons alive than you, and much much less than my fellow classmates… am I really impaired in this competition???

I’ll show you better!

And so I started moving my fingers at lightning speed on the keyboard… and finished first! Eleven minutes before the deadline :-) On a side note, I probably must say that after 16 years of java coding, and I don’t know how many using Eclipse, I might have a *slight* advantage in the code-typing speed… but hey, I have to do with less neurons!

If you’re interested, you can download the code. You will also need the aima 0.95 library (the lecture slides were written for that version). It’s *awfully* written, almost zero comments and very poor practices… but the competition required me to hurry!

If you can read Italian, here you’ll find the slides and specification of the problems.

* Pasta is not what you think of, it’s not spaghetti: in this context, it means a piece of pastry, or brioche. And cappuccio is cappuccino. Tomorrow morning I’ll have a nice breakfast!

Tomorrow morning's breakfast... yum!

 
 Share on Facebook Share on Twitter Share on Reddit Share on LinkedIn
No Comments  comments 

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Anna Chiara Bellini 2012-2013