Skip to content

mapsandapps/finger-labyrinth

Repository files navigation

Finger Labyrinth

Generator

Algorithm:

  • Start in the center (actually the path will later be reversed and end in the center, but the algorithm starts in the center)
  • Look up (always starts going up, by my preference) to see what cells you can land in that would be valid places to end a segment (invalid places are where the start is or where an intersection or corner is)
  • Select one of those at random and move there
  • Look to the left and right (i.e. in the perpendicular direction to the last move) to see what cells are valid moves from there
  • Select one at random and move there
  • Repeat, but now looking up & down; keep repeating
  • If it gets stuck with no valid moves, it will try moving forward some more instead of perpendicular
  • Ends when there are no valid moves from the current position

Curved paths:

  • The path rounder was built separately so it can be used for paths unrelated to the game. That said, paths not made with the generator may break it.
  • maxSizeToRound of 1 is the only value that will currently work with the labyrinth bridges. 2 & 3 are useful when exporting the path to somewhere else.

React + TypeScript + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

React Compiler

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see this documentation.

Expanding the ESLint configuration

If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:

export default defineConfig([
  globalIgnores(["dist"]),
  {
    files: ["**/*.{ts,tsx}"],
    extends: [
      // Other configs...

      // Remove tseslint.configs.recommended and replace with this
      tseslint.configs.recommendedTypeChecked,
      // Alternatively, use this for stricter rules
      tseslint.configs.strictTypeChecked,
      // Optionally, add this for stylistic rules
      tseslint.configs.stylisticTypeChecked,

      // Other configs...
    ],
    languageOptions: {
      parserOptions: {
        project: ["./tsconfig.node.json", "./tsconfig.app.json"],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
]);

You can also install eslint-plugin-react-x and eslint-plugin-react-dom for React-specific lint rules:

// eslint.config.js
import reactX from "eslint-plugin-react-x";
import reactDom from "eslint-plugin-react-dom";

export default defineConfig([
  globalIgnores(["dist"]),
  {
    files: ["**/*.{ts,tsx}"],
    extends: [
      // Other configs...
      // Enable lint rules for React
      reactX.configs["recommended-typescript"],
      // Enable lint rules for React DOM
      reactDom.configs.recommended,
    ],
    languageOptions: {
      parserOptions: {
        project: ["./tsconfig.node.json", "./tsconfig.app.json"],
        tsconfigRootDir: import.meta.dirname,
      },
      // other options...
    },
  },
]);

About

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors