Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code organization and plans for a js fork #12

Open
canibanoglu opened this issue May 4, 2019 · 6 comments
Open

Code organization and plans for a js fork #12

canibanoglu opened this issue May 4, 2019 · 6 comments

Comments

@canibanoglu
Copy link

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 (like window or document).

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!

@campos20
Copy link
Member

campos20 commented May 5, 2019

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 "";
}```

@gregorbg
Copy link
Member

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.

@canibanoglu
Copy link
Author

@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?

@gregorbg
Copy link
Member

gregorbg commented May 30, 2019

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 :)

@canibanoglu
Copy link
Author

canibanoglu commented Jan 24, 2020

Are there any updates about this?

@gregorbg
Copy link
Member

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

@gregorbg gregorbg transferred this issue from thewca/tnoodle Feb 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants