Crossword Engine With Simple Config
Challenge
Build crossword game with reusable classes for generating and scoring puzzles
Comments
This was built for as an interactive leave-behind for a pharma client.
I took initiative to design it for easy reuse with other clients or products. Further plans were to make it configurable via XML instead of hard-coded text values.
Actions
- Defined the puzzle layout with a single text variable:
var cw:String = “”; cw += “----------M------“; cw += “--------I-E------“; cw += “-----TREMELIMUMAB“; cw += “-----C--M-A------“; cw += “ANTIGEN-U-N------“; cw += “-----L-ONCOLOGY--“; cw += “-----L--O-M------“; cw += “----------A------“;
- Used an array to define the words, their positions and clues:
var data:Array = { {”horz”, 3, “TREMELIMUMAB”,“Pfizer’s CTLA4 inhibitor”}, {”horz”, 4, “ANTIGEN”,“Immune response stimulator”}, {”horz”, 5, “ONCOLOGY”,“With #2 down, developing medical field”}, {”vert”, 3, “TCELL”. “Type of cancer”}, {”vert”, 2, “IMMUNO”. “With #5 across, developing medical field”}, {”vert”, 1, “MELANOMA”. “Immune system component activated by CLTA4 blockade”} }
- Parsed the layout var and rendered the puzzle
- Mapped the data to the puzzle and populated the scoring mechanism
- Scoring mechanism was then equipped to implement all game behaviors: checking puzzle for completions, advancing cursor to appropriate square, giving a free letter, etc.