Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Comments on Solve a Word Search!

Post

Solve a Word Search!

+4
−0

Challenge

Given a two-dimensional array of characters and a list of words, output the location of the words. Words can go either vertically top to bottom, horizontally left to right, or diagonally top-left to bottom-right.

Output can be given as either the start and endpoint of the array or the start, direction, and length.

It can be assumed that the words all exist in the grid.

Examples

Words: HELLO, WORLD
Crossword:
ADNOW
HELLO
SDFFR
WOSAL
ANDHD

Output: ((1, 0), (1, 4)), ((0, 4), (4,4)

Questions

  • Is it better to just ask for the location of one word? A list of words doesn't seem particularly interesting, since you'd basically just iterate over the list.

  • Does including diagonals make it too complicated?

  • Any other input/output formats that should be allowed?

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.

1 comment thread

Word search, not crossword (2 comments)
Word search, not crossword
celtschk‭ wrote about 3 years ago

The title is misleading: That's not what “solving a crossword” means. Rather, this is a word search.

Moshi‭ wrote about 3 years ago

celtschk‭ This is why I should look things up more often orz