Contribution - Stub generator input error

Hi. I created a contribution, an easy puzzle, and some user brought to my notice that in some languages when you open the game in IDE and run the program without changing something in the code you get errors. I believe that the problem is that the stub generator input translate the code to those languages with errors. Do you know what is the problem and what should I do to fix it?

The list of the languages that have errors on are:
F#
Go
Groovy
Java
Kotlin
Objective-C
Pascal
Scala
VB.NET

A link to my contribution so you can check it yourself:

This is what the user said:
The code stub generator throws exceptions in several languages : F#, Go, Groovy, Java, Kotlin, Objective-C, Pascal, Scala and VB.Net.

For F# it looks like a bug on CG side, the generator doesn’t detect that a previously declared variable is in another inaccessible scope and should be redeclared. I haven’t looked at the other ones, hopefully you can figure it out or find some help on the forum :slight_smile:

Thanks for your help :slightly_smiling_face:

I think you want to use word rather than string in the second loop - a string can contain spaces so in many languages it reads a whole line (so multiple strings per line separated by spaces doesn’t work). A word cannot contain spaces so it should read the space separated characters correctly.

Naming variables integer and character is also going to cause problems in languages where these are reserved words.

The go errors appear to be a bug in the stub generator (declares a variable in the first loop and tries to use it in the second one), though maybe it’ll be fixed if you don’t read strings in the second loop.

Thanks.
I will try what you said and tell you what happen.

It fix most of the errors, but there are still some language that it doesn’t work in:
F#
Go
Scala

But you help me a lot :grinning:

A good parts of the errors are caused by the use of ‘string’ instead of ‘word’, and the variable named ‘integer’. But there’s some problems from the stub generator.
I will list them here per language:

  • F#: Variable ‘words’ declared in a for loop and used without declaration in another for loop, out of the scope of the first declaration.
  • Scala: Same problem with ‘inputs’.
  • Go: Same problem, ‘inputs’ declared in the first for loop and used with ‘=’ instead of ‘:=’ in the second. And second problem ‘character’ declared but not used in the second for loop, while the problem is handled in the first loop by the use of ‘_’.

I fixed the problem with ‘word’ instead of string and ‘num’ instead of integer and ‘C’ instead of character. How can I fix the problems you mention? Should I just wait for someone from CG to fix them?

Thanks

I don’t think you can do anything… The stub is now correct…
Perhaps the CG team can do something @_CG_Thibaud ?

1 Like

Can you check now if the problems with F# and Scala fixed?
Because I think they are.
If they are fixed the only problem left is in Go because C is not used.

Did you change something ? I always have the same errors…

So it fixed or not? I think I change something because it is working for me but maybe it just for me that why ask you.

It’s not. And I don’t see any change in the stub code.

OK, thanks. So we can just wait for someone from CG to help us :disappointed_relieved:

We’ll look into it as soon as we can.

Thanks a lot @_CG_Thibaud . I appreciate this.
Hope you will fix it fast :grinning: