# A Quote from what Movie?

Heads up: It's possible to solve this puzzle without writing computer code, but it is intended to be solved with computer help.

This is a 2-stage puzzle.

## Stage 1: Calculation Puzzle

Rules:
1. You must start at A and end at P.
2. You may not visit a cell more than once.
3. You must travel along the pathways, which go horizontally, vertically, and diagonally.
4. A path need not visit every cell (but it can).

Find 8 paths from A to P. The final values for each of the 8 paths must equal one of these values:

1,600  1,800  1,900  2,300  2,400  3,600  4,500  5,000

A couple examples of valid paths, and their values in bold:

1. AFKP = ((5+4)+8) = 17
2. AFKHGLP = (((((5+4)+8)x6)x7)-1) = 713

## Stage 2: Word Find

Once you find the 8 paths, group them by path length and sum the values for the paths in each group. This will give you 4 numbers (since there are 4 groups). These numbers are hints to find the words in the grids below. Each grid contains one word.

Can you finish the movie quote and tell us what movie it is from?

• Not sure if this puzzle would better fit here: codegolf.stackexchange.com – leoll2 Apr 23 '15 at 16:04
• I am unsure of how adding together two 4 digit numbers will help with the grids when they have only 2-3 digit numbers in them? – Mark N Apr 23 '15 at 16:08
• @leoll2 Maybe, but my last coding puzzle did get a few votes: puzzling.stackexchange.com/questions/11475/a-tour-of-36-cities The coding is needed only for Stage 1 of the puzzle. – JLee Apr 23 '15 at 16:09
• @MarkN That's part of the stage 2 of the puzzle. I don't wanna say too much and give it away. – JLee Apr 23 '15 at 16:12
• @leoll2: this puzzle does not ask for a program using the fewest number of bytes in a variety of languages. Code Golf (as you might imagine from its name) has this requirement. This puzzle is simply a puzzle that is best solved with computer assistance so as to not drive you crazy iterating through all possibilities by hand. – Ian MacDonald Apr 24 '15 at 0:34

I've got it :-)

The movie is:

and the quote is:

# Solution method:

### Stage 1:

I wrote a solver in C to figure out the paths corresponding to each sum. It takes about 0.1 seconds to output the following results:

1600: L=13     1800: L=14     1900: L=15     2300: L=16
1  2  0  0     1  3  4  5     1  3  4  6     1  8  9 10
9  3  4  5     0  2  6 11    11  2  5  7     7  2  3 11
10  8 12  6     8  7 10 12    12 10 14  8     6  4 15 12
0 11  7 13     0  9 13 14     0 13  9 15     5 14 13 16

2400: L=13     3600: L=15     4500: L=14     5000: L=14
1  9  8  7     1  8  9 11     1  7  6  0     1  7  8  0
2 10 11  6     7  2 12 10     8  2  4  5     0  2  6  9
0  3  5 12     6  3 13  0     9  3  0 13     3  5 13 10
0  4  0 13     5  4 14 15    10 11 12 14     4 12 11 14


After grouping by length and adding together the values corresponding to each path length, I obtained the following:

Length=13: 4000  (1600+2400)
Length=14: 11300 (1800+4500+5000)
Length=15: 5500  (1900+3600)
Length=16: 2300


(Actually I went off on a tangent at this point because I thought we were supposed to add up the values of the cells visited on each path. That turned out to be a dead end.)

### Stage 2:

With a bit of help from onlineocr.net, I converted the number tables into plain text and wrapped a Python program around them. Based on a hunch, this program tests for numbers that are proper factors of the sums obtained in Stage 1. For example, in the first table, where 4000 is the number provided as the hint, the first two numbers 500 and 10 both divide 4000, but the third number 530 does not.

• @JLee Done. I really enjoyed this puzzle. Thanks for posting it here :-D – squeamish ossifrage Apr 25 '15 at 22:41
• Excellent. Glad you enjoyed it. Btw, thank you for translating the A Code from the Lines puzzle from the written version. I would never have attempted it otherwise. – JLee Apr 25 '15 at 23:02