# Math Help - 4x4 Grid Puzzle

1. ## 4x4 Grid Puzzle

Hello. Here is a puzzle that could interest YOU!

A 4x4 grid contains letters from A-I.
Each of those letters represents only 1 number of 9 (1-9).
Each number can only be represented by 1 letter.
At the end of each column and row is the sum of the numbers that are represented by the letters in those columns or rows.
It is your job to decipher which letters represent which numbers.

Here's an example puzzle:

Here's the/an answer to the above puzzle:

Here's another one for you to do/post the answer for:

Now, here's what I really want to know; can anyone come up with a logical way of solving one of these puzzles? I'm trying to program Microsoft Excel to solve it for me (to pair with the random puzzle generator I've programmed) but the only way I can think of is to look through all of the 9*8*7*6*5*4*3*2 combinations of letter to number representations and identifying which combination/s (could be multiple) would fit for any puzzle (something that Excel does not have the capacity to handle).

Something you may need to know is that all the letters must be present on the grid in any puzzle and the remaining 7 squares are filled with random letters (which are also randomly located amongst the 16).

-Much obliged. I hope you enjoy thinking about this. I will seriously be impressed if somebody thinks of a method of solving any puzzle.

2. Originally Posted by Obsidantion
Hello. Here is a puzzle that could interest YOU!

A 4x4 grid contains letters from A-I.
Each of those letters represents only 1 number of 9 (1-9).
Each number can only be represented by 1 letter.
At the end of each column and row is the sum of the numbers that are represented by the letters in those columns or rows.
It is your job to decipher which letters represent which numbers.

Here's an example puzzle:

Here's the/an answer to the above puzzle:

Here's another one for you to do/post the answer for:

Now, here's what I really want to know; can anyone come up with a logical way of solving one of these puzzles? I'm trying to program Microsoft Excel to solve it for me (to pair with the random puzzle generator I've programmed) but the only way I can think of is to look through all of the 9*8*7*6*5*4*3*2 combinations of letter to number representations and identifying which combination/s (could be multiple) would fit for any puzzle (something that Excel does not have the capacity to handle).

Something you may need to know is that all the letters must be present on the grid in any puzzle and the remaining 7 squares are filled with random letters (which are also randomly located amongst the 16).

-Much obliged. I hope you enjoy thinking about this. I will seriously be impressed if somebody thinks of a method of solving any puzzle.
Isn't it just a system of equations?

3. Solution is whited out for the people who still want to try!

A = 1
B = 4
C = 8
D = 6
E = 7
F = 3
G = 9
H = 2
I = 5

4. Mathstud28: Please elaborate for me. Thanks.

shinhidora: Woah! Demon speed! Could you take the method you used and turn it into a logical sequence that would solve any puzzle?

5. Originally Posted by Obsidantion
Mathstud28: Please elaborate for me. Thanks.

shinhidora: Woah! Demon speed! Could you take the method you used and turn it into a logical sequence that would solve any puzzle?
Just think about it as a series of equations

For the first one

$E+G+F+I=22$
$2G+F+H=18$

Now if you keep going until you have set up every row and colum as an equation you can put this into any decent computer system as a matrix and it will solve it for you quicker than you could blink.

6. Make a system to solve any puzzle? Can't be too hard...

I could make a system with warcraft 3 world editor xD

Imagine...

A B C D Q
E F G H R
I J K L S
M N O P T
U V W X

A till P being your values
Q till X being your solutions

Set A = 0
Set B = 0
...
Set P = 0
If
A+B+C+D = Q
E+F+G+H = R
...
D+H+L+P = X
Do
Display: Value for Q, Value for R, ... , Value for X
Else
Set A = 1
Set B = 0
...
Set P = 0

And so on...

Edit: If it wouldn't 've been exams I would've written you the entire and correct code

Edit2: I'll try to write it in the coming weekend...

This is made using the GUI-editor of Warcraft 3 (it's a game and the only language I can program in xD)

What this does...

It creates integer variables from A till X. It starts calculating each equation. If the equations don't match, it changes the variables for each integer until the equations match. When they match, it displays the value for each variable.

Code:
    Events
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(A + (B + (C + D))) Equal to Q
(E + (F + (G + H))) Equal to R
(I + (J + (K + L))) Equal to S
(M + (N + (O + P))) Equal to T
(A + (E + (I + M))) Equal to T
(B + (F + (J + N))) Equal to V
(C + (G + (K + O))) Equal to W
(D + (H + (L + P))) Equal to X
Then - Actions
Game - Display to (All players) the text: (String(A))
....
Game - Display to (All players) the text: (String(X))
Else - Actions
Set A = 1
Set B = 0
Set C = 0
Set D = 0
Set E = 0
Set F = 0
Set G = 0
Set H = 0
Set I = 0
Set J = 0
Set K = 0
Set L = 0
Set M = 0
Set N = 0
Set O = 0
Set P = 0
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(A + (B + (C + D))) Equal to Q
(E + (F + (G + H))) Equal to R
(I + (J + (K + L))) Equal to S
(M + (N + (O + P))) Equal to T
(A + (E + (I + M))) Equal to T
(B + (F + (J + N))) Equal to V
(C + (G + (K + O))) Equal to W
(D + (H + (L + P))) Equal to X
Then - Actions
Game - Display to (All players) the text: (String(A))
....
Game - Display to (All players) the text: (String(X))
Else - Actions
Set A = 1
Set B = 1
Set C = 1
Set D = 0
Set E = 0
Set F = 0
Set G = 0
Set H = 0
Set I = 0
Set J = 0
Set K = 0
Set L = 0
Set M = 0
Set N = 0
Set O = 0
Set P = 0

And so on and on until finally...

If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(A + (B + (C + D))) Equal to Q
(E + (F + (G + H))) Equal to R
(I + (J + (K + L))) Equal to S
(M + (N + (O + P))) Equal to T
(A + (E + (I + M))) Equal to T
(B + (F + (J + N))) Equal to V
(C + (G + (K + O))) Equal to W
(D + (H + (L + P))) Equal to X
Then - Actions
Game - Display to (All players) the text: (String(A))
....
Game - Display to (All players) the text: (String(X))
Else - Actions
Set A = 9
Set B = 9
Set C = 9
Set D = 9
Set E = 9
Set F = 9
Set G = 9
Set H = 9
Set I = 9
Set J = 9
Set K = 9
Set L = 9
Set M = 9
Set N = 9
Set O = 9
Set P = 9

7. Mathstud28: My aim is to actually program the computer system (Excel functions) to solve the equations. Any idea how it might do that?

shinhidora: If I understand you correctly, you are suggesting I cycle through all the possible combinations of values that the letters could have until I find a combination that will fit into the puzzle, which is too cumbersome for Excel (It doesn't have a repeat function).

8. Originally Posted by Obsidantion
Mathstud28: My aim is to actually program the computer system (Excel functions) to solve the equations. Any idea how it might do that?

shinhidora: If I understand you correctly, you are suggesting I cycle through all the possible combinations of values that the letters could have until I find a combination that will fit into the puzzle, which is too cumbersome for Excel (It doesn't have a repeat function).
It's the only way I can think of... you really need some kind of loop or repeat function to solve this, I think.