# Homework 1

### Puzzle:

(Taken from Russell and Norvig, 1995)

This puzzle consists in finding a substitution of the letters F, O, R, T, Y, E, N, S, I, X by digits such that when each of these letters is replaced by the corresponding digit, the following sum is still arithmetically correct.

FORTY
+ TEN
+ TEN
-----
SIXTY

This puzzle has solutions. One of them is

F = 2, O = 9, R = 7, T = 8, Y = 6, E = 5, N = 0, S = 3, I = 1, X = 4

since:

29786
+ 850
+ 850
-----
31486

is arithmetically correct. Solutions to the puzzle should not repeat digits.

### Homework 1

INDIVIDUAL homework due Thursday, Sept. 11, 1997 at 1:30 pm.

1. Write a computer program (preferably in Lisp, but C or scheme are also allowed for this assignment) that implements the generate-and-test strategy to solve this puzzle.
• Your program must satisfy the following conditions:
• It should find at least one solution to the puzzle.
• The generator must be
• complete, and
• non-redundant
• You will receive extra credit if:
• your program produces a solution to the puzzle different to the one given above. (Extra points for each additional correct solution found).

2. You need to hand in the following material by 1:30 p.m. Thursday, Sept. 11, 1997:
• A print out of:
• A (mathematically sound) proof that your generator is:
• complete, and
• non-redundant
• A precise count of how many different candidate solutions your generator would produce before exhausting all possibilities.
• For the extra credit you need to include also:
• A mathematically sound proof that your generator is informed.

• You can find Ibuki Common Lisp (ibcl), Kyoto Common Lisp (kcl), or Scheme (scheme) on the CCC machines.

• Also, you can find the text software in the /cs/cs4341/ directory of the CCC machines. You are welcome to look at the code contained there but you cannot use it in your assignments. YOU MUST DEVELOP YOUR OWN CODE!!

• To run Kyoto Common Lisp in the CCC machines:

• Type: kcl

• You will get the message

"AKCL (Austin Kyoto Common Lisp) Version(1.609) Thu Mar 12 17:14:07 EST 1992 Contains Enhancements by W. Schelter"

followed by a prompt: " > "

• Type: (help)
to obtain help.

• Type: (bye)
to exit the shell.