Пример #1
0
 def get(self):
     db.delete(Tile.all())
     db.delete(Avatar.all())
     cleared = make_maze(20, 20)
     for t in cleared:
         view = []
         for vy in range(t[1] - view_radius, t[1] + view_radius + 1):
             for vx in range(t[0] - view_radius, t[0] + view_radius + 1):
                 if (vx, vy) in cleared:
                     shape = get_shape(vx, vy, cleared)
                     view.append({'x': vx, 'y': vy, 'shape': shape})
         shape = get_shape(t[0], t[1], cleared)
         key = db.Key.from_path(
             'Maze', 'bogart',
             'Tile', '%d-%d' % (t[0], t[1])
         )
         Tile(
             key=key,
             x=t[0],
             y=t[1],
             shape=shape,
             view_blob=json.dumps(view)
         ).put()
     Avatar(x=0, y=0, name='jack').put()
     self.response.out.write('Generator %s' % cleared)
Пример #2
0
 def get(self):
   db.delete(Tile.all())
   db.delete(Avatar.all())
   cleared = make_maze(20,20)
   for t in cleared:
       view = []
       for vy in range(t[1]-view_radius,t[1]+view_radius+1):
           for vx in range(t[0]-view_radius,t[0]+view_radius+1):
               if (vx,vy) in cleared:
                   view.append({'x':vx, 'y':vy})
       Tile(x=t[0], y=t[1], view_blob=pickle.dumps(view, 2)).put()
   Avatar(x=0,y=0,name='jack').put()
   self.response.out.write('Generator %s'%cleared)