<p>Is there a trivial, or at least moderately straight-forward way to generate territory maps (e.g. Risk)?</p>

<p>I have looked in the past and the best I could find were vague references to Voronoi diagrams.  An example of a Voronoi diagram is this:</p>

<p><img src="https://i.stack.imgur.com/aX9Tp.gif" alt="here">.</p>

<p>These hold promise, but I guess i haven't seen any straight-forward ways of rendering these, let alone holding them in some form of data structure to treat each territory as an object.</p>

<p>Another approach that holds promise is flood fill, but again I'm unsure on the best way to start with this approach.</p>

<p>Any advice would be much appreciated.</p>

[{'answer_id': 4277, 'author': 'Michiel de Mare', 'author_id': 136, 'author_profile': 'https://Stackoverflow.com/users/136', 'pm_score': 2, 'selected': False, 'text': '<p>Why not use a map of primitives (triangles, squares), distribute the starting points for the countries (the "capitals"), and then randomly expanding the countries by adding a random adjacent primitive to the country.</p>\n'}, {'answer_id': 4281, 'author': 'Chris Bunch', 'author_id': 422, 'author_profile': 'https://Stackoverflow.com/users/422', 'pm_score': 4, 'selected': True, 'text': '<p>The best reference I\'ve seen on them is <a href="https://rads.stackoverflow.com/amzn/click/com/3540779736" rel="noreferrer" rel="nofollow noreferrer">Computational Geometry: Algorithms and Applications</a>, which covers Voronoi diagrams, Delaunay triangulations (similar to Voronoi diagrams and each can be converted into the other), and other similar data structures. </p>\n\n<p>They talk about all the data structures you need but they don\'t give you the code necessary to implement it (which may be a good exercise). In terms of code, an Amazon search shows the book <a href="https://rads.stackoverflow.com/amzn/click/com/0521649765" rel="noreferrer" rel="nofollow noreferrer">Computational Geometry in C</a>, which presumably comes with the code (although since you\'re stuck in C, you\'d mind as well get the other one and implement it in whatever language you want). I also don\'t have any experience with this book, only the first.</p>\n\n<p>Sorry to have only books to recommend! The only decent online resource I\'ve seen on them are the two <a href="http://en.wikipedia.org/wiki/Voronoi_diagram" rel="noreferrer">Wikipedia</a> <a href="http://en.wikipedia.org/wiki/Delaunay_triangulation" rel="noreferrer">articles</a>, which doesn\'t really tell you implementation details. <a href="http://www.cgal.org/Manual/3.3/doc_html/cgal_manual/packages.html#Part:VoronoiDiagrams" rel="noreferrer">This link</a> may be helpful though.</p>\n'}, {'answer_id': 29533, 'author': 'Ashwin Nanjappa', 'author_id': 1630, 'author_profile': 'https://Stackoverflow.com/users/1630', 'pm_score': 2, 'selected': False, 'text': '<p><strong><a href="http://cgal.org/" rel="nofollow noreferrer">CGAL</a></strong> is a C++ library that has data structures and algorithms used in Computational Geometry.</p>\n'}, {'answer_id': 64765, 'author': 'CommanderTso', 'author_id': 8365, 'author_profile': 'https://Stackoverflow.com/users/8365', 'pm_score': 2, 'selected': False, 'text': '<p>I\'m actually dealing with exactly this kind of stuff for my company\'s video game.  The most useful info I\'ve found are at these two links:</p>\n\n<p><a href="http://local.wasp.uwa.edu.au/~pbourke/papers/triangulate/" rel="nofollow noreferrer">Paul Bourke</a>\'s page at UWA, with his 1989 paper on Delaunay and a series of implementation links.</p>\n\n<p>A <a href="http://www.codeguru.com/cpp/data/mfc_database/misc/article.php/c8901/" rel="nofollow noreferrer">great explanation of the psudocode and a visual</a> of doing Delaunay at codeGuru.com.</p>\n\n<p>In terms of rendering these - most of the implementations I\'ve found will need massaging to get what you\'d want, but since using this for a game map would lead to a number of points plus lines between them, it could be a very simple matter to do draw this out to screen.</p>\n'}]
['https://Stackoverflow.com/questions/4225', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/364/']