City generation on a matrix
What is this stuff?
In green there are free spaces and in white there are streets.
Features that have been sought for this project:
City with roads that complete every free space,
The distance between the streets should be two blocks, minimum 1 and maximum 3 for special cases.
How does it work in general?
The algorithm will return you a matrix of dimensions defined by yourself with 0 for free zones and 1 for roads. You can also add new ids for other future objects such as buildings. In this post is just explained how to create the road network. The first thing to do is to trace the main road goes from side to side of the city:
Once you have created this main road you will need to set the branch points to create the branched roads:
The road goes straightforward for 4 blocks and can not go back. I set the branch points every 4 blocks. For each branch point, I create a road that will have, one or more branched roads.
Example:
The process will be over when the branch points are no longer valid:
Fully generated map.
Without colors
Final print!
How to code this algorithm?
Programming this algorithm can be very complicated if you do not use the right precautions. We will be programming modularly. A general file that will implement its functionality through other sub files.
To see the full post click HERE, it is my blog!
Congratulations @gianvy! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of posts published
Award for the number of upvotes received
Award for the number of comments
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Interessante! In bocca al lupo per il tuo progetto!
Grazie mille !
Di che progetto si tratta? O stai sotto NDA?
E' un progettino mio, nessun NDA, ma per ora non ne parlo!
Congratulations @gianvy! You received a personal award!
You can view your badges on your Steem Board and compare to others on the Steem Ranking
Vote for @Steemitboard as a witness to get one more award and increased upvotes!