Just for fun, I decided to add another rule:
5) The tiles at the edges of the map must have grass at the outside.
Now we end up with this:
And there you have it. Feel free to check out my code here:
If you’re interested in learning about the technology behind this, you can find a good starting point here: