Wednesday, November 10, 2021

CrossWord

 Moving on from yesterday, there are certain heuristic practuces that

make traversing a nodes and arcs image easier:

- Enforcing arc consistency atevery move will solve it - if there is a solution -

without backtracking

- Choosing to begin with the node with the largest number of domain elements.

- From domain elements, choosing the one with the fewest links...


The assignment from this lecture is kinda exciting to me, because I am such a huge

scrabble fan. It is generating a crossword puzzle from a given wordlist that the AI

will then solve.




From code:

https://github.com/dtemir/harvard-CS50AI/blob/master/crossword/generate.py



                                                           *     *     *


So how does the code create a crossword puzzle exemplar. We are given

structures (word length) and word lists to work with. the code enforces node consistency 

(on a word) and arc consistency (on a pair) who must exhibit similar letters at required places.

Where that is impossible, backtrack tries agin with another word. The output is the

'solved' image.


Note that a variable is a word space in the puzzle: with two position values, across or down,

word length.

A neighbor is another variable in the puzzle.

An assignment is a word.

No comments: