joshbduncan / word-search-generator

Make awesome Word Search puzzles!
MIT License
74 stars 24 forks source link

oop and abc all the way down #49

Closed joshbduncan closed 1 year ago

joshbduncan commented 1 year ago

Abstracting out all functional elements so the API is way more flexible for users.

joshbduncan commented 1 year ago

@duck57, so I've put some work into abstracting most of the key logic elements out from the base WordSearch object. I'm not done, but I do have most everything actually working. As you'll see you can now have different types of "games" based on a general 'Game' object. Each 'game' type can also have it's own 'Generator' object, and 'Formatter' object, and word validation.

The reason for doing this, is that I have had a handful of people (along with you) interested in using this API for generating Crossword puzzles. Some others have also wanted to generate a different style of Word Search game with different characteristics. This shuold allow users to change most of the logic to generate the type of game they want.

The new generator object will allow users to determine how the puzzle is generated. They can do whatever they want as long as they return an updated puzzle string via thegenerate() method.

The new formatter object will allow users to determine how the puzzle/game is displayed/output to the users. It requires users to implent show() and save() methods.

P.S. I need to fix the testing as the references are all botched now since I moved so much around.