thewca / tnoodle-lib

scrambling code portion of TNoodle
GNU General Public License v3.0
39 stars 15 forks source link

Provide short code samples for generating scrambles and SVG strings #35

Closed NikhilSDate closed 2 years ago

NikhilSDate commented 2 years ago

A year or so ago, I was trying to build an Android cube timer app. However, I found it quite difficult to find out how to use the tnoodle library for generating scrambles and scramble images. Ultimately, I figured out the usage from looking at the code of other projects using tnoodle-lib on GitHub and the tnoodle-samples repository, but this was quite tedious and time consuming, even though using tnoodle-lib for generating scrambles is actually very easy and only takes a few lines of code.

To make it easier and more accessible for people to use tnoodle-lib in their own projects, would it be possible to add some simple code snippets that show how to generate scrambles and scramble SVG strings for various kinds of puzzles in the README file of this repository or the tnoodle-samples repository? For example, for generating a scramble for a 3x3x3 cube, the code sample could be something simple like

Puzzle puzzle = new ThreeByThreeCubePuzzle();
String scramble = puzzle.generateScramble();

and for generating a scramble SVG string, the code sample could be something like

Puzzle puzzle = new ThreeByThreeCubePuzzle();
String scramble = puzzle.generateScramble();
String SVGString = puzzle.drawScramble(scramble, null).toString();
gregorbg commented 2 years ago

Thank you for the suggestion! We actually have https://github.com/thewca/tnoodle-samples which includes a lot of code samples. If you have a specific idea how to improve our documentation on that repo, feel free to open an issue over there!