# PTON Project : City Generator
**Marius PON** et **Tom THIL**, *EPITA Promo 2023*

This projects consists in a medieval city generator in python. The generated city depends on attributes as the number of population and its density.

## Features
- Generate a medieval city depending on the number of population and the density of the population
- It is possible to generate or not a castle, a wall and a lake in the city
- The result is stored in a *.json* file
- The user has to possibility to use a city viewer


## How to use

### Instantiate a 'City' object
This project can be executed with your *Pycharm* IDE. You have to run the *city.py* file, located in the *src/* repository.

A city object is instanciated as follows :
``city = City(population, density, has_walls, has_castle, has_lake)``

A City object has already been created in *city.py* with values giving good results.  You can custom the generated cities by replacing them by your own values.

There is a last *'seed'* parameter, none as default. 2 cities generated with the same parameters and the same seeds will be identical.

### Generating a *.json* file
You can generate a *.json* file for your 'city' object as follows :
``tools.json(city, 'path/to/your/file/.json')``

### Use the city viewer
To use the **city viewer**, you have to run run *viewer.py*. There is a *view* function taking as parameter a *.json* file corresponding to a generated city. By default, the fonction takes *tmp/city.json* as argument.

## Documentation
A documentation has already been generated (in *docs/_build/html/tml/index.html*).

However, if you want to generate it again for some reason, you must run the command ``make html`` in the *docs* folder.