in reply to Re^3: using perl to find words for scrabble
in thread using perl to find words for scrabble

I have output now, and I must say, it is impressive. Quick, too. There's probably much more time in keeping an accurate representation of the board than thinking time for a best next move:

C:\Users\tblaz\Documents\evelyn>perl -MGames::Literati=scrabble -e"$Ga +mes::Literati::WordFile = 'c:\users\tblaz\documents\html_template_dat +a\dict\enable1.txt'; scrabble()" < t.txt Hashing words... ... ---------Scrabble---------- Board: ............... ............... ............... .......c....... ......ai....... .......s.header .......t....r.. ...jurors..soup .......o....p.h .upsilon.f..pea .......speering .........s..n.e .........t..g.. .........e..... ........broils. Is the above correct? wild tiles are at:[Row1,Col1 Row2,Col2 ...] Enter tiles: Looking for solutions for eurmsss(in X axis)... Board: ............... ............... ............... .......c....... ......ai....... .......s.header .......t....r.. ...jurors..soup .......o....p.h .upsilon.f..pea .......speering .........s..n.e .........t..g.. .........e..... ........broils. using 6 tiles: (18) row 3 become: 'cussers' starting at column 8 (9) row 12 become: 'russets' starting at column 4 using 5 tiles: (16) row 3 become: 'cruses' starting at column 8 (16) row 3 become: 'curses' starting at column 8 ... (2) column 14 become: 'er' starting at row 4 (7) column 14 become: 'phages' starting at row 12 Possible Top Ten Solution 1: row 14 become: 'embroils' starting at col +umn 6 using 2 tile(s), score 36 Possible Top Ten Solution 2: row 4 become: 'aimer' starting at column +8 using 3 tile(s), score 23 Possible Top Ten Solution 3: row 6 become: 'stems' starting at column +6 using 4 tile(s), score 23 Possible Top Ten Solution 4: row 6 become: 'stums' starting at column +6 using 4 tile(s), score 23 Possible Top Ten Solution 5: column 2 become: 'sperms' starting at row + 8 using 5 tile(s), score 22 Possible Top Ten Solution 6: column 2 become: 'spumes' starting at row + 8 using 5 tile(s), score 22 Possible Top Ten Solution 7: row 4 become: 'em' starting at column 9 +using 2 tile(s), score 21 Possible Top Ten Solution 8: row 4 become: 'um' starting at column 9 +using 2 tile(s), score 21 Possible Top Ten Solution 9: column 2 become: 'sperm' starting at row +8 using 4 tile(s), score 20 Possible Top Ten Solution 10: column 2 become: 'spume' starting at row + 8 using 4 tile(s), score 20 C:\Users\tblaz\Documents\evelyn>

If I were to go farther with this, I'd have to get off the command line. Also, I haven't cobbled together how a person completes a "turn."

So how can we do this without an indirection operator on the command line?

Replies are listed 'Best First'.
Re^5: using perl to find words for scrabble
by pryrt (Abbot) on Sep 12, 2019 at 13:07 UTC
    Also, I haven't cobbled together how a person completes a "turn."

    After I decide which of the top-10 solutions I want to use, I then use a text editor to fill in the game file (and then enter my awesome super-scoring turn into the Words With Friends app). Once the other player goes, I enter their play into the game file, and update my available tiles, and run again.

    So how can we do this without an indirection operator on the command line?

    The original interface was designed for STDIN/STDOUT interaction. You can see in the test suite (t/03_input_processing.t) the sub run_game(), which shows one way of redirecting the filehandles so it can use a named file instead of relying on the console for input.

    Back when I was actively working on it, I was planning on eventually doing new frontends (like a web interface) as sub-modules that can inherit from the main. But since it worked as-is for me (and I just set up a batch script that converts run.bat game1.txt (or drag-and-drop game1.txt onto the .bat) to perl rungame.pl < %1 to convert to redirection for me, it never became a priority. Similarly, I was planning on writing up instructions for users to be able to define their own gameboards, but never got around to that documentation, either.