-
Notifications
You must be signed in to change notification settings - Fork 3
Maze Level Format
darrenkuo edited this page Mar 14, 2011
·
9 revisions
We need to decide the format of our mazes to be saved by the webapp and loaded on the handset. Important considerations are what formats are easy to use on Android, and which formats will be easy to extend with new features.
- ...
- ...
I'm guessing that if we go with XML, we'll have a form of something similar to (feel free to edit):
<Node id="42">
<LatLng lat=136.98239 lng=-96.1234></LatLng>
</Node>
<Node id="27">
<LatLng lat=136.98843 lng=-96.12282></LatLng>
</Node>
<Edge id="13" source="27" dest="42"></Edge>
For a graph, all we need are nodes and edges. This XML format describes the following data structures in python:
class Node:
def __init__(self, latlng):
self.latlng = latlng
class Edge:
"""
s and e are both of type Node.
"""
def __init__(self, s, e):
self.s = s
self.e = e