in reply to Solving Puzzles

    I don't have any strategies to begin with.

Therein lies the rub. Remember, Perl is a programming language. And programs are simply lists of instructions. You have to figure out what that list is going to be. In order to write a script to help solve a problem, you need to develop a strategy and then convert it into perl code and test.

Let's take your example above, you can quickly write a Perl program that uses a 2D array to represent the rectangle and then simply write some code that will brute-force every possible combination of "L" shapes in it. This works fine when your grid is small and rectangular, but what happens if it gets larger and/or is oddly shaped. Suddenly, processing time goes through the roof.

You have to do a couple by hand, and analyze your thought process. You want your Perl program to use that same process or similar one. Remember, computers are fast so they can trade off some iteration for heavy logic pretty easily. The key is to break down your solution into logical steps so they can be expressed in a program.

Now I'm assuming you want to stick to Perl for your language. Once the complexity of problems goes up, you may get benefits from switching to a language for suited for AI type work such as Lisp. But in the end, you'll have to figure out strategies for your problems so you can give your solution scripts an advantage when they attempt to tackle the problems.

HTH

Replies are listed 'Best First'.
Re: Re: Solving Puzzles
by DrHyde (Prior) on Jul 28, 2003 at 10:53 UTC
    >>I don't have any strategies to begin with.
    >Therein lies the rub.
    Not necessarily. Genetic algorithms, anyone?