In love with solutions that fit in the palm of the hand!
rafaelbarbosatec / a_star Goto Github PK
View Code? Open in Web Editor NEWPackage that uses the A * algorithm to find a way to the destination through the barriers.
License: MIT License
Package that uses the A * algorithm to find a way to the destination through the barriers.
License: MIT License
if you want use AI search path,enemies,allies, maybe need search with options .
For example nearest target or ally, perhaps search target(as item like chest,coins,weapons).
/// Method recursive that execute the A* algorithm
Tile? _getTileWinner(Tile current, Tile end) {
if (end == current) return current;
_waitList.remove(current);
for (final element in current.neighbors) {
if (element.parent == null) {
_analiseDistance(element, end, parent: current);
}
}
_doneList.add(current);
for (var n in current.neighbors) {
if (!_doneList.contains(n)) {
_waitList.add(n);
}
}
_waitList.sort((a, b) => a.f.compareTo(b.f));
for (final element in _waitList) {
if (!_doneList.contains(element)) {
final result = _getTileWinner(element, end);
if (result != null) {
return result;
}
}
}
return null;
}
this search check _doneList but it is growing
if search large (check all done tiles have heavy cost)
https://github.com/Sproute777/a_star/tree/feature/a_star_for_tbs
change Offset to Point , no needed to translate toDouble and back, no needed to use floor and etc.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.