Scrabble puzzle discussion

Hi there, I am new here, so new I couldn’t upload an image lol.
I submitted my code with all test casses passed, but validator 08 failed. Because the validator is “large dictionary 2”, I can’t seem to know what is the problem. Any opinions?

Never Mind, I made my own test cases based on a guess, and I fixed it.

It would be great to have more edge test cases so as to understand why many of us are stuck at 73% completion whilst all tests seem to pass in the IDE.

For me the submission tests “Large dictionary 1” and “Large dictionary 1” seem to fail
Yet and like many others, I cannot seem to understand the reason why

New edge test cases would be key in understanding and rectifying our mistake(s)
Thank you very much in advance for your help

hey guys! first off, i just want to say i’m a beginner so if this code looks messy, that’s on that. So i’ve been trying so hard to get it to work and i’ve come to a point where i don’t know what’s wrong with my code at all, here’s my code. I don’t understand why it returns nothing, and why the value of W is null when it’s supposed to be every word in the dictionary

/**
 * Auto-generated code below aims at helping you parse
 * the standard input according to the problem statement.
 **/


 const N = parseInt(readline()); // number of words in the dictionary
 for (let i = 0; i < N; i++) {
     const W = readline(); // words in the dictionary, one word per line.
 const LETTERS = readline(); // the 7 letters available
 const onePoint = ['a' , 'e' , 'i' , 'o' , 'n' , 'r' , 't' , 'l' , 's' , 'u'];
 const twoPoints = ['d' , 'g'];
 const threePoints = ['b', 'c','m','p'];
 const fourPoints = ['f', 'h','v','w' , 'y'];
 const fivePoints = ['k'];
 const eightPoints = ['j','x'];
 const tenPoints = ['z', 'q'];
 if (LETTERS && W && LETTERS.includes(W)) {
  let input = LETTERS.split(' ');
  let dictionary = W.split(' ');
  let commonWords = input.filter(word => dictionary.includes(word));
  let commonSubstring = commonWords.join('\\s');
  commonSubstring = commonSubstring.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
  let matches = input.match(new RegExp(commonSubstring, 'g'));
  let result = matches;
  for (let l = 0; l < result.length; l++) {
      let check = result[l].split(' ');
  let scoreOne = check.filter(point1 => onePoint.includes(point1))
  let commonLetters1 = scoreOne.join('');
  let totalOne = check.match(new RegExp(commonLetters1, 'g'));
let scoreTwo = check.filter(point2 => twoPoints.includes(point2));
let commonLetters2 = scoreTwo.join('');
let totalTwo = check.match(new RegExp(commonLetters2, 'g'));
let scoreThree = check.filter(point3 => threePoints.includes(point3));
let commonLettersThree = scoreThree.join('');
let totalThree = check.match(new RegExp(commonLettersThree, 'g'));
let scoreFour = check.filter(point4 => fourPoints.includes(point4));
let commonLettersFour = scoreFour.join('');
let totalFour = check.match(new RegExp(commonLettersFour, 'g'));
let scoreFive = check.filter(point5 => fivePoints.includes(point5));
let commonLettersFive = scoreFive.join('');
let totalFive = check.match(new RegExp(commonLettersFive, 'g'));
let scoreEight = check.filter(point8 => eightPoints.includes(point8));
let commonLettersEight = scoreEight.join('');
let totalEight = check.match(new RegExp(commonLettersEight, 'g'));
let scoreTen = check.filter(point10 => tenPoints.includes(point10));
let commonLettersTen = scoreTen.join('');
let totalTen = check.match(new RegExp(commonLettersTen, 'g'));
const totalPoints= totalTen + totalEight + totalFive + totalFour + totalThree + totalTwo + totalOne;
let results = []

let currentNumber = totalPoints.length;
results.push({ word: result[l], number: currentNumber });
}
let maxResult = Math.max(...results.map(obj => obj.number));
let maxEntry = results.find(obj => obj.number === maxResult);                  
 // Write an answer using console.log()
 // To debug: console.error('Debug messages...');
 
 console.log(maxEntry);}}

One thing I’ve noticed is that you’ve misplaced two }s. Even the console.log line at the end is within the big for-loop and the if-loop inside it.

It’s difficult to read your code without any indentation.

Please avoid posting codes on the forum, and try describing your approach instead.

You may send me a private message for further discussion.

I would love if someone with more experience than me would look at my solution to this problem I posted and tell me what can I improve.

Hi, i’m having an issue with the validator 3. I pass all the tests but once i submit my code only validator 3 breaks and I have absolutely no idea why. I cannot see the test cases used in this validator so im pretty much lost here, if anyone can help that would be very much appriciated !!

[Mod edit: Please avoid posting codes on the forum]

Please avoid posting codes on the forum.

There are some hints in this thread regarding Validator 3, if you search “different values”. Have you tried to follow the hints and the cases provided? (There’s a very big hint if you search carefully.)

okay i see, i found where the issue comes from thx

1 Like

dict “hicquwh” has two h, I had this problem too.

shouldn’t the word ‘which’ be wrong as it contains the letter ‘h’ twice ?

The answer (“which”) to Test 1 (“Only one word”) is not wrong because you have two "h"s available (first “h” and last “h” in “hicquwh”).