All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Logic
X Marks the Spot (Posted on 2007-05-02) Difficulty: 4 of 5
With the exception of the letter L, each letter of the alphabet is to be placed once in the grid at the lower left. Consecutive letters of the alphabet cannot be adjacent in any direction, not even diagonally. The X has been added to get you started.

Every blue/yellow cell in the upper left grid shows the sum of the numerical values of the letters which appear in the adjoining yellow/blue cells of the lower left grid. So, for example, the 40 in cell 5E, might mean that Z and N (or Y and O) are to be placed in cells 5D and 4E.

The letters and numbers written outside the 5x5 grids serve no purpose, except to identify cells.

A

B

C

D

E

1

A

14

N

1

22

16

47

18

31

2

B

15

O

2

18

67

22

72

25

3

C

16

P

3

66

25

87

30

50

4

D

17

Q

4

31

95

29

82

31

5

E

18

R

5

49

34

66

29

40

6

F

19

S

7

G

20

T

A

B

C

D

E

8

H

21

U

1

9

I

22

V

2

X

10

J

23

W

3

11

K

24

Y

4

12

25

X

5

13

M

26

Z

See The Solution Submitted by Josie Faulkner    
Rating: 4.4615 (13 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Computer Solution | Comment 7 of 14 |

Numerically

 7  3  8 20  6
19  1 24  4 11
10 21  9 17 15
26  5 25  2 22
16 23 13 18 14

and as letters

GCHTF
SAXDK
JUIQO
ZEYBV
PWMRN
 

The program didn't take into consideration the non-adjacency, which apparently wasn't needed as the above solution was the only one found, even without this restriction; but it does meet that restriction, so it was more of a hint than a requirement. Numeric values are kept throughout until a letter translation is given of the solution.

The program was speeded by the fact that only the top row is arbitrary (another row or column could have been chosen, but I chose this). Each entry in subsequent rows is dictated by the row before so as to make the sum correct in the grid position immediately above, taking into consideration the other 1, 2 or 3 numbers around it already assigned. If a number that's already used is required, then that whole sequence of moves dependent on row 1 is invalid.

DECLARE SUB place (row!, col!)
CLEAR , , 9999

DIM SHARED board(6, 6)
DIM SHARED tots(5, 5)
DIM SHARED taken(26)

taken(12) = 1

DATA 22,16,47,18,31
DATA 18,67,22,72,25
DATA 66,25,87,30,50
DATA 31,95,29,82,31
DATA 49,34,66,29,40

FOR r = 1 TO 5
FOR c = 1 TO 5
  READ tots(r, c)
NEXT
NEXT

place 1, 1

SUB place (row, col)
  IF row = 2 AND col = 3 THEN
    IF board(1, 3) + board(2, 2) > 22 THEN EXIT SUB
    board(row, col) = 24
    c = col + 1: r = row
    IF c > 5 THEN r = r + 1: c = 1
    place r, c
    EXIT SUB
  END IF
  IF row < 5 AND col < 5 THEN
    IF board(row - 1, col) + board(row, col - 1) > tots(row, col) - 3 THEN EXIT SUB
  END IF
  IF row > 1 THEN
    v = tots(row - 1, col) - board(row - 2, col) - board(row - 1, col - 1) - board(row - 1, col + 1)
    IF v = 24 OR v < 1 OR v > 26 THEN EXIT SUB
    IF taken(v) = 0 THEN
      taken(v) = 1
      board(row, col) = v

      IF row = 5 AND col = 5 THEN
       FOR r = 1 TO 5
       FOR c = 1 TO 5
        PRINT USING "## "; board(r, c);
       NEXT: PRINT
       NEXT: PRINT
       FOR r = 1 TO 5
       FOR c = 1 TO 5
        PRINT MID$("ABCDEFGHIJKLMNOPQRSTUVWXYZ", board(r, c), 1);
       NEXT: PRINT
       NEXT: PRINT
      ELSE
       c = col + 1: r = row
       IF c > 5 THEN r = r + 1: c = 1
       place r, c
      END IF

      board(row, col) = 0
      taken(v) = 0
    ELSE
      EXIT SUB
    END IF
  ELSE
    FOR v = 1 TO 26
     IF col = 1 THEN PRINT col, v
     IF v <> 24 AND taken(v) = 0 THEN
       board(row, col) = v
       taken(v) = 1

       c = col + 1: r = row
       IF c > 5 THEN r = r + 1: c = 1
       place r, c

       taken(v) = 0
       board(row, col) = 0
     END IF
    NEXT
  END IF
END SUB

 


  Posted by Charlie on 2007-05-03 09:46:01
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (14)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information