1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
//! # Civilization Map Generator
//!
//! A map generation library for civilization-style strategy games.
//! The algorithm is primarily based on *Civilization V* with references from *Civilization VI*.
//!
//! ## Features
//!
//! - **Dual Hex Orientation**: Supports both flat and pointy hex orientations
//! - **Multiple Map Types**: Fractal and Pangaea generation algorithms
//! - **Complete Game Elements**: Terrain, resources, rivers, natural wonders, civilizations, city-states
//! - **Data-Driven Configuration**: JSON-based ruleset system
//!
//! ## Quick Start
//!
//! ```rust
//! use civ_map_generator::{generate_map, map_parameters::{MapParametersBuilder, WorldGrid}, ruleset::Ruleset};
//!
//! // Create default world grid
//! let world_grid = WorldGrid::default();
//!
//! // Build map parameters with custom settings
//! let map_parameters = MapParametersBuilder::new(world_grid)
//! .seed(42) // Optional: set seed for reproducible maps
//! .build();
//!
//! // Load game rules
//! let ruleset = Ruleset::default();
//!
//! // Generate the map
//! let map = generate_map(&map_parameters, &ruleset);
//! ```
//!
//! ## Adding Custom Map Types
//!
//! See [How to add a map type](./src/map_generator/How%20to%20add%20a%20map%20type.MD) for implementation guide.
//!
//! ## Complete Example
//!
//! For a full-featured example, see [Civilization-Remastered](https://github.com/lishaoxia1985/Civilization-Remastered).
//!
//! ## Architecture
//!
//! The library is organized into several key modules:
//!
//! - **`grid`**: Hexagonal and square grid systems with coordinate transformations
//! - **`map_generator`**: Map generation algorithms (Fractal, Pangaea)
//! - **`ruleset`**: Game rule definitions loaded from JSON files
//! - **`tile_map`**: Map data structure and generation pipeline
//! - **`tile_component`**: Tile components (terrain, features, resources, etc.)
//!
//! ## Current Limitations
//!
//! - Only fractal and pangaea map algorithms are implemented
//! - Square grid is not yet supported
//! - Some map parameters are hardcoded; JSON ruleset integration is partial
//!
//! ## References
//!
//! - [Unciv](https://github.com/yairm210/Unciv)
//! - [Community Patch for Civilization V](https://github.com/LoneGazebo/Community-Patch-DLL)
//! - [Red Blob Games - Hexagonal Grids](https://www.redblobgames.com/grids/hexagons/)
////////////////////////////////////////////////////////////////////////////////
// Re-export commonly used items for convenience
pub use Generator;
pub use ;
pub use Ruleset;
pub use TileMap;
use ;
use MapType;
/// Generates a map based on the provided parameters and ruleset.
///
/// # Arguments
///
/// * `map_parameters` - Configuration parameters for map generation
/// * `ruleset` - Game rules and definitions
///
/// # Returns
///
/// A fully generated [`TileMap`] with terrain, resources, civilizations, and other game elements.
///
/// # Examples
///
/// ```
/// use civ_map_generator::{generate_map, map_parameters::{MapParametersBuilder, WorldGrid}, ruleset::Ruleset};
///
/// let world_grid = WorldGrid::default();
/// let map_parameters = MapParametersBuilder::new(world_grid).build();
/// let ruleset = Ruleset::default();
/// let map = generate_map(&map_parameters, &ruleset);
/// ```