Word search

From Rosetta Code
Revision as of 00:40, 26 March 2016 by rosettacode>Fwend (added draft task)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Word search is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

A word search puzzle typically consists of a grid of letters in which words are hidden.

There are many varieties of word search puzzles. For the task at hand we will use a rectangular grid in which the words may be placed horizontally, vertically, or diagonally. The words may also be spelled backwards.

The words are not allowed to zigzag, or wrap around. They may overlap but not be completely embedded in another word.

The task: create a 10 by 10 word search and fill it using words from the unixdict. Use only words that are longer than 2, and contain no non-alphabetic characters.

The cells not used by the hidden words should contain the message: Rosetta Code, read from left to right, top to bottom. These letters should be somewhat evenly distributed over the grid, not clumped together. The message should be in upper case, the hidden words in lower case. All cells should either contain letters from the hidden words or from the message.

Print the resulting grid and the solutions.

For instance:

     0  1  2  3  4  5  6  7  8  9

0    e  b  b  a  r  c  R  t  o  n
1    c  l  a  z  O  b  d  p  i  z
2    o  u  S  v  e  n  u  n  w  E
3    a  t  t  i  e  n  e  i  h  c
4    x  h  T  e  w  t  n  g  a  l
5    e  e  T  o  y  e  A  r  y  e
6    r  r  r  C  s  g  t  e  b  h
7    w  g  o  k  i  o  n  a  b  c
8    O  n  i  p  o  D  e  s  o  i
9    e  n  n  n  s  E  d  y  l  m

spore      (9,4)(5,0)   cartoon    (3,9)(9,3)
wineskin   (2,8)(9,1)   michel     (9,9)(4,9)
ninety     (0,9)(5,4)   grownup    (7,1)(1,7)
nbc        (2,5)(0,5)   greasy     (4,7)(9,7)
luther     (1,1)(6,1)   abbe       (0,3)(0,0)
lobby      (9,8)(5,8)   vie        (2,3)(4,3)
coax       (1,0)(4,0)   not        (0,9)(0,7)
end        (3,4)(1,6)   zen        (1,3)(3,5)
nnw        (9,2)(7,0)   dent       (9,6)(6,6)
pig        (8,3)(6,5)   yah        (5,8)(3,8)
arc        (0,3)(0,5)   one        (7,2)(9,0)
zip        (1,9)(1,7)   yet        (5,4)(3,2)
aau        (0,3)(2,1)   rex        (6,0)(4,0)