Skip to content

Using TNoodle lib in your application

Rui Reis edited this page Jun 23, 2020 · 2 revisions

tnoodle-lib is a Java library which contains the scramble builders for all current official WCA events. To use tnoodle-lib in your application, you will need to be able to talk to Java/JVM in the background regardless of your front-end technology.

Integrating tnoodle-lib in your application

In order to integrate the library, you can either download and compile a standalone copy yourself, or use the pre-compiled artifacts from the Bintray repository.

The Bintray repository is also compatible with the Maven standard, which is used by virtually every Java Build system today (in particular, Android uses Gradle which in turn uses Maven dependencies).

Using tnoodle-lib in your application

Once you have the tnoodle-lib code imported, you will need the class called PuzzleRegistry, which is an enum that holds all available puzzles known to TNoodle. By picking any of these and invoking getScrambler() you will retrieve a scrambler object that knows the methods generateScramble() and generateScrambles(int numOfScrambles). These two methods yield one or N WCA-competition-grade scramble strings, respectively.

For drawing a given scramble to SVG, you can use the method drawScramble(String scramble).