Author Topic: Word Search Puzzle Builder  (Read 6477 times)

0 Members and 1 Guest are viewing this topic.

This topic contains a post which is marked as Best Answer. Press here if you would like to see it.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Word Search Puzzle Builder
« on: December 01, 2020, 12:18:00 am »
From a list of words build your own custom Word Search Puzzle:
Say from Elements Word List.txt
 

Update: all Word Lists I am testing. The above Elements is largest.
For medium average target use of puzzle is a Christmas Word List.txt
 

Here is a really tiny Word List for checking boundary conditions of code:
 

See Best Answer for most recent code post, this is first version:
Code: QB64: [Select]
  1. _TITLE "Puzzle Builder for Word Lists" 'by B+ restarted 2020-11-28
  2. ' Make a Word Search game & txt file from a list of words usu with some thene.
  3.  
  4. ' 2020-11-30 Puzzle Builder #2 w Finder 2020-11 Now complete the app with a word finder.
  5. ' Max word letters = 15
  6. ' Max cells/letters per side = 30
  7. ' Max words can find on word list is 120 (that can be shown on screen).
  8.  
  9. DEFLNG A-Z
  10. CONST AscA = 97
  11. CONST ScreenWidth = 1000, ScreenHeight = 640
  12. DIM SHARED WordListFileBase$, GridSide, GridSideM1, GridSideP2M1
  13.  
  14.  
  15. '======================================= File Base name and Grid Size ================================================
  16.  
  17. '   Make your word list file with: Some base name for theme + " Word List.txt"
  18.  
  19. ' test file 2
  20. WordListFileBase$ = "Elements" ' add suffix to your file " Word List.txt"    <<<<<<<<<<<<<<<<<<<<<<<<<    Input
  21. GridSide = 30 ' <<<<<<<<<<<<<<<<<<<<<<<<<    Input later    30 the maximum grid size
  22.  
  23. ' test file 1
  24. 'WordListFileBase$ = "Christmas" 'add suffix to your file " Word List.txt"   <<<<<<<<<<<<<<<<<<<<<<<<<    Input
  25. 'GridSide= 15 ' <<<<<<<<<<<<<<<<<<<<<<<<<    Input later    30 the maximum grid size
  26.  
  27. '' test file 3
  28. 'WordListFileBase$ = "The_Four"
  29. 'GridSide = 5
  30.  
  31. '=====================================================================================================================
  32.  
  33. ' Calc once and for all!
  34. GridSideM1 = GridSide - 1
  35. GridSideP2M1 = GridSide * GridSide - 1
  36.  
  37. DIM SHARED LetterLimit
  38. IF GridSide > 15 THEN LetterLimit = 15 ELSE LetterLimit = GridSide
  39.  
  40. DIM SHARED GridLabel$ ' for labeling WS grid
  41. GridLabel$ = MID$("   0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v w x y z", 1, GridSide * 2 + 2)
  42.  
  43. 'LoadWords opens file of words and sets
  44. DIM SHARED NWords 'set in LoadWords, number of words
  45.  
  46. ' word file words (shuffled) to be fit into puzzle and index position, 24945 comes from a dictionary file
  47. DIM SHARED Words$(1 TO 24945), WordsIndex AS INTEGER 'the file has 24945 words but many are unsuitable
  48.  
  49. 'words placed in Letters grid, word itself (WordList$) x, y head (WordX, WordY) and direction (WordDirection), WordIndex is the index to all these
  50. DIM SHARED WordList$(1 TO 250), WordX(1 TO 250), WordY(1 TO 250), WordDirection(1 TO 250), WordIndex
  51. DIM SHARED BestWordList$(1 TO 250), BestWordX(1 TO 250), BestWordY(1 TO 250), BestWordDirection(1 TO 250)
  52.  
  53. ' letters grid and for saving best grid
  54. DIM SHARED Letters$(0 TO GridSideP2M1, 0 TO GridSideP2M1), Best$(0 TO GridSideP2M1, 0 TO GridSideP2M1), BestWordIndex
  55.  
  56. ' direction arrays
  57. DIM SHARED DX(0 TO 7), DY(0 TO 7)
  58. DX(0) = 1: DY(0) = 0
  59. DX(1) = 1: DY(1) = 1
  60. DX(2) = 0: DY(2) = 1
  61. DX(3) = -1: DY(3) = 1
  62. DX(4) = -1: DY(4) = 0
  63. DX(5) = -1: DY(5) = -1
  64. DX(6) = 0: DY(6) = -1
  65. DX(7) = 1: DY(7) = -1
  66.  
  67. ' signal successful fill of puzzle = either no spaces left or all words$() used
  68. DIM SHARED Filled ' signal we are full and done!
  69.  
  70. SCREEN _NEWIMAGE(ScreenWidth, ScreenHeight, 32)
  71. _DELAY .25
  72.  
  73. DIM try, c, r, y$, puzzleFiled
  74. try = 0
  75. LoadWords 'this sets NWORDS count to work with
  76. WHILE try < 1000000 'for long runs uncomment BEEP
  77.     Initialize
  78.     'ShowPuzzle
  79.     FOR WordsIndex = 1 TO NWords
  80.         PlaceWord
  81.         'ShowPuzzle
  82.         IF Filled THEN EXIT FOR
  83.     NEXT
  84.     IF WordIndex > BestWordIndex THEN 'copy Letters$ into Best$
  85.         FOR r = 0 TO GridSideM1
  86.             FOR c = 0 TO GridSideM1
  87.                 Best$(c, r) = Letters$(c, r)
  88.             NEXT
  89.         NEXT
  90.         BestWordIndex = WordIndex
  91.         ERASE BestWordList$, BestWordX, BestWordY, BestWordDirection
  92.         FOR r = 1 TO WordIndex
  93.             BestWordList$(r) = WordList$(r): BestWordX(r) = WordX(r): BestWordY(r) = WordY(r): BestWordDirection(r) = WordDirection(r)
  94.         NEXT
  95.         IF BestWordIndex = NWords THEN 'automatic file if all words positioned in puzzle
  96.             ShowBestPuzzle
  97.             LOCATE 34, 1: PRINT "On try #"; TS$(try); " all words used!"
  98.             FilePuzzle
  99.             LOCATE 36, 1: PRINT "Puzzle Filed, next up is word search."
  100.             LOCATE 38, 1: PRINT "     press any to continue."
  101.             puzzleFiled = -1
  102.             BEEP
  103.             SLEEP
  104.             EXIT WHILE
  105.         END IF
  106.     END IF
  107.     try = try + 1
  108.     LOCATE 1, 1: PRINT "Try:"; try
  109. IF puzzleFiled = 0 THEN
  110.     ShowBestPuzzle
  111.     BEEP
  112.     LOCATE 34, 1: PRINT "After "; TS$(try); " tries, this was best puzzle."
  113.     LOCATE 36, 1: INPUT "Enter y for yes, to save the best to file."; y$
  114.     IF y$ = "y" THEN
  115.         FilePuzzle
  116.         LOCATE 37, 1: PRINT "Puzzle Filed, next up is word search."
  117.     END IF
  118.     LOCATE 38, 1: PRINT "     press any to continue."
  119.     SLEEP
  120.  
  121.  
  122. ' Now to find words in our best puzzle
  123. DIM bestPuz, mx, my, mb, wIndex, hx, hy, wd, i, sx, sy, navX$, navY$, navD$
  124.  
  125. ShowBestPuzzle 'get a snapshot
  126. bestPuz = _NEWIMAGE(ScreenWidth, ScreenHeight, 32)
  127. _PUTIMAGE , 0, bestPuz
  128. WHILE _KEYDOWN(27) = 0
  129.     _PUTIMAGE , bestPuz, 0
  130.     LOCATE 34, 1: PRINT "Move mouse over a word to find."
  131.     mb = _MOUSEBUTTON(1) 'wait for a word to be clicked
  132.     mx = INT(_MOUSEX / 8) + 1: my = INT(_MOUSEY / 16) + 1
  133.     IF mx >= 65 AND mx <= 84 THEN
  134.         wIndex = my
  135.     ELSEIF mx >= 85 AND mx <= 104 THEN
  136.         wIndex = my + 40
  137.     ELSEIF mx >= 105 AND mx <= 125 THEN
  138.         wIndex = my + 80
  139.     ELSE
  140.         wIndex = 0
  141.     END IF
  142.     IF wIndex > BestWordIndex THEN wIndex = 0
  143.     IF wIndex THEN
  144.         IF Found(BestWordList$(wIndex), hx, hy, wd) THEN 'high lite it black, yellow
  145.             convertCR2Screen hx, hy, sx, sy '    tranlate array location to screen location and navigate column, row
  146.             convertCR2Nav hx, hy, wd, navX$, navY$, navD$
  147.             LOCATE 36, 1: PRINT BestWordList$(wIndex); " found at ("; navX$; ", "; navY$; ") going "; navD$
  148.             COLOR &HFF0000BB, &HFFFFFF00
  149.             LOCATE sy, sx: PRINT Best$(hx, hy);
  150.             FOR i = 2 TO LEN(BestWordList$(wIndex))
  151.                 hx = hx + DX(wd): hy = hy + DY(wd)
  152.                 convertCR2Screen hx, hy, sx, sy
  153.                 LOCATE sy, sx: PRINT Best$(hx, hy);
  154.             NEXT
  155.             COLOR &HFFFFFFFF, &HFF000000
  156.         ELSE
  157.             LOCATE 34, 1: PRINT "Sorry, something is screwed up!"
  158.             LOCATE 36, 1: PRINT "       press any to continue..."
  159.         END IF
  160.     END IF
  161.     _LIMIT 60
  162.  
  163. SUB LoadWords
  164.     DIM wd$
  165.     OPEN WordListFileBase$ + " Word List.txt" FOR INPUT AS #1
  166.     WHILE EOF(1) = 0
  167.         INPUT #1, wd$
  168.         IF LEN(wd$) <= LetterLimit THEN
  169.             NWords = NWords + 1: Words$(NWords) = UCASE$(wd$) ' traditional ucase, works better with proper names
  170.         END IF
  171.     WEND
  172.     CLOSE #1
  173.  
  174. SUB Shuffle 'then order biggest first smallest last
  175.     DIM i, j
  176.     FOR i = NWords TO 2 STEP -1
  177.         SWAP Words$(i), Words$(INT(RND * i) + 1)
  178.     NEXT
  179.     i = 0
  180.     WHILE i < NWords - 1 'order the hard way but less than 100 words
  181.         i = i + 1
  182.         FOR j = i + 1 TO NWords
  183.             IF LEN(Words$(j)) > LEN(Words$(i)) THEN SWAP Words$(i), Words$(j)
  184.         NEXT
  185.     WEND
  186.  
  187. SUB Initialize ' zero out everything
  188.     DIM r, c
  189.  
  190.     FOR r = 0 TO GridSideM1
  191.         FOR c = 0 TO GridSideM1
  192.             Letters$(c, r) = " "
  193.         NEXT
  194.     NEXT
  195.     ERASE WordList$, WordX, WordY, WordDirection
  196.     WordIndex = 0
  197.     Shuffle 'reset word order
  198.  
  199. FUNCTION TS$ (n)
  200.     TS$ = _TRIM$(STR$(n))
  201.  
  202. FUNCTION CountSpaces () 'used in PlaceWord
  203.     DIM x AS _BYTE, y AS _BYTE, count AS INTEGER
  204.     FOR y = 0 TO GridSide - 1
  205.         FOR x = 0 TO GridSide - 1
  206.             IF Letters$(x, y) = " " THEN count = count + 1
  207.         NEXT
  208.     NEXT
  209.     CountSpaces = count
  210.  
  211. FUNCTION Match (word AS STRING, template AS STRING) 'used in PlaceWord
  212.     DIM i AS INTEGER
  213.     Match = 0
  214.     IF LEN(word) <> LEN(template) THEN EXIT FUNCTION
  215.     FOR i = 1 TO LEN(template)
  216.         IF ASC(template, i) <> 32 AND (ASC(word, i) <> ASC(template, i)) THEN EXIT FUNCTION
  217.     NEXT
  218.     Match = -1
  219.  
  220. SUB PlaceWord
  221.     ' place the words randomly in the grid
  222.     ' start at random spot and work forward or all the squares
  223.     ' for each open square try the 8 directions for placing the word
  224.     '
  225.     ' Filled will now signal that all the words have been positioned
  226.     ' if place a word update Letters$, WordIndex, WordList$(WordIndex), WordX(WordIndex), WordY(WordIndex), WordDirection(WordIndex)
  227.  
  228.     DIM wd$, wLen, spot, testNum, rdir ' rdir go forward or back form spot
  229.     DIM x, y, d, dNum, rdd ' dNum counts number of directions we tried,  rdd sets direction to rotate
  230.     DIM template$, b1, b2 'for match against letters already in Letters$ grid
  231.     DIM i, j
  232.  
  233.     wd$ = Words$(WordsIndex) 'the right side is all shared
  234.     wLen = LEN(wd$) - 1 '     from the spot there are this many letters to check
  235.     spot = INT(RND * GridSide * GridSide) '   a random spot on grid
  236.     testNum = 1 '             when this hits GridSide*GridSide we've tested all possible spots on grid
  237.     IF RND < .5 THEN rdir = -1 ELSE rdir = 1 ' go forward or back from spot for next test
  238.     WHILE testNum < GridSide * GridSide
  239.         y = INT(spot / GridSide)
  240.         x = spot MOD GridSide
  241.         IF Letters$(x, y) = MID$(wd$, 1, 1) OR Letters$(x, y) = " " THEN
  242.             d = INT(8 * RND)
  243.             IF RND < .5 THEN rdd = -1 ELSE rdd = 1
  244.             dNum = 1
  245.             WHILE dNum < 9
  246.                 'will wd$ fit? from  at x, y
  247.                 template$ = ""
  248.                 b1 = wLen * DX(d) + x >= 0 AND wLen * DX(d) + x <= GridSideM1 'wLen = len(wd$) - 1
  249.                 b2 = wLen * DY(d) + y >= 0 AND wLen * DY(d) + y <= GridSideM1
  250.                 IF b1 AND b2 THEN ' build the template of letters and spaces from Letter grid
  251.                     FOR i = 0 TO wLen
  252.                         template$ = template$ + Letters$(x + i * DX(d), y + i * DY(d))
  253.                     NEXT
  254.                     IF Match(wd$, template$) THEN 'the word will fit but does it fill anything?
  255.                         FOR j = 1 TO LEN(template$)
  256.                             IF ASC(template$, j) = 32 THEN 'yes a space to fill
  257.                                 FOR i = 0 TO wLen 'adding word to letter grid
  258.                                     Letters$(x + i * DX(d), y + i * DY(d)) = MID$(wd$, i + 1, 1)
  259.                                 NEXT
  260.                                 WordIndex = WordIndex + 1 'add word to loacting arrays
  261.                                 WordList$(WordIndex) = wd$: WordX(WordIndex) = x: WordY(WordIndex) = y: WordDirection(WordIndex) = d
  262.                                 IF CountSpaces = 0 OR WordIndex > NWords THEN Filled = -1
  263.                                 EXIT SUB 'get out now that word is loaded
  264.                             END IF
  265.                         NEXT
  266.                         'if still here keep looking
  267.                     END IF
  268.                 END IF
  269.                 d = (d + 8 + rdd) MOD 8 'set next direction to try
  270.                 dNum = dNum + 1 'count number of resets done when have 9 resets
  271.             WEND
  272.         END IF
  273.         spot = spot + rdir ' ok try next spot
  274.         IF spot >= GridSide * GridSide THEN spot = 0
  275.         IF spot < 0 THEN spot = GridSide * GridSide - 1
  276.         testNum = testNum + 1 'until tried every spot on grid
  277.     WEND
  278.  
  279. 'SUB ShowPuzzle 'this was needed to make sure finding the best puzzle was working correctly
  280. '    DIM i, x, y
  281.  
  282. '    CLS
  283. '    LOCATE 1, 1: PRINT GridLabel$
  284. '    FOR i = 3 TO 2 + GridSide
  285. '        LOCATE i, 1: PRINT MID$(GridLabel$, i * 2 - 2, 1);
  286. '    NEXT
  287. '    FOR y = 0 TO GridSide - 1
  288. '        FOR x = 0 TO GridSide - 1
  289. '            LOCATE y + 3, 2 * x + 4: PRINT Letters$(x, y)
  290. '        NEXT
  291. '    NEXT
  292. '    FOR i = 1 TO WordIndex
  293. '        IF i <= 40 THEN
  294. '            LOCATE i, 65: PRINT TS$(i); " "; WordList$(i);
  295. '        ELSEIF i <= 80 THEN
  296. '            LOCATE i - 40, 85: PRINT TS$(i); " "; WordList$(i);
  297. '        ELSEIF i <= 120 THEN
  298. '            LOCATE i - 80, 105: PRINT TS$(i); " "; WordList$(i);
  299. '        END IF
  300. '    NEXT
  301. '    LOCATE 35, 1: PRINT "Spaces left:"; CountSpaces
  302. '    LOCATE 36, 1: PRINT "Words placed:"; WordIndex
  303. '    LOCATE 37, 1: PRINT SPACE$(16)
  304. '    IF WordsIndex THEN LOCATE 37, 1: PRINT TS$(WordsIndex); " "; Words$(WordsIndex)
  305. 'END SUB
  306.  
  307. SUB FilePuzzle
  308.     DIM i, r, c, b$, x$, y$, d$
  309.  
  310.     OPEN WordListFileBase$ + " Word Search Puzzle.txt" FOR OUTPUT AS #1
  311.     PRINT #1, GridLabel$
  312.     PRINT #1, ""
  313.     FOR r = 0 TO GridSideM1
  314.         b$ = MID$(GridLabel$, r * 2 + 4, 1) + "  "
  315.         FOR c = 0 TO GridSideM1
  316.             b$ = b$ + Best$(c, r) + " "
  317.         NEXT
  318.         PRINT #1, b$
  319.     NEXT
  320.     PRINT #1, ""
  321.     PRINT #1, "                              Search Word Solutions"
  322.     PRINT #1, ""
  323.     PRINT #1, "     The words from: " + WordListFileBase$ + " Word List.txt can be found here:"
  324.     PRINT #1, ""
  325.     FOR i = 1 TO BestWordIndex
  326.         convertCR2Nav BestWordX(i), BestWordY(i), BestWordDirection(i), x$, y$, d$
  327.         PRINT #1, RIGHT$(SPACE$(7) + TS$(i), 7); ") "; RIGHT$(SPACE$(GridSide) + BestWordList$(i), GridSide);
  328.         PRINT #1, "("; x$; ", "; y$; ") >>>---> "; d$
  329.     NEXT
  330.     CLOSE #1
  331.  
  332. SUB fillBlanksInBest
  333.     DIM y, x, m
  334.     FOR y = 0 TO GridSide - 1
  335.         FOR x = 0 TO GridSide - 1
  336.             IF Best$(x, y) = " " THEN
  337.                 m = (m + 1) MOD 5
  338.                 Best$(x, y) = MID$("BPLUS", m + 1, 1)
  339.             END IF
  340.         NEXT
  341.     NEXT
  342.  
  343. SUB ShowBestPuzzle
  344.     DIM i, x, y
  345.  
  346.     fillBlanksInBest
  347.     CLS
  348.     LOCATE 1, 1: PRINT GridLabel$
  349.     FOR i = 3 TO 2 + GridSide
  350.         LOCATE i, 1: PRINT MID$(GridLabel$, i * 2 - 2, 1);
  351.     NEXT
  352.     FOR y = 0 TO GridSide - 1
  353.         FOR x = 0 TO GridSide - 1
  354.             LOCATE y + 3, 2 * x + 4: PRINT Best$(x, y)
  355.         NEXT
  356.     NEXT
  357.     FOR i = 1 TO BestWordIndex
  358.         IF i <= 40 THEN
  359.             LOCATE i, 65: PRINT TS$(i); " "; BestWordList$(i);
  360.         ELSEIF i <= 80 THEN
  361.             LOCATE i - 40, 85: PRINT TS$(i); " "; BestWordList$(i);
  362.         ELSEIF i <= 120 THEN
  363.             LOCATE i - 80, 105: PRINT TS$(i); " "; BestWordList$(i);
  364.         END IF
  365.     NEXT
  366.  
  367. FUNCTION Found (word$, headX, headY, direction)
  368.     'First find a letter that matches the first letter in word$,
  369.     'then at that x, y try each of 8 directions to see if find a match.
  370.     'See if enough room to fit the find word before heading out to match letters.
  371.  
  372.     DIM first$, lenFind, x, y, d, b1, b2, xx, yy, b$, i
  373.  
  374.     first$ = MID$(word$, 1, 1): lenFind = LEN(word$) - 1
  375.     FOR y = 0 TO GridSideM1
  376.         FOR x = 0 TO GridSideM1
  377.             IF Best$(x, y) = first$ THEN
  378.                 FOR d = 0 TO 7 'will word fit in this direction? 2 booleans True condition
  379.                     b1 = lenFind * DX(d) + x >= 0 AND lenFind * DX(d) + x <= GridSideM1
  380.                     b2 = lenFind * DY(d) + y >= 0 AND lenFind * DY(d) + y <= GridSideM1
  381.                     IF b1 AND b2 THEN 'word fits,
  382.                         ' build word from Letters block to see if matches word to find
  383.                         b$ = first$: xx = x + DX(d): yy = y + DY(d)
  384.                         FOR i = 2 TO LEN(word$)
  385.                             b$ = b$ + Best$(xx, yy)
  386.                             xx = xx + DX(d): yy = yy + DY(d)
  387.                         NEXT
  388.                         xx = x: yy = y 'copy x, y for rebuilding word on screen
  389.                         IF b$ = word$ THEN 'found one show our result
  390.                             headX = x: headY = y: direction = d: Found = -1
  391.                             EXIT SUB
  392.                         END IF
  393.                     END IF
  394.                 NEXT
  395.             END IF
  396.         NEXT
  397.     NEXT
  398.  
  399. SUB convertCR2Screen (c, r, screenC, screenR)
  400.     screenC = 2 * c + 4: screenR = r + 3
  401.  
  402. SUB convertCR2Nav (c, r, d, navX$, navY$, navD$)
  403.     IF c > 9 THEN navX$ = CHR$(c - 9 + AscA - 1) ELSE navX$ = TS$(c)
  404.     IF r > 9 THEN navY$ = CHR$(r - 9 + AscA - 1) ELSE navY$ = TS$(r)
  405.     SELECT CASE d
  406.         CASE 0: navD$ = "East"
  407.         CASE 1: navD$ = "South East"
  408.         CASE 2: navD$ = "South"
  409.         CASE 3: navD$ = "South West"
  410.         CASE 4: navD$ = "West"
  411.         CASE 5: navD$ = "North West"
  412.         CASE 6: navD$ = "North"
  413.         CASE 7: navD$ = "North East"
  414.     END SELECT
  415.  

 
Puzzle Builder test with all the Elements.PNG


The text file from which to print a paper puzzle and/or read the solutions.
 

Can you find the Gold? ;)
« Last Edit: December 02, 2020, 12:23:52 pm by bplus »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Search Puzzle Builder
« Reply #1 on: December 01, 2020, 12:39:02 am »
Here is a little zip package setup to do a Christmas Word List plus Elements stuff is included:
* Word Search Puzzle Builder.zip (Filesize: 9.34 KB, Downloads: 172)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Word Search Puzzle Builder
« Reply #2 on: December 01, 2020, 12:54:42 am »
Really cool B+! I've wanted to make one of these for ages but I just don't know how to formulate it in my head, besides just putting random words everywhere and filling the rest with random letters. The part that stops me is how to connect each word in the right places with other words. It's almost like solving the Rubik's Cube to me. LOL
But good job! I also like how you can use the mouse to cheat and see where the word is. :)

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Word Search Puzzle Builder
« Reply #3 on: December 01, 2020, 12:55:51 am »
Also thanks for making this, now anyone can make as many word searches as they wish, forever. :)

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Search Puzzle Builder
« Reply #4 on: December 01, 2020, 01:41:03 am »
Also thanks for making this, now anyone can make as many word searches as they wish, forever. :)

That's the idea :) glad you liked, the beauty is you can also modify...

Offline Richard Frost

  • Seasoned Forum Regular
  • Posts: 316
  • Needle nardle noo. - Peter Sellers
    • View Profile
Re: Word Search Puzzle Builder
« Reply #5 on: December 01, 2020, 04:31:48 am »
I didn't realize you'd written your own puzzle maker. Thought you were using and maybe modifying
mine.  I see our focus is different - you've created something for immediate use while my objective
was to fit as much as possible into a smaller grid, and create a file suitable for printing. 

Yours has room at the bottom to summarize the properties of the element, and to say if WalMart sells
it.  And draw pictures - clouds of green for krypton, a dead cat for arsenic, a flying Hindenberg
for hydrogen, etc. 

Wow, yours is 341 active (not blank or comment) lines AND HAS NO GOTOs!  Mine has 4.  Foo yuck.

Jolly fun stupf.
It works better if you plug it in.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Search Puzzle Builder
« Reply #6 on: December 01, 2020, 10:49:43 am »
Yes, I had posted work on Word Search 2 years ago: https://www.qb64.org/forum/index.php?topic=716.msg5917#msg5917

And CBTJD was kind enough to post it properly at Rosetta this year in March: https://www.qb64.org/forum/index.php?topic=2334.msg115605#msg115605

Hey @CBTJD  are you still looking in? How's it going?

I don't know why I didn't then take the next obvious step and make a Puzzle Builder for any word list? I am sure I was heading that way but Rosetta Challenge may have been a distraction. I did work from a Word List of QB64 Command words. Update: Oh I had started an Editor for Word Search but like Ken said it's too much mental manipulation.

Then again if you have all the Elements, you have everything!

Still could under go some refinements like find the longest word and limit the puzzle square side to that length or some formula using that length and/or number of words on list, fix some print alignments and a non flashing found word signal... I don't think we ever finish a good project.

BTW I did employ some ASC in the Match function, I do remember Steve pointed out long ago the speed advantage over strings.

@Richard Frost  I hope you post your old or updated to cross pollinate ideas and features, now that we've each tried it and updated? our own code, it's good to compare - what forums are for IMHO.
« Last Edit: December 01, 2020, 11:04:31 am by bplus »

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: Word Search Puzzle Builder
« Reply #7 on: December 01, 2020, 11:17:15 am »
Nice work!  I'm gonna play around with it.

- Dav

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Search Puzzle Builder
« Reply #8 on: December 01, 2020, 12:14:14 pm »
Hi @Dav

Thanks, I look forward to seeing what you might do.

Guess I will let a cat out of the bag, the Christmas Word Search is program #2 I had planned for my Christmas Album. I really impressed myself with program #1. Tease, tease... ;-))

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Word Search Puzzle Builder
« Reply #9 on: December 01, 2020, 02:30:41 pm »
Your puzzle doesn't have boobs. Bob's puzzle has boobs. I'll stick with Bob's puzzle.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Word Search Puzzle Builder
« Reply #10 on: December 01, 2020, 02:48:05 pm »
Your puzzle doesn't have boobs. Bob's puzzle has boobs. I'll stick with Bob's puzzle.

Pete

Bobbing for boobs are we? I just noticed how similar the name Bob is to boob, both are symmetric, palindromic and start and end with B and contain round circles. ;-)) Dang it's uncanny. :)

Looks like the beginning of a Word Search Theme ;-))
« Last Edit: December 01, 2020, 02:49:13 pm by bplus »

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Word Search Puzzle Builder
« Reply #11 on: December 01, 2020, 03:17:59 pm »
Bobbing for boobs are we? I just noticed how similar the name Bob is to boob, both are symmetric, palindromic and start and end with B and contain round circles. ;-)) Dang it's uncanny. :)

Looks like the beginning of a Word Search Theme ;-))

One thing I noticed about the word Boob:  it’s the most descriptive word in the English language.

B — Top View.
oo  —  Front View.
b  —  Side View.

It doesn’t get any more descriptive than that!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Word Search Puzzle Builder
« Reply #12 on: December 01, 2020, 03:21:24 pm »
You left out the "S" which would be top view deformity.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Word Search Puzzle Builder
« Reply #13 on: December 01, 2020, 03:29:54 pm »
You left out the "S" which would be top view deformity.

Pete

That’s the “aged view”.
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Word Search Puzzle Builder
« Reply #14 on: December 01, 2020, 03:41:52 pm »
Why did I end up 91st?
Granted after becoming radioactive I only have a half-life!