Post History
Sandbox
Solve a Word Search!
Article
code-golf
#2: Post edited
Solve a Crossword!
- Solve a Word Search!
- # 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 crossword.- ## Examples
- ```text
- 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?
- # 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
- ```text
- 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?
#1: Initial revision
Solve a Crossword!
# 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 crossword. ## Examples ```text 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?