RP Tree is a command-line tool to generate a directory tree diagram.
## Run the App
To run **RP Tree**, you need to download the source code. Then open a terminal or command-line window and run the following steps:
1. Create and activate a Python virtual environment
```sh
$ cd rptree_project/
$ python -m venv ./venv
$ source venv/bin/activate
(venv)$
```
2. Run the application
```sh
(venv)$ python tree.py /path/to/directory/
```
**Note:** The `-h` or `--help` option provides help on how to use RP Tree.
To take a quick test on **RP Tree**, you can use the sample `home/` directory provided along with the application's code and run the following command:
```sh
(venv)$ python tree.py ../hello/
../hello/
│
├── hello/
│ ├── __init__.py
│ └── hello.py
│
├── tests/
│ └── test_hello.py
│
├── requirements.txt
├── setup.py
├── README.md
└── LICENSE
```
That's it! You've generated a nice directory tree diagram.
## Current Features
If you run RP Tree with a directory path as an argument, then you get the full directory tree printed on your screen. The default input directory is your current directory.
RP Tree also provides the following options:
-`-v`, `--version` shows the application version and exits
-`-h`, `--help` show a usage message
-`-d`, `--dir-only` generates a directory-only tree
-`-o`, `--output-file` generates a tree and save it to a file in markdown format
RP Tree is a command-line tool to generate a directory tree diagram.
## Run the App
To run **RP Tree**, you need to download the source code. Then open a terminal or command-line window and run the following steps:
1. Create and activate a Python virtual environment.
```sh
$ cd rptree_project/
$ python -m venv ./venv
$ source venv/bin/activate
(venv)$
```
2. Run the application.
```sh
(venv)$ python tree.py /path/to/directory/
```
**Note:** The `-h` or `--help` option provides help on how to use RP Tree.
To take a quick test on **RP Tree**, you can use the sample `home/` directory provided along with the application's code and run the following command:
```sh
(venv)$ python tree.py ../hello/
../hello/
│
├── hello/
│ ├── __init__.py
│ └── hello.py
│
├── tests/
│ └── test_hello.py
│
├── requirements.txt
├── setup.py
├── README.md
└── LICENSE
```
That's it! You've generated a nice directory tree diagram.
## Current Features
If you run RP Tree with a directory path as an argument, then you get the full directory tree printed on your screen. The default input directory is your current directory.
RP Tree also provides the following options:
-`-v`, `--version` shows the application version and exits
-`-h`, `--help` shows a usage message
-`-d`, `--dir-only` generates a directory-only tree
-`-o`, `--output-file` generates a tree and save it to a file in markdown format
**RP Contacts** is a Contact Book application built with Python, [PyQt5](https://www.riverbankcomputing.com/static/Docs/PyQt5/index.html), and [SQLite](https://www.sqlite.org/docs.html).
## Running the Application
To run **RP Contacts**, you need to download the source code. Then open a terminal or command-line window and run the following steps:
1. Create and activate a Python virtual environment
```sh
$ cd rpcontacts/
$ python -m venv ./venv
$ source venv/bin/activate
(venv)$
```
2. Install the dependencies
```sh
(venv)$ python -m pip install-r requirements.txt
```
3. Run the application
```sh
(venv)$ python rpcontacts.py
```
**Note:** This application was coded and tested using Python 3.8.5 and PyQt 5.15.2.
Code supplementing the [Using the Python "heapq" Module and Priority Queues](https://realpython.com/python-heapq-module/) article.
## Usage
Run the following program:
```shell
$ python shortest-path.py
```
It will print out a map with the shortest path from the top-left corner to the bottom-right corner indicated with `@`.
## Changing the Map
In order to change the map the robot uses, modify the triple-quoted string that is assigned to `map` near the top of the file. Anything except `X` is interpreted as free from obstacles. Using `.` makes the map easier to read directly. You can make the map bigger, and a lot more complicated.
If there are so many obstacles that make finding a path from the top-left corner to the bottom right corner impossible, the program will raise an exception.
## Changing the Rules
If you want to play around with the code, here are some changes that you can make:
* How would you change the code so that the robot cannot go diagonally?
* How would you change the code so that the robot can only move right or down, but never left or up?
* (Harder) How would you change the code so that every step consumes energy, squares with `*` give energy, and the robot cannot move if it is out of energy?
* (Challenge) How would you change the code so that areas marked with `#` are not obstacles, but take twice as long to move through?