CodingTrain / CodingTrain/Suggestion-Box
topic: random maze genorator
- Langage dominant
- Aucune donnée de langage
- Étoiles
- 570
- Forks
- 85
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Description
I found a way to generate a random maze from a point. I have not found any article about it but i tried programing it and can write some pseudocode.
The main idea:
Draw a point.
Draw another point X far from the first one and draw a line to it.
Pick one of the points and draw another point X far from it and draw a line to that point.
and so on but you only have to follow one rule:
**never let two points go closer than X far from each other**
it is not as easy as it sounds because of lag but i think a quadtree would work.
[https://codepen.io/ProGramer31415/pen/BxPWXx](url)
Here is some pseudocode, I am not good at writing pseudocode:
```
class node {
main(x, y) {
keep position of node
create an array of nodes created from this node, starts empty
}
addChild(x, y) {
create new child at x, y
add child to array of children
}
draw() {
draw line from node to all children
}
}
class maze {
main(segment-length) {
create array / quadtree of nodes and add one node to it
create variable with length of each segment
}
update() {
pick a random node
pick a random position segment-length far from the node
check if the random position is legal with moveLegal
if its legal {
add a new kid to the random node with the random position
add the kid to the array of nodes
}
}
moveLegal(x, y) {
check if the length to the closest node in the mazes array of nodes is more than segment-length.
if so return true
else return false
}
}
```
Guide de contribution
Aucun guide de contribution indexé pour ce dépôt
Piste de recherche
Start by reviewing the linked CodePen and the pseudocode, which are the only implementation references provided. The issue names no repository files, entry points, tests, or acceptance criteria, so the intended implementation scope and definition of done would need to be established before work begins.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Domaine
- game-dev
- Type d'issue
- Fonctionnalité
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 20/100