CodingTrain / CodingTrain/Suggestion-Box
topic: random maze genorator
- Ngôn ngữ chính
- Không có dữ liệu ngôn ngữ
- Star
- 570
- Fork
- 85
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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
}
}
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Hướng nghiên cứu
Hãy bắt đầu bằng việc xem xét CodePen được liên kết và pseudocode, đây là những tài liệu tham chiếu triển khai duy nhất được cung cấp. Issue không nêu tên tệp nào trong repository, entry point, test hay tiêu chí chấp nhận nào, vì vậy cần xác định phạm vi triển khai dự kiến và definition of done trước khi bắt đầu công việc.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Lĩnh vực
- game-dev
- Loại issue
- Tính năng
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 20/100