Search code examples
c#data-structuresstoragetransposecrossword

Crossword words (across and down) storage?


If I create a crossword puzzle, I'd want to store the words filled in on a 9 by 9 grid for example. I considered a 2d array but can only store the Across words and not the Down words. Even if each word is stored as an object(indicating direction), I won't know which words intersect which words. Can someone point me in the right direction?


Solution

  • I'd save a start point and direction, then just store them in an object i.e.

    {'starfish':{'direction':'horizontal','position':[0,4]}, 'ratchet':{'direction':'vertical', 'position':[0,8]}