SamanthaDawsonBanks / MCOMP_Team_Project_2017-2018

MIT License
6 stars 1 forks source link

Refactor the 'score' parts of Vertex into a SubClass ScoredVertex using inheritance #176

Closed SamanthaDawsonBanks closed 6 years ago

SamanthaDawsonBanks commented 6 years ago

As one (the Vertex) is the base object (a place in graph theory, nodal space) and the second (the ScoredVertex) is a specialised (mostly for pathfinding) version that extends it and has the addition of the scoring stuff?

SamanthaDawsonBanks commented 6 years ago

And yet again I show how I need to check my posts in the morning...

This shouldn't be inheritance it should be composition.

A scored vertex will be composed if a base vertex and some new data and behaviour. All through the use of a constructor. Sorry for leading you in the wrong direction Harry

SamanthaDawsonBanks commented 6 years ago

I'm still not happy with this as polymorphism would be more useful, let me chew on it for a bit then i will bung up a PR for it (it might need to get wrapped into the AStar rework you are thinking of)

stevempope commented 6 years ago

I think a subclass is fine, but we should be passing the Vertex through a heuristic method which returns a new scored vertex (the result of the scoring). The algorithm then handles a collection of scored vertex objects which it can throw away once the pathfinding is complete. Storing the score in the current vertex will dramatically increase the size of the Herd object and therefore the traffic passed between Herd members.

HarryWJackson1996 commented 6 years ago

From the PR I can see you went with inheritance, over composition. I mean i would assume either would work. When the PR is merged I will refactor the AStar.

SamanthaDawsonBanks commented 6 years ago

done