CartFinder
CartFinder est un système de détection de chemin automatique (Pathfinder) fonctionnant avec un système de gestion du danger (Heatmap).
Installation
- Téléchargez le fichier
.zip(bouton à côté de la section description tout en haut de la section des fichiers). - Décompressez-le pour obtenir le fichier
CartFinder.py.
Utilisation
1. Définir la carte
Définissez votre matrice/map sous forme de liste contenant des sous-listes pour les lignes :
"-0": Mur / Infranchissable"0": Case sans danger"1"à"4": Danger initial (1= petit danger,4= très grand danger)
map_test = [
["0", "0", "0", "-0", "0"],
["0", "-0", "0", "4", "0"],
["-0", "-0", "0", "0", "0"]
]
2. Initialiser le Pathfinder
Créez l'instance de la classe en passant ces arguments : la variable de la map, le point de départ [ligne, col], des points additionnels optionnels [[l, c]], et l'arrivée [ligne, col].
game = PathFinder(map_test, [0, 0], [[1, 2]], [0, 4])
3. Lancer la recherche
Lancez la fonction .Find() en spécifiant l'importance de la vitesse (pR) et l'importance de la sécurité (pS).
result = game.Find(pR=2, pS=2)
4. Afficher le résultat
Vous pouvez ensuite afficher le chemin calculé ainsi que le score final.
print("Chemin trouvé par le bot :", result[0] if result else "Aucun")
print("Score final :", result[1] if result else "N/A")
Fonctionnement
- Propagation du danger : Dès l'initialisation, CartFinder augmente automatiquement la valeur de danger des cases situées autour des sources de danger initiales (Heatmap).
- Génération des essais : Lors de l'appel à la méthode Find(), l'algorithme génère des tentatives pour atteindre chaque objectif l'un après l'autre.
- Calcul du meilleur chemin : Au bout de 150 essais, il calcule le score des solutions trouvées avec la formule suivante: $$score = -((nb_cases \times pR) + (danger_accumulé \times pS))$$ L'algorithme retient ensuite le chemin possédant le score le plus élevé (le moins négatif).
License et autres
Ce script est sous licence GNU General Public License 3.0 (GPL 3.0).
La version en module sortira très bientôt
Contact: zedka450 (Discord) zedka.le.vrai.pro@gmail.com (e-mail)
Pourquoi le nom "CartFinder"?
C'est très simple: je voulais un nom simple, qui se retient, alors je me suis dit "C'est pour les cartes, alors Cart, et Finder pour pathfinder" et ça fait CartFinder.
Metadata
Release files for cartfinder 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cartfinder-1.0.0.tar.gz | 14.9 kB | Without provenance | Details for cartfinder-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cartfinder-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for cartfinder-1.0.0-py3-none-any.whl |
Total release size: 30.1 kB
Release files / cartfinder-1.0.0.tar.gz
| Download URL | cartfinder-1.0.0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
10d3142087c1ab6ee7e3f8597431f285e40bdce1022282abb56ab974f627ba71
|
|
BLAKE2b-256 checksum How to use checksums |
8eb0542142535bfb95af48dd0835bdcf556e6fcdc63f954c866240c031605e33
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / cartfinder-1.0.0-py3-none-any.whl
| Download URL | cartfinder-1.0.0-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a641c5be75918ee5a4bc93febffd8b5b2bf230afbc3896840dfa589110fe4c25
|
|
BLAKE2b-256 checksum How to use checksums |
3984e59cb3226ea1f309ae8e420a7938633560a7ba1a589197cfef4f50473d97
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.12 {"installer":{"name":"uv","version":"0.11.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for cartfinder 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.