I'm trying to whip up a system to help me run Diplomacy games over email by having a system for users to submit their moves via web form. Ideally, this should examine the current state of the game and only allow legal moves.
For those who aren't familiar with Dip, here's the quick summary. The map is much like that of Risk, quasi-country territories with a single generic army-type unit. Dip also has ocean territories and Naval units. Armies move only on land, Fleets move only in water or coastal land.
So: I want a representation of the graph this map represents, but I've got this duality to deal with. Seems like weighted edges (1 for army-move-valid, 2 for fleet-move-valid, 3 for both-move-valid) should work to this end. Now here's the big twist causing me problems (finally!)
some territories have disjoint (that is, separate north and south) coastlines. Suppose, if you will, a map which has Bulgaria as one territory and Constantinople (the Turkish straits) as another. A Fleet sails from the Black Sea to Bulgaria's East Coast -- perfectly legal. Elsewhere, a fleet can sail from the Mediterranean to Bulgaria's South Coast -- again, legal. However, a fleet that entered the South coast can't leave via the East coast -- it would have to sail first through the Turkish straits. So the problem is that there are logically 3 different territories superimposed here (the land version for armies plus the two coastlines for fleets). They're all identical for purposes of ownership and defense, but radically different for purposes of movement. Long story short: I don't know how to reconcile this mess into a workable graph.
Any thoughts / ideas? Actual map can be seen for illustrative purposes.
For those who aren't familiar with Dip, here's the quick summary. The map is much like that of Risk, quasi-country territories with a single generic army-type unit. Dip also has ocean territories and Naval units. Armies move only on land, Fleets move only in water or coastal land.
So: I want a representation of the graph this map represents, but I've got this duality to deal with. Seems like weighted edges (1 for army-move-valid, 2 for fleet-move-valid, 3 for both-move-valid) should work to this end. Now here's the big twist causing me problems (finally!)
some territories have disjoint (that is, separate north and south) coastlines. Suppose, if you will, a map which has Bulgaria as one territory and Constantinople (the Turkish straits) as another. A Fleet sails from the Black Sea to Bulgaria's East Coast -- perfectly legal. Elsewhere, a fleet can sail from the Mediterranean to Bulgaria's South Coast -- again, legal. However, a fleet that entered the South coast can't leave via the East coast -- it would have to sail first through the Turkish straits. So the problem is that there are logically 3 different territories superimposed here (the land version for armies plus the two coastlines for fleets). They're all identical for purposes of ownership and defense, but radically different for purposes of movement. Long story short: I don't know how to reconcile this mess into a workable graph.
Any thoughts / ideas? Actual map can be seen for illustrative purposes.