Scrabble puzzle discussion

I cannot pass the submitted test Large dictionary 1. All other test are passing and I’m getting crazy about it. I try a lot of change without success.
The problem that we don;t have log to check where is the problem. From a shortlist it could be any of them.

  • Timeout
  • Wrong result
  • unknown case

Did anyone get the right answer with this test ?

2 Likes

I’ve got the same problem. Did someone manage to get the data used for LargeDictionary 1 and 2 in validation? Without additional clue, it’s almost impossible to find the error when all tests in IDE pass

1 Like

No I’ve checked that out, you’re given seven letters. Therefore, the length of your output cannot be greater than 7 letters

This can be simplified when it comes to typing it: instead of a dictionary you could use a list.

weights = [1,3,3,2,1,4,2,4,1,8,5,1,3,1,1,3,10,1,1,1,1,4,4,8,4,10]
utf = map(chr, range(97, 123))

and to get the value:

res = 0
for i in word:
…res += weights[utf.index(i)]

Hi, I get an error:
Segmentation fault.
at Answer.cpp:76Backtrace stopped. function nadji ( pok=error reading variable: Cannot access memory at address 0x77757168f0>, slova=error reading variable: Cannot access memory at address 0x77757168e8>, rec=error reading variable: Cannot access memory at address 0x77757168e0>) on line 0

Same code works in visual studio. I have no idea what’s going on. What does this error mean?

Edit: I didn’t find an answer, and have no idea what was the problem. I simulated recursion with stack, and everything worked. If someone had similar issues, and did find a way out, I’d be glad to hear about it.

This is how I did it, pretty sure python handles the list comprehension quick enough:

scores = {
    "eaionrtlsu":1,
    "dg":2,
    "bcmp":3,
    "fhvwy":4,
    "k":5,
    "jx":8,
    "qz":10
}
def getScore(h):
    amount = 0
    for l in h:
        amount += [scores[k] for k in scores if l in k][0]
    return amount
1 Like

Ok, it’s the order of the words as given, not the expected order of a dictionnary… I’m alone to think it’s a bad idea ? My bad, I have to store a dictionnary in a vector, so ugly ! ^^

Hi,

solving this puzzle I noticed that there is one point that should be cleared : in case there are several equivalent solution, we have to return the first one in the dictionary.

This is sensible in the last puzzle.

thanks for eveything, by the way.

Hello,

FYI, I passed the “large dictionary 1/2” validation tests by ignoring the dictionary values larger than 7 characters when parsing the input data. As we get only 7 characters in input, it’s not necessary to consider bigger dictionary values.
It saved processing time and the validation succeeded.

1 Like

Wow, there’s an obscure condition that doesn’t seem to be outlined in the spec.

At least checking for the longer of two words if they have the same score is what got me past the large dictionary submit tests.

update
looking back at the entire outline, it seems that the word that appears first in the dictionary should be given priority, but apparently my check against length managed to get the result checked for by the tests.

Looks like I found an exploit.

Thanks, at least I learnt how to profile my code :slight_smile: So if the two words have the same score it is the first, shortest word you want not the first word. I was thinking I must have been taking too long as it was the two long dictionaries I was failing on, but my code was only taking 40ms to complete, a 1/4 of which is reading the dictionary. Perhaps codingame should look at their answer, or their description.

1 Like

I have trouble passing “valid word” on submit. (Java)

“The following validators differ from the puzzle test cases to prevent hard coded solutions. This is why you can have some fails here even if all of the tests provided in the IDE have been successfully passed.”

I did not hardcode the solution. I pass all tests until submit. This really sucks!

Hi there!

I pass all tests, but when submitting last 2 fail. :hamburger: :hamburger:

Has anyone clarified this? Thx

1 Like

Maybe your answer is too slow?

I try to customize test with 50834 and 101668 words, and I pass it.
I think is more probably is a logic error… But I can’t test it, because all test passed.

The C template code uses getc to read the dictionary words. This seems to add a linefeed to the end of each word, which eventually messed me up. For a while I couldn’t figured out why strlen(dictword[i]) of a 7-letter word would return 8 and got eliminated as a candidate.

I replaced that with scanf("%s\n") and everything works better.
Is this done on purpose to trip up unsuspecting programmers?

Same thing for me ! Can’t pass the “Valid word” test !

Hi!
“The following validators differ from the puzzle test cases to prevent hard coded solutions. This is why you can have some fails here even if all of the tests provided in the IDE have been successfully passed.”
WTF?
All test pass, but when submitting last test (“large dictionary 2”) fail…
i need your help! :slight_smile:

edit
solved. I rewrote the part where I check every letter in a dictionary-word. Still dunno what was the problem with the previous version :frowning:


same problem, using c#.
so far I’ve tried :
-to validate every input.
-to play with the original “2 words with diff…” dataset

anyone has any clue what could be the situation when every other case passed?

There is a problem in the Java validator when multiple words give the same score.
With the test case “2 words with the same value”, I return “postie” but the validator tells me it expects “potsie”, which is after “postie” in the dictionnary.
The same goes for “Large dictionnary 2” where I return “napster” whereas the validator expects “pastern”.

Even if I sort my words in reverse alphabetical order, the validator “Many possibilities” expects “waster” when I provide “waters”.

It’s like the words must be in alphabetical order in reversed letters.