Python Wordsearch Generator

wordsearchFor this challenge we will write a Python program to randomly generate a 12 by 12 wordsearch where computing words will be randomly positioned on the grid and will appear either horizontally, vertically or diagonally.

We have started the code for you but one of our subroutine is incomplete. This is the addWord() subroutine used to position a word on the wordsearch. Your task is to complete the code to:

  • Decide where the word will start (random row and column)
  • Decide if the word will be added horizontally, vertically or diagonally
  • Check that the word will fit in (within the 12 by 12 grid)
  • Check that the word will not overlap with existing letters/words in the wordsearch

Complete the Code


Extension Task


Add two constants called ROWS and COLS both sets to 12. Make sure you declare and initialise these constants at the very beginning of your code.

Ensure that your code is using these constants throughout so that you can easily change the final size of the wordsearch by changing these two values only once at the beginning of your code.

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 8

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!