aboutsummaryrefslogtreecommitdiff
path: root/challenge-076/duncan-c-white/README
blob: 4a35d35c82a2b4a85b48fde4645f84ef696b0c25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
Task 1: "Prime Sum

You are given a number $N. Write a script to find the minimum number of
prime numbers required, whose summation gives you $N.
For the sake of this task, 1 is not a prime number.

Example:

Input:
    $N = 9

Ouput:
    2 as sum of 2 prime numbers i.e. 2 and 7 is same as the input number.
    2 + 7 = 9.
"

My notes: ok. pretty straightforward.

Task 2: "Word Search

Write a script that takes two file names. The first file would contain
word search grid as shown below. The second file contains list of words,
one word per line. You could even use local dictionary file.

Print out a list of all words seen on the grid, looking both orthogonally
and diagonally, backwards as well as forwards.

Search Grid

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

Output

Found 54 words of length 5 or more when checked against the local
dictionary. You may or may not get the same result but that is fine.

aimed, align, antes, argos, arose, ashed, blunt, blunts, broad, buries,
clove, cloven, constitution, constitutions, croon, depart, departed,
enter, filch, garlic, goats, grieve, grieves, hazard, liens, malign,
malignant, malls, margo, midst, ought, ovary, parted, patna, pudgiest,
quash, quashed, raped, ruses, shrine, shrines, social, socializing,
spasm, spasmodic, succor, succors, theorem, theorems, traci, tracie,
virus, viruses, wigged
"

My notes: oh god, really?  one question: when searching in a particular
direction from a particular starting cell, are we supposed to find only
the LONGEST dictionary word found in that direction?  this is normally
the rule in wordgrid puzzles, but was not stated.  So I've coded "find
all words in a particular direction from a particular starting cell",
which is probably why I get many more words than mentioned above.