Open canibanoglu opened 5 years ago
The code do need some clean up and use a bit more standard features. We have plans of doing that in the mid-term future. Porting to js is more a long-term plan.
TNoodle started as a personal software from @jfly, perhaps he can explain the svg chose.
This Java code can generate scrambles.
import net.gnehzr.tnoodle.scrambles.PuzzlePlugins;
import net.gnehzr.tnoodle.utils.LazyInstantiator;
private String generateScramble(String typeScramble){
try{
SortedMap<String, LazyInstantiator<net.gnehzr.tnoodle.scrambles.Puzzle>> scramblers = PuzzlePlugins.getScramblers();
LazyInstantiator<net.gnehzr.tnoodle.scrambles.Puzzle> lazyScrambler = scramblers.get(typeScramble);
net.gnehzr.tnoodle.scrambles.Puzzle s = lazyScrambler.cachedInstance();
return s.generateScramble().trim();
}
catch (Exception e){
// Error dealing
}
return "";
}```
Hey @canibanoglu,
just putting this here to let you know that a Kotlin rework of the entire scrambles
module is in the works. This will also include the ability to compile the code down to JS without the nasty document
and window
references that GWT
produces.
In general, I try to migrate everything to Gradle right now, so a loooot of stuff about project structure will change in the near future. Please refrain from doing a manual JS portation! We greatly appreciate your dedication, but I strongly feel that having two separate codebases for two languages is the wrong way to go.
@suushiemaniac Thank you so much! I agree with you completely in that there shouldn't be two codebases striving to do the same thing.
I'm really happy to read that there is a Kotlin port going on. Is it open to public and if so do you need any help?
We need to figure out the Grade migration first, and I expect that this will take another week or two.
Afterwards, the Kotlin migration work can seriously start and then your help is very welcome :)
Are there any updates about this?
Hey there! We have pulled the core scrambling code out into its own repository. Your suggestions mostly pertains to porting that scrambling code.
There is currently absolutely no progress to report here, because our main focus currently lies on rewriting the server+frontend part.
I'm moving this issue over to tnoodle-lib
Hello,
I've been writing a cubing tool for myself and scrambles have proven to be the hairiest part of the implementation. I've been hoping to avoid what I'm suggesting but I can't see any other tool in JavaScript that generates acceptable scrambles across different puzzles.
I have looked into the generated
tnoodle.js
file but this is far from ideal and has (unnecessary) dependencies on global objects (likewindow
ordocument
).I have been reading through the codebase a little in preparation of a JS port and I just wanted to ask here if there are any upcoming plans to rewrite tNoodle. It doesn't have to be JS but I feel like the codebase needs a bit of cleaning up (I would like to understand the decision behind tightly coupling the representation of puzzles (svg) to the scramble generator).
I feel like I will go ahead with a JS port and make it available on npm (don't know when I will finisih it) and I would greatly appreciate if you could give me some pointers on where I should start within tNoodle, like general pointers to keep in mind.
Thanks a lot!