Recent

Author Topic: Word Search Puzzle Maker: Possible Improvements?  (Read 1383 times)

Boleeman

  • Hero Member
  • *****
  • Posts: 715
Word Search Puzzle Maker: Possible Improvements?
« on: July 04, 2024, 04:15:38 pm »
Made a Word Search Puzzle Maker.

The Grid is drawn on a TPaintbox and a word list can be loaded from a simple text file.
Also can toggle the Answers.

Wondered why the words are not always intersecting.
How to improve it so the words are consistently intersecting?

The 1st screenshot shows what I would like to consistently happen (words intersecting)
The 2nd screenshot shows a lack of intersecting words (seems to happen quite often). How to minimize that?

Also, would be nice to see how to use a TListview used instead of a TPaintbox.

Lastly, how to print the grid and the answers to pdf, all in one go?

Enjoy what I have so far. Cheers.

« Last Edit: July 04, 2024, 04:31:15 pm by Boleeman »

circular

  • Hero Member
  • *****
  • Posts: 4356
    • Personal webpage
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #1 on: July 04, 2024, 04:39:41 pm »
Actually it is normal that no crossing is found as the possible solutions are checked with isDirPossible function that looks if any of the squares is already used.

Another approach could be to store in the used array the index of the solution. Then when you find that there is already a solution, you can replace it if the new solution covers it. For example "outstanding" will cover "stand". Otherwise, then, you cannot put the word. For example "behold" and "holding" cannot replace eachother.
Conscience is the debugger of the mind

Boleeman

  • Hero Member
  • *****
  • Posts: 715
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #2 on: July 04, 2024, 04:52:50 pm »
Thanks Circular for the advice.
Was always fascinated on how word search puzzle makers actually work, so thought I would play around a bit.

Gary Darby at Delphi for Fun created a great Wordsearch Puzzle Maker.
( http://www.delphiforfun.org/Programs/CrosswordGen0.htm )

Today ( 16/7/2024 ) I had a go at Porting it To Lazarus. Word placements work OK but the print/print preview does not work.


I noticed the version that I made, the words intersect after repeatedly making the puzzle about 8 or nine times, so perhaps I need to change the order of the word placements.

It's 1 am over here, so time to go to bed. See you all.
« Last Edit: July 16, 2024, 02:01:57 pm by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 715
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #3 on: July 05, 2024, 06:11:27 am »
Experimented by changing the Sort order of the words in the Listbox.

The 3 options are:

Sort Alphabetically
Sort by Length
Restore Original Order

And the results are:

Alphabetically seems to come out worst for the number of words placed in the grid.
Length sort seems to place the words more in parallel diagonal direction.
Original order surprisingly worked the best for number of words placed in the grid.

The attached screenshot was obtained by clicking Create multiple times until a nice word arrangement was obtained.
« Last Edit: July 05, 2024, 06:43:35 am by Boleeman »

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #4 on: July 05, 2024, 11:23:17 am »
Question

Does the list not placed mean they are not in the grid?

If so you havean issue

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 715
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #5 on: July 05, 2024, 04:49:37 pm »
Looks like you are correct Josh.

Not sure if the problems are sorted, but:

Included a revised version of the WordUsed function to ensure it properly checks for both the original and flipped versions of each word.
Also updated the btnDrawClick procedure to properly update the unused words list and the label displaying the count.


« Last Edit: July 06, 2024, 02:35:42 am by Boleeman »

Josh

  • Hero Member
  • *****
  • Posts: 1344
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #6 on: July 06, 2024, 03:23:59 am »
Does it mean the words cant be used/fit the grid?

If so, then may be issue

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Boleeman

  • Hero Member
  • *****
  • Posts: 715
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #7 on: July 06, 2024, 08:53:15 am »
Felt that the program was a bit over my head, but still gave it a go.
Better than the Soddy Crescent CSharp conversion that I failed miserably on.

Yep, there are some problems. Patch up one hole and create another.
Still learning the logic for this sort of program so there will be problems.


Most probably a better way to place the words in a more efficient manner.

Realized that there are no intersecting horizontal and vertical words.
Intersections just seem to happen for words placed diagonally.
« Last Edit: July 07, 2024, 06:53:50 am by Boleeman »

Boleeman

  • Hero Member
  • *****
  • Posts: 715
Re: Word Search Puzzle Maker: Possible Improvements?
« Reply #8 on: July 16, 2024, 02:03:29 pm »
Today ( 16/7/2024 ) I had a go at Porting a Delphi for Fun Word Search To Lazarus.

Word placements work OK but the print/print preview does not work.

Hopefully we can get the print/print preview part to work.

 

TinyPortal © 2005-2018