SourceForge: maumataskis/maumataskis: changeset 4:6d25632a64d1
structure for point object default tip
authorArns Udovīčė <arnas@idiles.com>
Mon Aug 24 13:35:15 2009 +0300 (3 months ago)
changeset 46d25632a64d1
parent 320b3d0755745
structure for point object
Maumataskis/maumataskis/maumataskis.py
     1.1 --- a/Maumataskis/maumataskis/maumataskis.py	Tue Aug 18 14:32:38 2009 +0300
     1.2 +++ b/Maumataskis/maumataskis/maumataskis.py	Mon Aug 24 13:35:15 2009 +0300
     1.3 @@ -4,25 +4,45 @@
     1.4  # (c) Arns Udovīčė <zordsdavini at gmail dot com>
     1.5  #     Arturas Aidukas <artvras at users dot sourceforge dot net>
     1.6  
     1.7 +NEW_POINT = 0
     1.8 +LAND_POINT = 1
     1.9 +
    1.10 +points = dict()
    1.11 +borders = dict()
    1.12 +
    1.13 +class Point:
    1.14 +    """Main class for point object."""
    1.15 +
    1.16 +    def  __init__(self, user, x, y):
    1.17 +        """Adding point.
    1.18 +        - user: user id
    1.19 +        - x,y: point coordinates"""
    1.20 +
    1.21 +        if not x in points.keys():
    1.22 +            points[x] = dict()
    1.23 +
    1.24 +        points[x][y] = [user, NEW_POINT, list()]
    1.25 +
    1.26 +
    1.27  class Border:
    1.28 -  """Main class for lend borders. In idea they should renew every turn and
    1.29 -  after adding point should check is this border is of new lend.
    1.30 -  Methods:
    1.31 -  - add_point
    1.32 -  - check_lend
    1.33 -  - save
    1.34 -  - load"""
    1.35 +    """Main class for lend borders. In idea they should renew every turn and
    1.36 +    after adding point should check is this border is of new lend.
    1.37 +    Methods:
    1.38 +    - add_point
    1.39 +    - check_lend
    1.40 +    - save
    1.41 +    - load"""
    1.42  
    1.43 -  borders = dict()
    1.44  
    1.45 -  def  __init__(self, users):
    1.46 -    """Init for users lists.
    1.47 -    - users: int how many users there are"""
    1.48 -    for i in range(users):
    1.49 -        self.borders[i] = dict(nodes)
    1.50 +    def  __init__(self, users):
    1.51 +        """Init for users lists.
    1.52 +        - users: int how many users there are"""
    1.53 +        for i in range(users):
    1.54 +            self.borders[i] = dict(nodes)
    1.55  
    1.56 -def  add_point(self, turn, x, y):
    1.57 -    """Adding point to existing border or creat new one.
    1.58 -    - turn: user id
    1.59 -    - x,y: point coordinates"""
    1.60 -    return 0
    1.61 +print(points)
    1.62 +Point(0,0,1)
    1.63 +Point(0,0,0)
    1.64 +Point(1,2,0)
    1.65 +print(points)
    1.66 +