CS470/570  Artificial Intelligence

Program #1:  Fred Flintstone problem-solving
(a.k.a.  Warming up our Python mojo)

Overview: 

There's nothing intrinsically different or magical about AI programming; it's all just software...only it just happens to be specialized towards certain analytic orientations, algorithms, and problem-solving goals.   Well heck, you're all rock-star programmers, right?  So let's get that programming mojo warmed up with a little basic problem-solving challenge!

I'm calling this "Fred Flintstone problem-solving" because it's just that:  we know nothing at this early point in the course, so we can offer only completely off-the-cuff, uninformed, "naive" solving of a problem.  As we move forward, we'll soon develop a broader understanding of the intellectual "terrain" surrounding problems like these:  what we are really doing, what the alternative solution approaches in this terrain are, and how to think about what will work best.  But for now, we're just going to get out our caveman club and flail away... and then grunt happily when we get a solution!

 

 

Description: oggle.jpgThe Problem:

In this first small programming exercise, we will consider how we can solve Boggle. If you haven't played in awhile, here's the gist of the game: There are 16 cubes with letters on the faces. These cubes are randomly arranged in a 4x4 matrix by shaking the boggle game. The goal of the game is to make words out of these letters by traversing adjacent (horizontal, vertical or diagonal) tiles.  This "chain" of letters may snake all over the board, but you can only use each tile once, i.e., no fair using the same letter twice in a word. In a fixed amount of time players must make as many words as possible. Words are then scored as follows: 1 point for each 3-4 letter word, 2 points for a 5-letter word, 3 points for a 6-letter word, 5 points for a 7-letter word, 11 points for a 8 (or more)-letter word.

The Assignment:

In this problem, you are asked to solve Boggle boards exhaustively: given a particular boggle board as input, your algorithm should enumerate all possible words that can be found in that Boggle board. 

The dictionary we will use for our game of Boggle is the Tournament Scrabble Wordlist which includes 178,691 words.  I've cleaned up and provided a file of dictionary words for you here.

Your program should read in a dictionary and an NxN boggle board as command-line arguments (e.g., python boggle.py dict.txt board.txt).  It should then discover all possible words existing in the given board and print out a summary of its findings. 

Detailed points:

This is not a particularly hard problem...provided you think it through! (Hint: elegance, recursion).  Just as a reference point:  my solution has one main function of about 15 lines, three smaller helpers to load/print out boards and stuff.  Without comments, the whole thing fits on a page.   

Your write-up: 

  1. In addition to your code and solution print-outs, you'll need to provide a nice write-up of your solution.  Your write-up should be professionally neat and must include:
  2. A brief description of your solution approach/strategy.   You don't need to dissect all of your functions etc. here.  What I want is for you to describe your algorithm abstractly:  how is it that your program goes about solving the problem.
  3. Answers to the following questions:

To turn in:

A professional packet with the following items in exactly this order:

  1. Cover sheet:  Name, course, assignment title, date
  2. Your write-up, typed up, cleanly formatted.
  3. Printout of your program output running the boards given in the first sample file.
  4. Printouts of your program running the dynamically assigned boards. THIS LINK to the testing boards will be activated shortly before the due time.
  5. Your fully-commented  code (maybe be duplex printed).