Letter Boxed validatorLetter Boxed, part 2: this time, solve itHangman wordgame golfBest Scoring Boggle Boardletter combinations to make wordsSolve the New York Times Spelling BeeIs it an Ordered Word?Who will win Ghost?How to pluralize ellipsis?Does a letter fit inside the other?Should this identifier be suggested?Letter Boxed, part 2: this time, solve it

Minimize taxes now that I earn more

Is there an in-universe reason Harry says this or is this simply a Rowling mistake?

Does a familiar stay the same after being true polymorphed and then dismissed and resummoned?

Do liquid propellant rocket engines experience thrust oscillation?

Hiking with a mule or two?

Social leper versus social leopard

Would Taiwan and China's dispute be solved if Taiwan gave up being the Republic of China?

Temporarily moving a SQL Server 2016 database to SQL Server 2017 and then moving back. Is it possible?

Writing a letter of recommendation for a mediocre student

Are actors contractually obligated to certain things like going nude/ Sensual Scenes/ Gory Scenes?

Circle divided by lines between a blue dots

How can I prevent soul energy from dissipating?

Install specific version and arch, without specifying the release

Can multiple wall timers turn lights on or off when required?

Is the sentence "何でも忘れた" correct?

How to influence manager to not schedule team meetings during lunch?

Is this a Sherman, and if so what model?

Can one guy with a duplicator initiate a nuclear apocalypse?

Why there so many pitch control surfaces on the Piaggio P180 Avanti?

Linear independence of element-wise powers of positive vectors

Is it really necessary to have 4 hours meeting in Sprint planning?

Do the villains know Batman has no superpowers?

Create a magic square of 4-digit numbers

Apple Developer Program Refund Help



Letter Boxed validator


Letter Boxed, part 2: this time, solve itHangman wordgame golfBest Scoring Boggle Boardletter combinations to make wordsSolve the New York Times Spelling BeeIs it an Ordered Word?Who will win Ghost?How to pluralize ellipsis?Does a letter fit inside the other?Should this identifier be suggested?Letter Boxed, part 2: this time, solve it






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








28












$begingroup$


The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:



Letter Boxed example from the New York Times



You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made of those 12 letters (and those letters only) such that:



  • Each word is at least 3 letters long;

  • Consecutive letters cannot be from the same side;

  • The last letter of a word becomes the first letter of the next word;

  • All letters are used at least once (letters can be reused).

In this challenge, you are given the letters and a list of words. The goal is to check whether the list of words is a valid Letter Boxed solution.



Input



Input consists of (1) 4 groups of 3 letters and (2) a list of words. It can be in any suitable format.



Output



A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise.



Test cases



Groups of letters=I,C,O, M,R,E, G,N,S, A,P,L.



Truthy values



  • PILGRIMAGE, ENCLOSE

  • CROPS, SAIL, LEAN, NOPE, ENIGMA

Falsey values



  • PILGRIMAGE, ECONOMIES (can't have CO since they are on the same side)

  • CROPS, SAIL, LEAN, NOPE (G and M have not been used)

  • PILGRIMAGE, ENCLOSURE (U is not one of the 12 letters)

  • ENCLOSE, PILGRIMAGE (last letter of 1st word is not first letter of 2nd word)

  • SCAMS, SO, ORGANISE, ELOPE (all words must be at least 3 letters long).

Note that in this challenge, we do not care whether the words are valid (part of a dictionary).



Scoring:



This code-golf, lowest score in bytes wins!










share|improve this question











$endgroup$









  • 4




    $begingroup$
    @TFeld no letter appears twice
    $endgroup$
    – feersum
    Apr 15 at 11:06










  • $begingroup$
    A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise. For Python (and most other languages, I expect), both [] and 0 are falsey. Can we output either, or must our output be consistent?
    $endgroup$
    – Artemis Fowl
    Apr 15 at 23:35










  • $begingroup$
    @ArtemisFowl Either is fine.
    $endgroup$
    – Robin Ryder
    Apr 16 at 6:46










  • $begingroup$
    I thought so, but my question was: can we mix them?
    $endgroup$
    – Artemis Fowl
    Apr 16 at 15:03










  • $begingroup$
    @ArtemisFowl Yes, you can mix them.
    $endgroup$
    – Robin Ryder
    Apr 16 at 15:05

















28












$begingroup$


The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:



Letter Boxed example from the New York Times



You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made of those 12 letters (and those letters only) such that:



  • Each word is at least 3 letters long;

  • Consecutive letters cannot be from the same side;

  • The last letter of a word becomes the first letter of the next word;

  • All letters are used at least once (letters can be reused).

In this challenge, you are given the letters and a list of words. The goal is to check whether the list of words is a valid Letter Boxed solution.



Input



Input consists of (1) 4 groups of 3 letters and (2) a list of words. It can be in any suitable format.



Output



A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise.



Test cases



Groups of letters=I,C,O, M,R,E, G,N,S, A,P,L.



Truthy values



  • PILGRIMAGE, ENCLOSE

  • CROPS, SAIL, LEAN, NOPE, ENIGMA

Falsey values



  • PILGRIMAGE, ECONOMIES (can't have CO since they are on the same side)

  • CROPS, SAIL, LEAN, NOPE (G and M have not been used)

  • PILGRIMAGE, ENCLOSURE (U is not one of the 12 letters)

  • ENCLOSE, PILGRIMAGE (last letter of 1st word is not first letter of 2nd word)

  • SCAMS, SO, ORGANISE, ELOPE (all words must be at least 3 letters long).

Note that in this challenge, we do not care whether the words are valid (part of a dictionary).



Scoring:



This code-golf, lowest score in bytes wins!










share|improve this question











$endgroup$









  • 4




    $begingroup$
    @TFeld no letter appears twice
    $endgroup$
    – feersum
    Apr 15 at 11:06










  • $begingroup$
    A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise. For Python (and most other languages, I expect), both [] and 0 are falsey. Can we output either, or must our output be consistent?
    $endgroup$
    – Artemis Fowl
    Apr 15 at 23:35










  • $begingroup$
    @ArtemisFowl Either is fine.
    $endgroup$
    – Robin Ryder
    Apr 16 at 6:46










  • $begingroup$
    I thought so, but my question was: can we mix them?
    $endgroup$
    – Artemis Fowl
    Apr 16 at 15:03










  • $begingroup$
    @ArtemisFowl Yes, you can mix them.
    $endgroup$
    – Robin Ryder
    Apr 16 at 15:05













28












28








28


2



$begingroup$


The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:



Letter Boxed example from the New York Times



You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made of those 12 letters (and those letters only) such that:



  • Each word is at least 3 letters long;

  • Consecutive letters cannot be from the same side;

  • The last letter of a word becomes the first letter of the next word;

  • All letters are used at least once (letters can be reused).

In this challenge, you are given the letters and a list of words. The goal is to check whether the list of words is a valid Letter Boxed solution.



Input



Input consists of (1) 4 groups of 3 letters and (2) a list of words. It can be in any suitable format.



Output



A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise.



Test cases



Groups of letters=I,C,O, M,R,E, G,N,S, A,P,L.



Truthy values



  • PILGRIMAGE, ENCLOSE

  • CROPS, SAIL, LEAN, NOPE, ENIGMA

Falsey values



  • PILGRIMAGE, ECONOMIES (can't have CO since they are on the same side)

  • CROPS, SAIL, LEAN, NOPE (G and M have not been used)

  • PILGRIMAGE, ENCLOSURE (U is not one of the 12 letters)

  • ENCLOSE, PILGRIMAGE (last letter of 1st word is not first letter of 2nd word)

  • SCAMS, SO, ORGANISE, ELOPE (all words must be at least 3 letters long).

Note that in this challenge, we do not care whether the words are valid (part of a dictionary).



Scoring:



This code-golf, lowest score in bytes wins!










share|improve this question











$endgroup$




The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:



Letter Boxed example from the New York Times



You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made of those 12 letters (and those letters only) such that:



  • Each word is at least 3 letters long;

  • Consecutive letters cannot be from the same side;

  • The last letter of a word becomes the first letter of the next word;

  • All letters are used at least once (letters can be reused).

In this challenge, you are given the letters and a list of words. The goal is to check whether the list of words is a valid Letter Boxed solution.



Input



Input consists of (1) 4 groups of 3 letters and (2) a list of words. It can be in any suitable format.



Output



A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise.



Test cases



Groups of letters=I,C,O, M,R,E, G,N,S, A,P,L.



Truthy values



  • PILGRIMAGE, ENCLOSE

  • CROPS, SAIL, LEAN, NOPE, ENIGMA

Falsey values



  • PILGRIMAGE, ECONOMIES (can't have CO since they are on the same side)

  • CROPS, SAIL, LEAN, NOPE (G and M have not been used)

  • PILGRIMAGE, ENCLOSURE (U is not one of the 12 letters)

  • ENCLOSE, PILGRIMAGE (last letter of 1st word is not first letter of 2nd word)

  • SCAMS, SO, ORGANISE, ELOPE (all words must be at least 3 letters long).

Note that in this challenge, we do not care whether the words are valid (part of a dictionary).



Scoring:



This code-golf, lowest score in bytes wins!







code-golf decision-problem game






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 10 at 11:30







Robin Ryder

















asked Apr 15 at 10:41









Robin RyderRobin Ryder

4,0744 silver badges29 bronze badges




4,0744 silver badges29 bronze badges










  • 4




    $begingroup$
    @TFeld no letter appears twice
    $endgroup$
    – feersum
    Apr 15 at 11:06










  • $begingroup$
    A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise. For Python (and most other languages, I expect), both [] and 0 are falsey. Can we output either, or must our output be consistent?
    $endgroup$
    – Artemis Fowl
    Apr 15 at 23:35










  • $begingroup$
    @ArtemisFowl Either is fine.
    $endgroup$
    – Robin Ryder
    Apr 16 at 6:46










  • $begingroup$
    I thought so, but my question was: can we mix them?
    $endgroup$
    – Artemis Fowl
    Apr 16 at 15:03










  • $begingroup$
    @ArtemisFowl Yes, you can mix them.
    $endgroup$
    – Robin Ryder
    Apr 16 at 15:05












  • 4




    $begingroup$
    @TFeld no letter appears twice
    $endgroup$
    – feersum
    Apr 15 at 11:06










  • $begingroup$
    A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise. For Python (and most other languages, I expect), both [] and 0 are falsey. Can we output either, or must our output be consistent?
    $endgroup$
    – Artemis Fowl
    Apr 15 at 23:35










  • $begingroup$
    @ArtemisFowl Either is fine.
    $endgroup$
    – Robin Ryder
    Apr 16 at 6:46










  • $begingroup$
    I thought so, but my question was: can we mix them?
    $endgroup$
    – Artemis Fowl
    Apr 16 at 15:03










  • $begingroup$
    @ArtemisFowl Yes, you can mix them.
    $endgroup$
    – Robin Ryder
    Apr 16 at 15:05







4




4




$begingroup$
@TFeld no letter appears twice
$endgroup$
– feersum
Apr 15 at 11:06




$begingroup$
@TFeld no letter appears twice
$endgroup$
– feersum
Apr 15 at 11:06












$begingroup$
A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise. For Python (and most other languages, I expect), both [] and 0 are falsey. Can we output either, or must our output be consistent?
$endgroup$
– Artemis Fowl
Apr 15 at 23:35




$begingroup$
A truthy value if the list of words is a valid solution to the Letter Boxed challenge for those 4×3 letters, and a falsey value otherwise. For Python (and most other languages, I expect), both [] and 0 are falsey. Can we output either, or must our output be consistent?
$endgroup$
– Artemis Fowl
Apr 15 at 23:35












$begingroup$
@ArtemisFowl Either is fine.
$endgroup$
– Robin Ryder
Apr 16 at 6:46




$begingroup$
@ArtemisFowl Either is fine.
$endgroup$
– Robin Ryder
Apr 16 at 6:46












$begingroup$
I thought so, but my question was: can we mix them?
$endgroup$
– Artemis Fowl
Apr 16 at 15:03




$begingroup$
I thought so, but my question was: can we mix them?
$endgroup$
– Artemis Fowl
Apr 16 at 15:03












$begingroup$
@ArtemisFowl Yes, you can mix them.
$endgroup$
– Robin Ryder
Apr 16 at 15:05




$begingroup$
@ArtemisFowl Yes, you can mix them.
$endgroup$
– Robin Ryder
Apr 16 at 15:05










12 Answers
12






active

oldest

votes


















6














$begingroup$

JavaScript (ES6),  130  126 bytes



Takes input as (letters)(words). Returns $0$ or $1$.





L=>W=>L.every(a=>a.every(x=>(W+'').match(x,a.map(y=>s+='|'+x+y))),p=s=1)&W.every(w=>w[2]&&p|w[0]==p&!w.match(s,p=w.slice(-1)))


Try it online!



Step 1



We first iterate over $L$ to build a pipe-separated string $s$ consisting of all invalid pairs of letters. While doing so, we also make sure that each letter appears at least once in some word.



L.every(a => // for each group of letter a[] in L[]:
a.every(x => // for each letter x in a[]:
(W + '') // coerce W[] to a string
.match( // and test whether ...
x, // ... x can be found in it
a.map(y => // for each letter y in a[]:
s += '|' + x + y // append '|' + x + y to s
) // end of map()
) // end of match()
), // end of inner every()
p = s = 1 // start with p = s = 1
) // end of outer every()


Step 2



We now iterate over $W$ to test each word.



W.every(w => // for each word w in W[]:
w[2] && // is this word at least 3 characters long?
p | // is it the first word? (p = 1)
w[0] == p & // or does it start with the last letter of the previous word?
!w.match( // and finally make sure that ...
s, // ... it doesn't contain any invalid pair of letters
p = w.slice(-1) // and update p to the last letter of w
) // end of match()
) // end of every()





share|improve this answer











$endgroup$






















    6














    $begingroup$


    Jelly, 30 29 bytes



    FQṢ=Ṣ},i@€€’:3Iʋ,Ẉ>2ɗ,U=ḢɗƝ Flatten the word list
    Q | The sorted letterbox letters
    , ʋ | Pair this with the following:
    i@€€ | The index of each letter of each word in the letterbox
    ’ | Decrease by 1
    :3 | Integer divide by 3
    I | Differences between consecutive ones (will be zero if any two consecutive letters in a word from same side of box)
    , ɗ | Pair everything so far with the following:
    Ẉ>2 | Whether length of each input word is greater than 2
    , ɗƝ Compare characters to second
    Ḣ DO2@¹ü«εüQO}²¹˜êQ)˜P


    -2 bytes by taking inspiration of the ê approach @Emigna used in his 05AB1E answer.

    -3 bytes thanks to @Grimy.



    Takes a list of list of characters for the words as first input, and the flattened list of twelve letters as second input.



    Try it online or verify all test cases.



    Explanation:





    ε # Map over the character-lists `y` of the (implicit) input-list of words:
    k # Get the index of each character in the (implicit) input-list of letters
    3÷ # Integer-divide each index by 3
    üÊ # Check for each overlapping pair of integers that they are NOT equal
    D # After the map: duplicate the resulting list
    O # Get the sum of each inner list of truthy/falsey values
    2@ # And check that each is larger than 2 (so all words had at least 3 letters)
    ¹ü # Get all overlapping pairs of character-lists from the input-list of words:
    « # And merge them together to a flattened list of characters
    ε } # Map over those merged character lists:
    üQ # Check for each overlapping pair of characters in the list that they are equal
    O # And take the sum of this (where we'd expect 1/truthy if the last character of
    # the first word and the first character of the second word are equal)
    # (NOTE: This could fail for inputs with identical adjacent characters,
    # but the earlier check of `εk3÷üÊ}` already covers for this)
    ²improve this answer











    $endgroup$










    • 1




      $begingroup$
      @Grimy Ah, that first comment is indeed an obvious one. I've just changed it to a character array, so now that indeed works where it wouldn't before when the words were still strings. That second approach of merge, check pair equality, sum is quite brilliant, though! :D Thanks (as always).
      $endgroup$
      – Kevin Cruijssen
      10 hours ago







    • 1




      $begingroup$
      Another -1: ¹€g3@ -> DO2@ after the first check (TIO)
      $endgroup$
      – Grimy
      10 hours ago







    • 1




      $begingroup$
      @Grimy Another nice one, thanks. We're now below the Jelly answer of 29. :)
      $endgroup$
      – Kevin Cruijssen
      10 hours ago










    share|improve this answer









    $endgroup$














    • $begingroup$
      It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
      $endgroup$
      – Kevin Cruijssen
      Apr 15 at 13:52


















    4














    $begingroup$


    Python 2, 171 bytes





    lambda l,w:(set(sum(l,[]))==set(''.join(w)))*all(a[-1]==b[0]for a,b in zip(w,w[1:]))*all((a in g)+(b in g)<2for x in w for a,b in zip(x,x[1:])for g in l)*min(map(len,w))>2


    Try it online!






    share|improve this answer









    $endgroup$






















      4














      $begingroup$


      Jelly, 34 bytes



      Ṫ=¥/ƝḢ€Ạȧ⁸Fe€ⱮZḄ;IẠƊȧF}fƑF 














      3














      $begingroup$


      Java (JDK), 188 bytes





      g->w->=2<<(p=z))z=g.indexOf(y=w[i][j++]);return v&x==8190;


      Try it online!



      Explanations



      g->w-> // Lambda accepting letter groups as a string and a list of words, in the form of an array of char arrays.
      var v=0<1; // Validity variable
      int x=0, // The letter coverage (rule 4)
      l, // The length of w[i]
      i=0, // The w iterator
      j, // The w[i] iterator
      p, // The previous group
      z, // The current group
      y=w[0][0]; // The previous character
      for(;i<w.length;i++) // For each word...
      for(
      l=w[i].length, // make a shortcut for the length
      v&=y==w[i][0]&l>2, // check if the last character of the previous word is the same as the first of the current.
      // Also, check if the length is at least 3
      j=0, // Reset the iteration
      p=-9 // Set p to an impossible value.
      ;
      j<l //
      ;
      v&=z>=0&z/3!=p/3, // Check that each letter of the word is in the letter pool,
      // and that the current letter group isn't the same as the previous one.
      x


      Credits



      • -2 bytes thanks to ceilingcat





      share,i@€€’:3Iʋ,Ẉ>2ɗ,U=ḢɗƝ Flatten the word list
      Q | The sorted letterbox letters
      , ʋ | Pair this with the following:
      i@€€ | The index of each letter of each word in the letterbox
      ’ | Decrease by 1
      :3 | Integer divide by 3
      I | Differences between consecutive ones (will be zero if any two consecutive letters in a word from same side of box)
      , ɗ | Pair everything so far with the following:
      Ẉ>2 | Whether length of each input word is greater than 2
      , ɗƝ Flatten all of the above and check there are no false values





      share,i@€€’:3Iʋ,Ẉ>2ɗ,U=ḢɗƝ Flatten the word list
      Q | The sorted letterbox letters
      , ʋ | Pair this with the following:
      i@€€ | The index of each letter of each word in the letterbox
      ’ | Decrease by 1
      :3 | Integer divide by 3
      I | Differences between consecutive ones (will be zero if any two consecutive letters in a word from same side of box)
      , ɗ | Pair everything so far with the following:
      Ẉ>2 | Whether length of each input word is greater than 2
      , ɗƝ ,i@€€’:3Iʋ,Ẉ>2ɗ,U=ḢɗƝ Flatten the word list
      Q | The sorted letterbox letters
      , ʋ | Pair this with the following:
      i@€€ | The index of each letter of each word in the letterbox
      ’ | Decrease by 1
      :3 | Integer divide by 3
      I | Differences between consecutive ones (will be zero if any two consecutive letters in a word from same side of box)
      , ɗ | Pair everything so far with the following:
      Ẉ>2 | Whether length of each input word is greater than 2
      , ɗƝ
      improve this answer











      $endgroup$




      Jelly, 30 29 bytes



      FQṢ=Ṣ,i@€€’:3Iʋ,Ẉ>2ɗ,U=ḢɗƝ Flatten the word list
      Q | The sorted letterbox letters
      , ʋ | Pair this with the following:
      i@€€ | The index of each letter of each word in the letterbox
      ’ | Decrease by 1
      :3 | Integer divide by 3
      I | Differences between consecutive ones (will be zero if any two consecutive letters in a word from same side of box)
      , ɗ | Pair everything so far with the following:
      Ẉ>2 | Whether length of each input word is greater than 2
      , ɗƝ Upend (reverse) first word
      = DO2@¹ü«εüQO}²¹˜êQ)˜P


      -2 bytes by taking inspiration of the ê approach @Emigna used in his 05AB1E answer.

      -3 bytes thanks to @Grimy.



      Takes a list of list of characters for the words as first input, and the flattened list of twelve letters as second input.



      Try it online or verify all test cases.



      Explanation:





      ε # Map over the character-lists `y` of the (implicit) input-list of words:
      k # Get the index of each character in the (implicit) input-list of letters
      3÷ # Integer-divide each index by 3
      üÊ # Check for each overlapping pair of integers that they are NOT equal
      D # After the map: duplicate the resulting list
      O # Get the sum of each inner list of truthy/falsey values
      2@ # And check that each is larger than 2 (so all words had at least 3 letters)
      ¹ü # Get all overlapping pairs of character-lists from the input-list of words:
      « # And merge them together to a flattened list of characters
      ε } # Map over those merged character lists:
      üQ # Check for each overlapping pair of characters in the list that they are equal
      O # And take the sum of this (where we'd expect 1/truthy if the last character of
      # the first word and the first character of the second word are equal)
      # (NOTE: This could fail for inputs with identical adjacent characters,
      # but the earlier check of `εk3÷üÊ}` already covers for this)
      ²improve this answer











      $endgroup$










      • 1




        $begingroup$
        @Grimy Ah, that first comment is indeed an obvious one. I've just changed it to a character array, so now that indeed works where it wouldn't before when the words were still strings. That second approach of merge, check pair equality, sum is quite brilliant, though! :D Thanks (as always).
        $endgroup$
        – Kevin Cruijssen
        10 hours ago







      • 1




        $begingroup$
        Another -1: ¹€g3@ -> DO2@ after the first check (TIO)
        $endgroup$
        – Grimy
        10 hours ago







      • 1




        $begingroup$
        @Grimy Another nice one, thanks. We're now below the Jelly answer of 29. :)
        $endgroup$
        – Kevin Cruijssen
        10 hours ago

















      $endgroup$










      • 1




        $begingroup$
        @Grimy Ah, that first comment is indeed an obvious one. I've just changed it to a character array, so now that indeed works where it wouldn't before when the words were still strings. That second approach of merge, check pair equality, sum is quite brilliant, though! :D Thanks (as always).
        $endgroup$
        – Kevin Cruijssen
        10 hours ago







      • 1




        $begingroup$
        Another -1: ¹€g3@ -> DO2@ after the first check (TIO)
        $endgroup$
        – Grimy
        10 hours ago







      • 1




        $begingroup$
        @Grimy Another nice one, thanks. We're now below the Jelly answer of 29. :)
        $endgroup$
        – Kevin Cruijssen
        10 hours ago










      shareDO2@¹ü«εüQO}²¹˜êQ)˜P


      -2 bytes by taking inspiration of the ê approach @Emigna used in his 05AB1E answer.

      -3 bytes thanks to @Grimy.



      Takes a list of list of characters for the words as first input, and the flattened list of twelve letters as second input.



      Try it online or verify all test cases.



      Explanation:





      ε # Map over the character-lists `y` of the (implicit) input-list of words:
      k # Get the index of each character in the (implicit) input-list of letters
      3÷ # Integer-divide each index by 3
      üÊ # Check for each overlapping pair of integers that they are NOT equal
      D # After the map: duplicate the resulting list
      O # Get the sum of each inner list of truthy/falsey values
      2@ # And check that each is larger than 2 (so all words had at least 3 letters)
      ¹ü # Get all overlapping pairs of character-lists from the input-list of words:
      « # And merge them together to a flattened list of characters
      ε } # Map over those merged character lists:
      üQ # Check for each overlapping pair of characters in the list that they are equal
      O # And take the sum of this (where we'd expect 1/truthy if the last character of
      # the first word and the first character of the second word are equal)
      # (NOTE: This could fail for inputs with identical adjacent characters,
      # but the earlier check of `εk3÷üÊ}` already covers for this)
      ² 









      • 1




        $begingroup$
        @Grimy Ah, that first comment is indeed an obvious one. I've just changed it to a character array, so now that indeed works where it wouldn't before when the words were still strings. That second approach of merge, check pair equality, sum is quite brilliant, though! :D Thanks (as always).
        $endgroup$
        – Kevin Cruijssen
        10 hours ago







      • 1




        $begingroup$
        Another -1: ¹€g3@ -> DO2@ after the first check (TIO)
        $endgroup$
        – Grimy
        10 hours ago







      • 1




        $begingroup$
        @Grimy Another nice one, thanks. We're now below the Jelly answer of 29. :)
        $endgroup$
        – Kevin Cruijssen
        10 hours ago








      1




      1




      $begingroup$
      @Grimy Ah, that first comment is indeed an obvious one. I've just changed it to a character array, so now that indeed works where it wouldn't before when the words were still strings. That second approach of merge, check pair equality, sum is quite brilliant, though! :D Thanks (as always).
      $endgroup$
      – Kevin Cruijssen
      10 hours ago





      $begingroup$
      @Grimy Ah, that first comment is indeed an obvious one. I've just changed it to a character array, so now that indeed works where it wouldn't before when the words were still strings. That second approach of merge, check pair equality, sum is quite brilliant, though! :D Thanks (as always).
      $endgroup$
      – Kevin Cruijssen
      10 hours ago





      1




      1




      $begingroup$
      Another -1: ¹€g3@ -> DO2@ after the first check (TIO)
      $endgroup$
      – Grimy
      10 hours ago





      $begingroup$
      Another -1: ¹€g3@ -> DO2@ after the first check (TIO)
      $endgroup$
      – Grimy
      10 hours ago





      1




      1




      $begingroup$
      @Grimy Another nice one, thanks. We're now below the Jelly answer of 29. :)
      $endgroup$
      – Kevin Cruijssen
      10 hours ago





      $begingroup$
      @Grimy Another nice one, thanks. We're now below the Jelly answer of 29. :)
      $endgroup$
      – Kevin Cruijssen
      10 hours ago







      share|improve this answer









      $endgroup$














      • $begingroup$
        It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
        $endgroup$
        – Kevin Cruijssen
        Apr 15 at 13:52















      5














      $begingroup$


      05AB1E, 42 bytes



      εg2›}P¹εεUIεXå}ƶO}üÊP}P¹ü‚ε`нsθQ}P¹Jê²JêQP


      Try it online!






      share|improve this answer









      $endgroup$














      • $begingroup$
        It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
        $endgroup$
        – Kevin Cruijssen
        Apr 15 at 13:52













      5














      5










      5







      $begingroup$


      05AB1E, 42 bytes



      εg2›}P¹εεUIεXå}ƶO}üÊP}P¹ü‚ε`нsθQ}P¹Jê²JêQP


      Try it online!






      share|improve this answer









      $endgroup$




      05AB1E, 42 bytes



      εg2›}P¹εεUIεXå}ƶO}üÊP}P¹ü‚ε`нsθQ}P¹Jê²JêQP


      Try it online!







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Apr 15 at 11:50









      EmignaEmigna

      50.4k5 gold badges37 silver badges153 bronze badges




      50.4k5 gold badges37 silver badges153 bronze badges














      • $begingroup$
        It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
        $endgroup$
        – Kevin Cruijssen
        Apr 15 at 13:52
















      • $begingroup$
        It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
        $endgroup$
        – Kevin Cruijssen
        Apr 15 at 13:52















      $begingroup$
      It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
      $endgroup$
      – Kevin Cruijssen
      Apr 15 at 13:52




      $begingroup$
      It's not much, but a byte can be saved by removing all P after the maps, and use )˜P at the end. 41 bytes Nice approach with ê however! Saved 2 bytes in my 05AB1E answer.
      $endgroup$
      – Kevin Cruijssen
      Apr 15 at 13:52











      4














      $begingroup$


      Python 2, 171 bytes





      lambda l,w:(set(sum(l,[]))==set(''.join(w)))*all(a[-1]==b[0]for a,b in zip(w,w[1:]))*all((a in g)+(b in g)<2for x in w for a,b in zip(x,x[1:])for g in l)*min(map(len,w))>2


      Try it online!






      share|improve this answer









      $endgroup$



















        4














        $begingroup$


        Python 2, 171 bytes





        lambda l,w:(set(sum(l,[]))==set(''.join(w)))*all(a[-1]==b[0]for a,b in zip(w,w[1:]))*all((a in g)+(b in g)<2for x in w for a,b in zip(x,x[1:])for g in l)*min(map(len,w))>2


        Try it online!






        share|improve this answer









        $endgroup$

















          4














          4










          4







          $begingroup$


          Python 2, 171 bytes





          lambda l,w:(set(sum(l,[]))==set(''.join(w)))*all(a[-1]==b[0]for a,b in zip(w,w[1:]))*all((a in g)+(b in g)<2for x in w for a,b in zip(x,x[1:])for g in l)*min(map(len,w))>2


          Try it online!






          share|improve this answer









          $endgroup$




          Python 2, 171 bytes





          lambda l,w:(set(sum(l,[]))==set(''.join(w)))*all(a[-1]==b[0]for a,b in zip(w,w[1:]))*all((a in g)+(b in g)<2for x in w for a,b in zip(x,x[1:])for g in l)*min(map(len,w))>2


          Try it online!







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 15 at 11:11









          TFeldTFeld

          18.6k3 gold badges14 silver badges58 bronze badges




          18.6k3 gold badges14 silver badges58 bronze badges
























              4














              $begingroup$


              Jelly, 34 bytes



              Ṫ=¥/ƝḢ€Ạȧ⁸Fe€ⱮZḄ;IẠƊȧF}fƑFimprove this answer









              $endgroup$


















                $endgroup$


















                  $endgroup$




                  Jelly, 34 bytes



                  Ṫ=¥/ƝḢ€Ạȧ⁸Fe€ⱮZḄ;IẠƊȧFfƑF{
                  ẈṂ>2ȧç


                  A dyadic Link accepting the words on the left and the letter groups on the right which yields 1 if valid and 0 if not.



                  Try it online! Or see the test-suite.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 15 at 13:15









                  Jonathan AllanJonathan Allan

                  60.4k5 gold badges44 silver badges187 bronze badges




                  60.4k5 gold badges44 silver badges187 bronze badges
























                      4














                      $begingroup$


                      Haskell, 231 bytes





                      import Data.List
                      l&w=all((>2).length)w&&c w&&all(l!)w&&(h l)%(h w)
                      h=concat
                      l%w=null[x|x<-l,x`notElem`w]
                      l!(a:b:c)=a#l?(b#l)&&l!(b:c)
                      l!_=1>0
                      Just a?Just b=a/=b
                      _?_=1<0
                      c#l=findIndex(elem c)l
                      c(a:b:t)=last a==head b&&c(b:t)
                      c _=1>0


                      Try it online!



                      Not the best score. Some Haskell guru will probably be able to get this under 100 bytes.



                      Usage





                      ["ICO","MRE","GNS","APL"]&["CROPS", "SAIL", "LEAN", "NOPE", "ENIGMA"]


                      Explanation





                      import Data.List
                      l&w = all((>2).length)w && -- Every word has length > 2
                      c w && -- Every word ends with the same letter as the next one starts with
                      all(l!)w && -- For every word: Consecutive letters are on different sides (and must exist on a side)
                      (h l)%(h w) -- All letters are used

                      h=concat -- Just a shorthand

                      l%w=null[x|x<-l,x`notElem`w] -- The letters of l, with all letters of w removed, is empty

                      l!(a:b:c)=a#l?(b#l)&&l!(b:c) -- Sides of the first two letters are different, recurse from second letter
                      l!_=1>0 -- Until fewer than 2 letters remain

                      Just a?Just b=a/=b -- Both sides must be different
                      _?_=1<0 -- And must exist

                      c#l=findIndex(elem c)l -- Find the side of letter c

                      c(a:b:t)=last a==head b&&c(b:t) -- Last letter of the first word must be same as first letter of second word, recurse starting from second word
                      c _=1>0 -- Until there are fewer than 2 words





                      share|improve this answer









                      $endgroup$



















                        4














                        $begingroup$


                        Haskell, 231 bytes





                        import Data.List
                        l&w=all((>2).length)w&&c w&&all(l!)w&&(h l)%(h w)
                        h=concat
                        l%w=null[x|x<-l,x`notElem`w]
                        l!(a:b:c)=a#l?(b#l)&&l!(b:c)
                        l!_=1>0
                        Just a?Just b=a/=b
                        _?_=1<0
                        c#l=findIndex(elem c)l
                        c(a:b:t)=last a==head b&&c(b:t)
                        c _=1>0


                        Try it online!



                        Not the best score. Some Haskell guru will probably be able to get this under 100 bytes.



                        Usage





                        ["ICO","MRE","GNS","APL"]&["CROPS", "SAIL", "LEAN", "NOPE", "ENIGMA"]


                        Explanation





                        import Data.List
                        l&w = all((>2).length)w && -- Every word has length > 2
                        c w && -- Every word ends with the same letter as the next one starts with
                        all(l!)w && -- For every word: Consecutive letters are on different sides (and must exist on a side)
                        (h l)%(h w) -- All letters are used

                        h=concat -- Just a shorthand

                        l%w=null[x|x<-l,x`notElem`w] -- The letters of l, with all letters of w removed, is empty

                        l!(a:b:c)=a#l?(b#l)&&l!(b:c) -- Sides of the first two letters are different, recurse from second letter
                        l!_=1>0 -- Until fewer than 2 letters remain

                        Just a?Just b=a/=b -- Both sides must be different
                        _?_=1<0 -- And must exist

                        c#l=findIndex(elem c)l -- Find the side of letter c

                        c(a:b:t)=last a==head b&&c(b:t) -- Last letter of the first word must be same as first letter of second word, recurse starting from second word
                        c _=1>0 -- Until there are fewer than 2 words





                        share|improve this answer









                        $endgroup$

















                          4














                          4










                          4







                          $begingroup$


                          Haskell, 231 bytes





                          import Data.List
                          l&w=all((>2).length)w&&c w&&all(l!)w&&(h l)%(h w)
                          h=concat
                          l%w=null[x|x<-l,x`notElem`w]
                          l!(a:b:c)=a#l?(b#l)&&l!(b:c)
                          l!_=1>0
                          Just a?Just b=a/=b
                          _?_=1<0
                          c#l=findIndex(elem c)l
                          c(a:b:t)=last a==head b&&c(b:t)
                          c _=1>0


                          Try it online!



                          Not the best score. Some Haskell guru will probably be able to get this under 100 bytes.



                          Usage





                          ["ICO","MRE","GNS","APL"]&["CROPS", "SAIL", "LEAN", "NOPE", "ENIGMA"]


                          Explanation





                          import Data.List
                          l&w = all((>2).length)w && -- Every word has length > 2
                          c w && -- Every word ends with the same letter as the next one starts with
                          all(l!)w && -- For every word: Consecutive letters are on different sides (and must exist on a side)
                          (h l)%(h w) -- All letters are used

                          h=concat -- Just a shorthand

                          l%w=null[x|x<-l,x`notElem`w] -- The letters of l, with all letters of w removed, is empty

                          l!(a:b:c)=a#l?(b#l)&&l!(b:c) -- Sides of the first two letters are different, recurse from second letter
                          l!_=1>0 -- Until fewer than 2 letters remain

                          Just a?Just b=a/=b -- Both sides must be different
                          _?_=1<0 -- And must exist

                          c#l=findIndex(elem c)l -- Find the side of letter c

                          c(a:b:t)=last a==head b&&c(b:t) -- Last letter of the first word must be same as first letter of second word, recurse starting from second word
                          c _=1>0 -- Until there are fewer than 2 words





                          share|improve this answer









                          $endgroup$




                          Haskell, 231 bytes





                          import Data.List
                          l&w=all((>2).length)w&&c w&&all(l!)w&&(h l)%(h w)
                          h=concat
                          l%w=null[x|x<-l,x`notElem`w]
                          l!(a:b:c)=a#l?(b#l)&&l!(b:c)
                          l!_=1>0
                          Just a?Just b=a/=b
                          _?_=1<0
                          c#l=findIndex(elem c)l
                          c(a:b:t)=last a==head b&&c(b:t)
                          c _=1>0


                          Try it online!



                          Not the best score. Some Haskell guru will probably be able to get this under 100 bytes.



                          Usage





                          ["ICO","MRE","GNS","APL"]&["CROPS", "SAIL", "LEAN", "NOPE", "ENIGMA"]


                          Explanation





                          import Data.List
                          l&w = all((>2).length)w && -- Every word has length > 2
                          c w && -- Every word ends with the same letter as the next one starts with
                          all(l!)w && -- For every word: Consecutive letters are on different sides (and must exist on a side)
                          (h l)%(h w) -- All letters are used

                          h=concat -- Just a shorthand

                          l%w=null[x|x<-l,x`notElem`w] -- The letters of l, with all letters of w removed, is empty

                          l!(a:b:c)=a#l?(b#l)&&l!(b:c) -- Sides of the first two letters are different, recurse from second letter
                          l!_=1>0 -- Until fewer than 2 letters remain

                          Just a?Just b=a/=b -- Both sides must be different
                          _?_=1<0 -- And must exist

                          c#l=findIndex(elem c)l -- Find the side of letter c

                          c(a:b:t)=last a==head b&&c(b:t) -- Last letter of the first word must be same as first letter of second word, recurse starting from second word
                          c _=1>0 -- Until there are fewer than 2 words






                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Apr 15 at 15:16









                          Paul MutserPaul Mutser

                          1213 bronze badges




                          1213 bronze badges
























                              4














                              $begingroup$


                              Haskell, 231 bytes



                              A different Haskell variation, exactly the same size as @Paul Mutser's :)





                              import Data.List
                              f x=filter(a->length a>1)$concatMap subsequences x
                              g=nub.concat.f
                              p l(x:y)=foldl((m,n)c->(c,n&&length c>2&&(not$any(`isInfixOf`c)(f l))&&last m==head c))(x,True)y
                              z l w=null(g l\g w)&&null(g w\g l)&&(snd$p l w)


                              Try it online!



                              Ungolfed



                              -- generate all invalid substrings
                              f :: [String] -> [String]
                              f xs = filter (x -> length x > 1) $ concatMap subsequences xs

                              -- utility function to flatten and remove duplicates
                              g :: [String] -> String
                              g = nub $ concat $ f

                              -- verify that all conditions are satisfied along the list
                              p :: [String] -> [String] -> (String, Bool)
                              p l (x:xs) = foldl ((m,n) c -> (c , n && length c > 2 && (not $ any (`isInfixOf` c)(f l)) && last m == head c)) (x, True) xs

                              -- put all the pieces together and consume input
                              z :: [String] -> [String] -> Bool
                              z l w = null (g l \ g w) && null (g w \ g l) && (snd $ p l w)





                              share|improve this answer











                              $endgroup$



















                                4














                                $begingroup$


                                Haskell, 231 bytes



                                A different Haskell variation, exactly the same size as @Paul Mutser's :)





                                import Data.List
                                f x=filter(a->length a>1)$concatMap subsequences x
                                g=nub.concat.f
                                p l(x:y)=foldl((m,n)c->(c,n&&length c>2&&(not$any(`isInfixOf`c)(f l))&&last m==head c))(x,True)y
                                z l w=null(g l\g w)&&null(g w\g l)&&(snd$p l w)


                                Try it online!



                                Ungolfed



                                -- generate all invalid substrings
                                f :: [String] -> [String]
                                f xs = filter (x -> length x > 1) $ concatMap subsequences xs

                                -- utility function to flatten and remove duplicates
                                g :: [String] -> String
                                g = nub $ concat $ f

                                -- verify that all conditions are satisfied along the list
                                p :: [String] -> [String] -> (String, Bool)
                                p l (x:xs) = foldl ((m,n) c -> (c , n && length c > 2 && (not $ any (`isInfixOf` c)(f l)) && last m == head c)) (x, True) xs

                                -- put all the pieces together and consume input
                                z :: [String] -> [String] -> Bool
                                z l w = null (g l \ g w) && null (g w \ g l) && (snd $ p l w)





                                share|improve this answer











                                $endgroup$

















                                  4














                                  4










                                  4







                                  $begingroup$


                                  Haskell, 231 bytes



                                  A different Haskell variation, exactly the same size as @Paul Mutser's :)





                                  import Data.List
                                  f x=filter(a->length a>1)$concatMap subsequences x
                                  g=nub.concat.f
                                  p l(x:y)=foldl((m,n)c->(c,n&&length c>2&&(not$any(`isInfixOf`c)(f l))&&last m==head c))(x,True)y
                                  z l w=null(g l\g w)&&null(g w\g l)&&(snd$p l w)


                                  Try it online!



                                  Ungolfed



                                  -- generate all invalid substrings
                                  f :: [String] -> [String]
                                  f xs = filter (x -> length x > 1) $ concatMap subsequences xs

                                  -- utility function to flatten and remove duplicates
                                  g :: [String] -> String
                                  g = nub $ concat $ f

                                  -- verify that all conditions are satisfied along the list
                                  p :: [String] -> [String] -> (String, Bool)
                                  p l (x:xs) = foldl ((m,n) c -> (c , n && length c > 2 && (not $ any (`isInfixOf` c)(f l)) && last m == head c)) (x, True) xs

                                  -- put all the pieces together and consume input
                                  z :: [String] -> [String] -> Bool
                                  z l w = null (g l \ g w) && null (g w \ g l) && (snd $ p l w)





                                  share|improve this answer











                                  $endgroup$




                                  Haskell, 231 bytes



                                  A different Haskell variation, exactly the same size as @Paul Mutser's :)





                                  import Data.List
                                  f x=filter(a->length a>1)$concatMap subsequences x
                                  g=nub.concat.f
                                  p l(x:y)=foldl((m,n)c->(c,n&&length c>2&&(not$any(`isInfixOf`c)(f l))&&last m==head c))(x,True)y
                                  z l w=null(g l\g w)&&null(g w\g l)&&(snd$p l w)


                                  Try it online!



                                  Ungolfed



                                  -- generate all invalid substrings
                                  f :: [String] -> [String]
                                  f xs = filter (x -> length x > 1) $ concatMap subsequences xs

                                  -- utility function to flatten and remove duplicates
                                  g :: [String] -> String
                                  g = nub $ concat $ f

                                  -- verify that all conditions are satisfied along the list
                                  p :: [String] -> [String] -> (String, Bool)
                                  p l (x:xs) = foldl ((m,n) c -> (c , n && length c > 2 && (not $ any (`isInfixOf` c)(f l)) && last m == head c)) (x, True) xs

                                  -- put all the pieces together and consume input
                                  z :: [String] -> [String] -> Bool
                                  z l w = null (g l \ g w) && null (g w \ g l) && (snd $ p l w)






                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited Apr 16 at 16:54

























                                  answered Apr 15 at 16:12









                                  bugsbugs

                                  2114 bronze badges




                                  2114 bronze badges
























                                      3














                                      $begingroup$


                                      Ruby, 126 bytes





                                      ->l,w^_


                                      Try it online!






                                      share|improve this answer











                                      $endgroup$














                                      • $begingroup$
                                        Nice, when I first saw the challenge I tried to do something similar, but gave up with a score somewhere in 140-ies. BTW, save a byte by dropping parentheses after grep.
                                        $endgroup$
                                        – Kirill L.
                                        Apr 17 at 18:04










                                      • $begingroup$
                                        This doesn't work when the last word is 1 or 2 letters long, e.g. puts f[l,['PILGRIMAGE','ENCLOSE','EG']] returns true instead of false.
                                        $endgroup$
                                        – Robin Ryder
                                        May 4 at 11:58






                                      • 1




                                        $begingroup$
                                        You are right, fixed.
                                        $endgroup$
                                        – G B
                                        May 4 at 21:15















                                      3














                                      $begingroup$


                                      Ruby, 126 bytes





                                      ->l,w^_


                                      Try it online!






                                      share|improve this answer











                                      $endgroup$














                                      • $begingroup$
                                        Nice, when I first saw the challenge I tried to do something similar, but gave up with a score somewhere in 140-ies. BTW, save a byte by dropping parentheses after grep.
                                        $endgroup$
                                        – Kirill L.
                                        Apr 17 at 18:04










                                      • $begingroup$
                                        This doesn't work when the last word is 1 or 2 letters long, e.g. puts f[l,['PILGRIMAGE','ENCLOSE','EG']] returns true instead of false.
                                        $endgroup$
                                        – Robin Ryder
                                        May 4 at 11:58






                                      • 1




                                        $begingroup$
                                        You are right, fixed.
                                        $endgroup$
                                        – G B
                                        May 4 at 21:15













                                      3














                                      3










                                      3







                                      $begingroup$


                                      Ruby, 126 bytes





                                      ->l,w^_


                                      Try it online!






                                      share|improve this answer











                                      $endgroup$




                                      Ruby, 126 bytes





                                      ->l,w^_


                                      Try it online!







                                      share|improve this answer














                                      share|improve this answer



                                      share|improve this answer








                                      edited May 4 at 21:16

























                                      answered Apr 17 at 6:40









                                      G BG B

                                      8,83614 silver badges30 bronze badges




                                      8,83614 silver badges30 bronze badges














                                      • $begingroup$
                                        Nice, when I first saw the challenge I tried to do something similar, but gave up with a score somewhere in 140-ies. BTW, save a byte by dropping parentheses after grep.
                                        $endgroup$
                                        – Kirill L.
                                        Apr 17 at 18:04










                                      • $begingroup$
                                        This doesn't work when the last word is 1 or 2 letters long, e.g. puts f[l,['PILGRIMAGE','ENCLOSE','EG']] returns true instead of false.
                                        $endgroup$
                                        – Robin Ryder
                                        May 4 at 11:58






                                      • 1




                                        $begingroup$
                                        You are right, fixed.
                                        $endgroup$
                                        – G B
                                        May 4 at 21:15
















                                      • $begingroup$
                                        Nice, when I first saw the challenge I tried to do something similar, but gave up with a score somewhere in 140-ies. BTW, save a byte by dropping parentheses after grep.
                                        $endgroup$
                                        – Kirill L.
                                        Apr 17 at 18:04










                                      • $begingroup$
                                        This doesn't work when the last word is 1 or 2 letters long, e.g. puts f[l,['PILGRIMAGE','ENCLOSE','EG']] returns true instead of false.
                                        $endgroup$
                                        – Robin Ryder
                                        May 4 at 11:58






                                      • 1




                                        $begingroup$
                                        You are right, fixed.
                                        $endgroup$
                                        – G B
                                        May 4 at 21:15















                                      $begingroup$
                                      Nice, when I first saw the challenge I tried to do something similar, but gave up with a score somewhere in 140-ies. BTW, save a byte by dropping parentheses after grep.
                                      $endgroup$
                                      – Kirill L.
                                      Apr 17 at 18:04




                                      $begingroup$
                                      Nice, when I first saw the challenge I tried to do something similar, but gave up with a score somewhere in 140-ies. BTW, save a byte by dropping parentheses after grep.
                                      $endgroup$
                                      – Kirill L.
                                      Apr 17 at 18:04












                                      $begingroup$
                                      This doesn't work when the last word is 1 or 2 letters long, e.g. puts f[l,['PILGRIMAGE','ENCLOSE','EG']] returns true instead of false.
                                      $endgroup$
                                      – Robin Ryder
                                      May 4 at 11:58




                                      $begingroup$
                                      This doesn't work when the last word is 1 or 2 letters long, e.g. puts f[l,['PILGRIMAGE','ENCLOSE','EG']] returns true instead of false.
                                      $endgroup$
                                      – Robin Ryder
                                      May 4 at 11:58




                                      1




                                      1




                                      $begingroup$
                                      You are right, fixed.
                                      $endgroup$
                                      – G B
                                      May 4 at 21:15




                                      $begingroup$
                                      You are right, fixed.
                                      $endgroup$
                                      – G B
                                      May 4 at 21:15











                                      3














                                      $begingroup$


                                      Java (JDK), 188 bytes





                                      g->w->=2<<(p=z))z=g.indexOf(y=w[i][j++]);return v&x==8190;


                                      Try it online!



                                      Explanations



                                      g->w-> // Lambda accepting letter groups as a string and a list of words, in the form of an array of char arrays.
                                      var v=0<1; // Validity variable
                                      int x=0, // The letter coverage (rule 4)
                                      l, // The length of w[i]
                                      i=0, // The w iterator
                                      j, // The w[i] iterator
                                      p, // The previous group
                                      z, // The current group
                                      y=w[0][0]; // The previous character
                                      for(;i<w.length;i++) // For each word...
                                      for(
                                      l=w[i].length, // make a shortcut for the length
                                      v&=y==w[i][0]&l>2, // check if the last character of the previous word is the same as the first of the current.
                                      // Also, check if the length is at least 3
                                      j=0, // Reset the iteration
                                      p=-9 // Set p to an impossible value.
                                      ;
                                      j<l //
                                      ;
                                      v&=z>=0&z/3!=p/3, // Check that each letter of the word is in the letter pool,
                                      // and that the current letter group isn't the same as the previous one.
                                      x


                                      Credits



                                      • -2 bytes thanks to ceilingcat





                                      share|improve this answer











                                      $endgroup$



















                                        3














                                        $begingroup$


                                        Java (JDK), 188 bytes





                                        g->w->=2<<(p=z))z=g.indexOf(y=w[i][j++]);return v&x==8190;


                                        Try it online!



                                        Explanations



                                        g->w-> // Lambda accepting letter groups as a string and a list of words, in the form of an array of char arrays.
                                        var v=0<1; // Validity variable
                                        int x=0, // The letter coverage (rule 4)
                                        l, // The length of w[i]
                                        i=0, // The w iterator
                                        j, // The w[i] iterator
                                        p, // The previous group
                                        z, // The current group
                                        y=w[0][0]; // The previous character
                                        for(;i<w.length;i++) // For each word...
                                        for(
                                        l=w[i].length, // make a shortcut for the length
                                        v&=y==w[i][0]&l>2, // check if the last character of the previous word is the same as the first of the current.
                                        // Also, check if the length is at least 3
                                        j=0, // Reset the iteration
                                        p=-9 // Set p to an impossible value.
                                        ;
                                        j<l //
                                        ;
                                        v&=z>=0&z/3!=p/3, // Check that each letter of the word is in the letter pool,
                                        // and that the current letter group isn't the same as the previous one.
                                        x


                                        Credits



                                        • -2 bytes thanks to ceilingcat





                                        share|improve this answer











                                        $endgroup$

















                                          3














                                          3










                                          3







                                          $begingroup$


                                          Java (JDK), 188 bytes





                                          g->w->=2<<(p=z))z=g.indexOf(y=w[i][j++]);return v&x==8190;


                                          Try it online!



                                          Explanations



                                          g->w-> // Lambda accepting letter groups as a string and a list of words, in the form of an array of char arrays.
                                          var v=0<1; // Validity variable
                                          int x=0, // The letter coverage (rule 4)
                                          l, // The length of w[i]
                                          i=0, // The w iterator
                                          j, // The w[i] iterator
                                          p, // The previous group
                                          z, // The current group
                                          y=w[0][0]; // The previous character
                                          for(;i<w.length;i++) // For each word...
                                          for(
                                          l=w[i].length, // make a shortcut for the length
                                          v&=y==w[i][0]&l>2, // check if the last character of the previous word is the same as the first of the current.
                                          // Also, check if the length is at least 3
                                          j=0, // Reset the iteration
                                          p=-9 // Set p to an impossible value.
                                          ;
                                          j<l //
                                          ;
                                          v&=z>=0&z/3!=p/3, // Check that each letter of the word is in the letter pool,
                                          // and that the current letter group isn't the same as the previous one.
                                          x


                                          Credits



                                          • -2 bytes thanks to ceilingcat





                                          share|improve this answer











                                          $endgroup$




                                          Java (JDK), 188 bytes





                                          g->w->=2<<(p=z))z=g.indexOf(y=w[i][j++]);return v&x==8190;


                                          Try it online!



                                          Explanations



                                          g->w-> // Lambda accepting letter groups as a string and a list of words, in the form of an array of char arrays.
                                          var v=0<1; // Validity variable
                                          int x=0, // The letter coverage (rule 4)
                                          l, // The length of w[i]
                                          i=0, // The w iterator
                                          j, // The w[i] iterator
                                          p, // The previous group
                                          z, // The current group
                                          y=w[0][0]; // The previous character
                                          for(;i<w.length;i++) // For each word...
                                          for(
                                          l=w[i].length, // make a shortcut for the length
                                          v&=y==w[i][0]&l>2, // check if the last character of the previous word is the same as the first of the current.
                                          // Also, check if the length is at least 3
                                          j=0, // Reset the iteration
                                          p=-9 // Set p to an impossible value.
                                          ;
                                          j<l //
                                          ;
                                          v&=z>=0&z/3!=p/3, // Check that each letter of the word is in the letter pool,
                                          // and that the current letter group isn't the same as the previous one.
                                          x


                                          Credits



                                          • -2 bytes thanks to ceilingcat






                                          share|improve this answer














                                          share|improve this answer



                                          share|improve this answer








                                          edited 11 hours ago

























                                          answered Apr 16 at 9:47









                                          Olivier GrégoireOlivier Grégoire

                                          9,8671 gold badge19 silver badges45 bronze badges




                                          9,8671 gold badge19 silver badges45 bronze badges
























                                              2














                                              $begingroup$


                                              Charcoal, 63 bytes



                                              ⌊⁺⁺⁺⭆η›Lι²⭆⪫ηω№⪫θωι⭆⪫θω№⪫ηωι⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                              Try it online! Link is to verbose version of code. Explanation:



                                              ⌊⁺⁺⁺


                                              Concatenate the below expressions and output 0 if any of them includes a 0 otherwise 1.



                                              ⭆η›Lι²


                                              For each word in the solution output whether its length is at least 3.



                                              ⭆⪫ηω№⪫θωι


                                              For each letter in the solution output whether it appears in the puzzle.



                                              ⭆⪫θω№⪫ηωι


                                              For each letter in the puzzle output whether it appears in the solution.



                                              ⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                              For each letter in the solution check that the previous letter is not in the same group, unless it is the first letter of a word, in which case check that it is equal to the last letter of the previous word, unless it is the first letter of the solution, in which case just ignore it.






                                              share|improve this answer









                                              $endgroup$



















                                                2














                                                $begingroup$


                                                Charcoal, 63 bytes



                                                ⌊⁺⁺⁺⭆η›Lι²⭆⪫ηω№⪫θωι⭆⪫θω№⪫ηωι⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                                Try it online! Link is to verbose version of code. Explanation:



                                                ⌊⁺⁺⁺


                                                Concatenate the below expressions and output 0 if any of them includes a 0 otherwise 1.



                                                ⭆η›Lι²


                                                For each word in the solution output whether its length is at least 3.



                                                ⭆⪫ηω№⪫θωι


                                                For each letter in the solution output whether it appears in the puzzle.



                                                ⭆⪫θω№⪫ηωι


                                                For each letter in the puzzle output whether it appears in the solution.



                                                ⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                                For each letter in the solution check that the previous letter is not in the same group, unless it is the first letter of a word, in which case check that it is equal to the last letter of the previous word, unless it is the first letter of the solution, in which case just ignore it.






                                                share|improve this answer









                                                $endgroup$

















                                                  2














                                                  2










                                                  2







                                                  $begingroup$


                                                  Charcoal, 63 bytes



                                                  ⌊⁺⁺⁺⭆η›Lι²⭆⪫ηω№⪫θωι⭆⪫θω№⪫ηωι⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                                  Try it online! Link is to verbose version of code. Explanation:



                                                  ⌊⁺⁺⁺


                                                  Concatenate the below expressions and output 0 if any of them includes a 0 otherwise 1.



                                                  ⭆η›Lι²


                                                  For each word in the solution output whether its length is at least 3.



                                                  ⭆⪫ηω№⪫θωι


                                                  For each letter in the solution output whether it appears in the puzzle.



                                                  ⭆⪫θω№⪫ηωι


                                                  For each letter in the puzzle output whether it appears in the solution.



                                                  ⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                                  For each letter in the solution check that the previous letter is not in the same group, unless it is the first letter of a word, in which case check that it is equal to the last letter of the previous word, unless it is the first letter of the solution, in which case just ignore it.






                                                  share|improve this answer









                                                  $endgroup$




                                                  Charcoal, 63 bytes



                                                  ⌊⁺⁺⁺⭆η›Lι²⭆⪫ηω№⪫θωι⭆⪫θω№⪫ηωι⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                                  Try it online! Link is to verbose version of code. Explanation:



                                                  ⌊⁺⁺⁺


                                                  Concatenate the below expressions and output 0 if any of them includes a 0 otherwise 1.



                                                  ⭆η›Lι²


                                                  For each word in the solution output whether its length is at least 3.



                                                  ⭆⪫ηω№⪫θωι


                                                  For each letter in the solution output whether it appears in the puzzle.



                                                  ⭆⪫θω№⪫ηωι


                                                  For each letter in the puzzle output whether it appears in the solution.



                                                  ⭆η⭆ι⎇μ¬⁼Φθ№νλΦθ№ν§ι⊖μ∨¬κ⁼§ι⁰§§η⊖κ±¹


                                                  For each letter in the solution check that the previous letter is not in the same group, unless it is the first letter of a word, in which case check that it is equal to the last letter of the previous word, unless it is the first letter of the solution, in which case just ignore it.







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Apr 15 at 23:32









                                                  NeilNeil

                                                  89k8 gold badges46 silver badges188 bronze badges




                                                  89k8 gold badges46 silver badges188 bronze badges
























                                                      0














                                                      $begingroup$


                                                      Python 2, 168 156 bytes





                                                      lambda l,w,J=''.join:(set(J(w))==set(J(l)))*all((v<1or u[-1]==v[0])*u[2:]*(2>(x in p)+(y in p))for u,v in zip(w,w[1:]+[0])for x,y in zip(u,u[1:])for p in l)


                                                      Try it online!



                                                      Returns 1 for truthy, 0 for falsey.






                                                      share|improve this answer











                                                      $endgroup$



















                                                        0














                                                        $begingroup$


                                                        Python 2, 168 156 bytes





                                                        lambda l,w,J=''.join:(set(J(w))==set(J(l)))*all((v<1or u[-1]==v[0])*u[2:]*(2>(x in p)+(y in p))for u,v in zip(w,w[1:]+[0])for x,y in zip(u,u[1:])for p in l)


                                                        Try it online!



                                                        Returns 1 for truthy, 0 for falsey.






                                                        share|improve this answer











                                                        $endgroup$

















                                                          0














                                                          0










                                                          0







                                                          $begingroup$


                                                          Python 2, 168 156 bytes





                                                          lambda l,w,J=''.join:(set(J(w))==set(J(l)))*all((v<1or u[-1]==v[0])*u[2:]*(2>(x in p)+(y in p))for u,v in zip(w,w[1:]+[0])for x,y in zip(u,u[1:])for p in l)


                                                          Try it online!



                                                          Returns 1 for truthy, 0 for falsey.






                                                          share|improve this answer











                                                          $endgroup$




                                                          Python 2, 168 156 bytes





                                                          lambda l,w,J=''.join:(set(J(w))==set(J(l)))*all((v<1or u[-1]==v[0])*u[2:]*(2>(x in p)+(y in p))for u,v in zip(w,w[1:]+[0])for x,y in zip(u,u[1:])for p in l)


                                                          Try it online!



                                                          Returns 1 for truthy, 0 for falsey.







                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Apr 15 at 22:38

























                                                          answered Apr 15 at 21:52









                                                          Chas BrownChas Brown

                                                          6,7391 gold badge6 silver badges27 bronze badges




                                                          6,7391 gold badge6 silver badges27 bronze badges































                                                              draft saved

                                                              draft discarded















































                                                              If this is an answer to a challenge…



                                                              • …Be sure to follow the challenge specification. However, please refrain from exploiting obvious loopholes. Answers abusing any of the standard loopholes are considered invalid. If you think a specification is unclear or underspecified, comment on the question instead.


                                                              • …Try to optimize your score. For instance, answers to code-golf challenges should attempt to be as short as possible. You can always include a readable version of the code in addition to the competitive one.
                                                                Explanations of your answer make it more interesting to read and are very much encouraged.


                                                              • …Include a short header which indicates the language(s) of your code and its score, as defined by the challenge.


                                                              More generally…



                                                              • …Please make sure to answer the question and provide sufficient detail.


                                                              • …Avoid asking for help, clarification or responding to other answers (use comments instead).




                                                              draft saved


                                                              draft discarded














                                                              StackExchange.ready(
                                                              function ()
                                                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodegolf.stackexchange.com%2fquestions%2f183213%2fletter-boxed-validator%23new-answer', 'question_page');

                                                              );

                                                              Post as a guest















                                                              Required, but never shown





















































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown

































                                                              Required, but never shown














                                                              Required, but never shown












                                                              Required, but never shown







                                                              Required, but never shown







                                                              Popular posts from this blog

                                                              Tamil (spriik) Luke uk diar | Nawigatjuun

                                                              Align equal signs while including text over equalitiesAMS align: left aligned text/math plus multicolumn alignmentMultiple alignmentsAligning equations in multiple placesNumbering and aligning an equation with multiple columnsHow to align one equation with another multline equationUsing \ in environments inside the begintabularxNumber equations and preserving alignment of equal signsHow can I align equations to the left and to the right?Double equation alignment problem within align enviromentAligned within align: Why are they right-aligned?

                                                              Training a classifier when some of the features are unknownWhy does Gradient Boosting regression predict negative values when there are no negative y-values in my training set?How to improve an existing (trained) classifier?What is effect when I set up some self defined predisctor variables?Why Matlab neural network classification returns decimal values on prediction dataset?Fitting and transforming text data in training, testing, and validation setsHow to quantify the performance of the classifier (multi-class SVM) using the test data?How do I control for some patients providing multiple samples in my training data?Training and Test setTraining a convolutional neural network for image denoising in MatlabShouldn't an autoencoder with #(neurons in hidden layer) = #(neurons in input layer) be “perfect”?