Here is one solution I came up with. I have seen at least two other valid yet different solutions, so this is by no means the only valid answer.
U = unknown stone
N = known 'normal' stone.
H = Heavy
L = Light
WEIGH [U,U,U,U] against [U,U,U,U]
IF scales balance:
LABEL weighed stones N
LABEL remaining four stones a,b,c,d
WEIGH [a,b] against [c,N]
IF scales balance:
WEIGH [d] against [N]
IF scales tip towards [d] -> SOLUTION (d = H)
ELSE (scales tip towards [N]) -> SOLUTION (d = L)
ELSIF scales tip towards [a,b]:
WEIGH [a] against [b]
IF scales balance -> SOLUTION (c = L)
ELSIF scales tip towards [a] -> SOLUTION (a = H)
ELSE (scales tip towards [b]) -> SOLUTION (b = H)
ELSE (scales tip towards [c,N]):
WEIGH [a] against [b]
IF scales balance -> SOLUTION (c = H)
ELSIF scales tip towards [a] -> SOLUTION (b = L)
ELSE (scales tip towards [b]) -> SOLUTION (a = L)
ELSE:
LABEL unweighed stones N
LABEL 'heavier' weighed stones e,f,g,h
LABEL 'lighter' weighed stones i,j,k,l
WEIGH [e,f,i] against [g,j,N]
IF scales balance:
WEIGH [k] against [l]
IF scales balance -> SOLUTION (h = H)
ELSEIF scales tip towards [k] -> SOLUTION (l = L)
ELSE (scales tip towards [l]) -> SOLUTION (k = L)
ELSIF scales tip towards [e,f,i]:
WEIGH [e] against [f]
IF scales balance -> SOLUTION (j = L)
ELSEIF scales tip towards [e] -> SOLUTION (e = H)
ELSE (scales tip towards [f]) -> SOLUTION (f = H)
ELSE (scales tip towards [g,j,N]:
WEIGH [g] against [N]
IF scales balance -> SOLUTION (i = L)
ELSE (scales tip towards [g]) -> SOLUTION (g = H)
Note that the solution space does not include all possible states for all twelve stones, because labelling is performed after the first weigh, which excludes some combinations.
Details:
========
========
12 stones, labelled a-l, such that any one single stone may be the different one - heavier (H) or lighter (L) than a 'normal' (N) stone.
a b c d e f g h i j k l
N N N N N N N N N N N N
H H H H H H H H H H H H
L L L L L L L L L L L L
* WEIGH(1) any eight stones:
N N N N N N N N
H H H H H H H H
L L L L L L L L
-------------------
^
There are two possible outcomes:
A: The scales balance, leaving FOUR unknown and EIGHT normal stones.
N N N N N N N N N N N N
------------------- + H H H H
^ L L L L
B: The scales tip, leaving FOUR possible N or H, FOUR possible N or L and FOUR normal stones.
N N N N N N N N
H H H H L L L L
_________.--------- + N N N N
^
Scenario A:
===========
- relabel unknown stones a-d
- FOUR unknown and EIGHT normal stones:
a b c d
N N N N N N N N N N N N
H H H H
L L L L
* WEIGH(2) stones a-c with one normal stone:
a b c
N N N N
H H H d
L L L N
------------------- + H
^ L
There are three possible outcomes:
AA: The scales balance, leaving ONE unknown stone d.
a b c d
N N N N N
------------------- + H
^ L
AB: The scales tip towards a & b, leaving THREE unknown stones a,b,c.
a b c
N N N N
H H L d
_________.--------- + N
^
- a & b cannot be L
- c cannot be H
- d is known to be normal.
AC: The scales tip towards c, leaving THREE unknown stones a,b,c.
a b c
N N N N
L L H d
---------._________ + N
^
- a & b cannot be H
- c cannot be L
- d is known to be normal.
Scenario AA:
============
- ONE unknown stone and ELEVEN normal stones:
a b c d
N N N N N N N N N N N N
H
L
* WEIGH(3) stone d against a normal stone:
d
N N
H
L
-------
^
- if scales tip towards d => d is H
- if scales tip towards N => d is L
Scenario AB:
============
- THREE unknown stones and NINE known stones:
a b c d
N N N N N N N N N N N N
H H L
* WEIGH(3) stone a against b:
a b
N N
H H
-------
^
- if scales balance => c is L
- if scales tip towards a => a is H
- if scales tip towards b => b is H
Scenario AC:
============
- THREE unknown stones and NINE known stones:
a b c d
N N N N N N N N N N N N
L L H
* WEIGH(3) stone a against b:
a b
N N
L L
-------
^
- if scales balance => c is H
- if scales tip towards a => b is L
- if scales tip towards b => a is L
Scenario B:
===========
- relabel unknown stones e-l
- FOUR possible N/H, FOUR possible N/L and FOUR normal stones:
e f g h i j k l
N N N N N N N N N N N N
H H H H L L L L
* WEIGH(2) e,f,i,g,j and ONE normal stone:
e f i g j
N N N N N N
H H L H L h k l
------------------- + N N N
^ H L L
There are three possible outcomes:
BA: The scales balance, leaving THREE unknown stones h,k,l:
e f i g j
N N N N N N
h k l
------------------- + N N N
^ H L L
- e,f,i,g,j must be normal
BB: The scales tip towards e,f,i, leaving THREE unknown stones e,f,j:
e f i g j
N N N N N N
H H L h k l
_________.--------- + N N N
^
- h,k,l must be normal
- i cannot be L
- g cannot be H
BC: The scales tip towards g,j, leaving TWO unknown stones i,g:
e f i g j
N N N N N N
L H h k l
---------._________ + N N N
^
- h,k,l must be normal
- e,f cannot be H
- j cannot be L
Scenario BA:
============
- ONE possible N/H and TWO possible N/L
e f g h i j k l
N N N N N N N N N N N N
H L L
* WEIGH(3) k,l:
k l
N N
L L
-------
^
- if scales balance => h is H
- if scales tip towards k => l is L
- if scales tip towards l => k is L
Scenario BB:
============
- TWO possible N/H and ONE possible N/L
e f g h i j k l
N N N N N N N N N N N N
H H L
* WEIGH(3) e,f:
e f
N N
H H
-------
^
- if scales balance => j is L
- if scales tip towards e => e is H
- if scales tip towards f => f is H
Scenario BC:
============
- ONE possible N/H and ONE possible N/L
e f g h i j k l
N N N N N N N N N N N N
H L
* WEIGH(3) g and ONE normal stone:
g
N N
H
-------
^
- if scales balance => g must be N, so i is L
- if scales tip towards g => g must be H
Comments are, of course, welcome.
1 comment:
Well done! Excellent work! I applaud you!
Post a Comment