Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve the algorithm which picks which rooms are connected #72

Merged
merged 9 commits into from
Nov 15, 2022

Conversation

JackAshwell11
Copy link
Owner

@JackAshwell11 JackAshwell11 commented Oct 19, 2022

Description of Changes

This PR improves the algorithm which determines which rooms get connected to which other rooms. It uses a minimum spanning tree to find the shortest path between all the rooms such that they are still reachable

Refs #71

Type of Changes

Type
🐛 Bug Fix
✨ New Feature
🔨 Refactoring
📝 Miscellaneous

Tasks

  • Implement the minimum spanning tree algorithm
  • Maybe add some extra connections back
  • Allow diagonals in the A* extension (this may need redoing of the heuristics used throughout the program)
  • Change the Map class to just functions
  • Add option to hard-code the random seed logging it for testing
  • Fix tests and rebase the git history
  • Fix wall placement sometimes not happening

Allowed diagonals in A* pathfinding.

Eliminated symmetric and transitive relations. The transitive code needs more testing.

May implement cellular automata as well.
Tried implementing Kruskal's algorithm. The implementation effort is not worth it and the rough version is much slower than Prim's.

Switched to using rects for complete_graph and mst.

Improved some comments.

Optimised symmetric relation detection.

Figured out idea for extra connections.
…imum spanning tree.

Need to simplify create_hallways (McCabe rates it at 16).

Done some refactoring to make map.py cleaner.

May remove Map class as a functional approach could work better.

Improved some docstrings in Rect.
Switched grid_bfs in hades_common.h to use INTERCARDINAL_OFFSETS.
…ot be kept however).

Switched generation to built-in random library, so I can seed the Random object and log the state.

Switched possible tiles to a set.
Fixed all generation tests.

Optimised and reformatted some more stuff.
Fixed typing error.

Fixed wall hole bug. The obstacle placement was wrong.

Switched Rect.get_distance_to() and test_astar.heuristic() to Euclidean distance.
@JackAshwell11 JackAshwell11 merged commit 96be4d5 into master Nov 15, 2022
@JackAshwell11 JackAshwell11 deleted the room-connection-improvement branch November 15, 2022 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant