com_croftsoft_core/ai/astar/functions/mod.rs
1// =============================================================================
2//! - Associated functions for the A* algorithm
3//!
4//! # Metadata
5//! - Copyright: © 2022-2023 [`CroftSoft Inc`]
6//! - Author: [`David Wallace Croft`]
7//! - Java created: 2002-04-21
8//! - Java updated: 2003-05-09
9//! - Rust created: 2022-10-28
10//! - Rust updated: 2023-07-23
11//!
12//! # History
13//! - Adapted from the classes in the Java-based [`CroftSoft Core Library`]
14//! - com.croftsoft.core.ai.astar.AStar
15//!
16//! [`CroftSoft Core Library`]: https://www.croftsoft.com/library/code/
17//! [`CroftSoft Inc`]: https://www.croftsoft.com/
18//! [`David Wallace Croft`]: https://www.croftsoft.com/people/david/
19// =============================================================================
20
21#[cfg(test)]
22mod test;
23
24use super::structures::AStar;
25use core::f64::INFINITY;
26use core::hash::Hash;
27use std::collections::HashMap;
28use std::collections::VecDeque;
29
30impl<N: Eq + Hash> Default for AStar<N> {
31 fn default() -> Self {
32 AStar {
33 best_node_option: None,
34 best_total_cost: INFINITY,
35 goal_node_option: None,
36 list_empty: false,
37 node_to_node_info_map: HashMap::new(),
38 node_to_parent_node_map: HashMap::new(),
39 open_node_sorted_list: VecDeque::new(),
40 }
41 }
42}