Using all integers from 1 to 20, assign them into a 5 by 4 grid so that adjacent numbers (horizontally, vertically and diagonally) will differ by at least 4.
(In reply to
re(2): computer solutions by Brian Smith)
When the corresponding line in the original program is changed to
If Abs(newnum - grid(row + dr, col + dc)) < 5 Then bad = 1: Exit For
The program quickly goes through the possibilities and finds no solution where there is a difference of at least 5.
|
Posted by Charlie
on 2016-02-14 20:05:51 |