https://github.com/hingston/generate-archipelago
Python Programming Task
https://github.com/hingston/generate-archipelago
Last synced: 4 months ago
JSON representation
Python Programming Task
- Host: GitHub
- URL: https://github.com/hingston/generate-archipelago
- Owner: hingston
- Created: 2019-10-13T16:15:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-10-04T00:59:23.000Z (over 1 year ago)
- Last Synced: 2025-01-09T02:34:31.334Z (5 months ago)
- Language: Python
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python Programming Task
### Exercise 1 – Generating islands
We would like you to write some code to generate some ‘islands’ in an N * N grid of Boolean numbers (1s or 0s). Land is indicated with a 1, and sea by a 0. Islands are connected pieces of land.The code should allow some flexibility in generating different types of archipelago:
- number of islands
- size of islands
- shape of islands
### Exercise 2 – Counting islands
Please write some code to read in an N * N grid of Boolean numbers, and count the number of islands in the grid. Land is indicated with a 1, and sea by a 0. Islands are connected pieces of land.
### Requirements
- Python 3.6+
- Install requirements.txt with `$ pip3 install -r requirements.txt`
### Usage
##### Archipelago.py
`$ python Archipelago.py [-h] [--n N] [--weathering WEATHERING] [--sea_level SEA_LEVEL] [--seed SEED]`
###### optional arguments:
```
-h, --help Show this help message and exit.
--n N Used to create an N * N grid of pixels. Must be greater than 0.
--weathering WEATHERING The weathering of the islands. Must be between 1 and 5, where 1 is most weathered
(smoother edges) and 5 is least weathered (rougher edges).
--sea_level SEA_LEVEL The sea level. Must be between -1 and 1, where -1 is all land and 1 is all water.
--seed SEED The seed the islands are generated from. Must be between 0 and 65535.
```
##### Tests.py
`$ python Tests.py`