Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: implementing a scrabble-esque game on Termux III

by tybalt89 (Prior)
on Nov 16, 2019 at 01:12 UTC ( #11108771=note: print w/replies, xml ) Need Help??


in reply to implementing a scrabble-esque game on Termux III

Q2: Did you copy the dictionary file from Win to Linux without removing the \r's ?
That's one of the differences between the two.

Check your cache files, maybe delete and rebuild them.

I run on Linux (ArchLinux) so what I posted works there.

  • Comment on Re: implementing a scrabble-esque game on Termux III

Replies are listed 'Best First'.
Re^2: implementing a scrabble-esque game on Termux III
by Aldebaran (Deacon) on Nov 23, 2019 at 18:16 UTC

    ...again, I will save vertical space for respondents

    Thanks for your comments

      $board =~ /(?<!\w).{2,}(?!\w)(?{ push @pat, [ $-[0], $& ] })(*FAIL)/ +;

      This is the heart of finding a place to move. For a word to be a legal move, it must match one of the patterns in @pat. The (?<!\w) prevents putting the new word next to a preceding word, and the (?!\w) prevent putting the new word abutting a following word. The(*FAIL) forces the regex engine to try every possible place to find a match.

      Try

      perl -le ' "abcd" =~ /.{2,}(?{print $&})(*FAIL)/ '

      and notice it prints out every substring with two or more characters.

        leaving vertical space for respondents...

        Thanks for your comment,

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11108771]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2020-11-27 06:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?