- commit
- 1b292c1891e2ce912018b52424863304d03f84a7
- parent
- 56a1dd78d676155075da4e85bec8a1bae504661f
- Author
- Tobias Bengfort <tobias.bengfort@gmx.net>
- Date
- 2014-11-01 11:09
render only the outlines of walls
Diffstat
| M | laneya/client.py | 24 | ++++++++++++++++++++++-- |
1 files changed, 22 insertions, 2 deletions
diff --git a/laneya/client.py b/laneya/client.py
@@ -21,10 +21,30 @@ class Client(protocol.ClientProtocolFactory): 21 21 .then(lambda response: self.render_floor(response['data'])) 22 22 23 23 def render_floor(self, data):24 -1 for x, column in enumerate(data['floor_layer']):-1 24 floor_layer = data['floor_layer'] -1 25 width = len(floor_layer) -1 26 height = len(floor_layer[0]) -1 27 -1 28 is_wall = lambda x, y: ( -1 29 x < 0 or x >= width or -1 30 y < 0 or y >= height or -1 31 floor_layer[x][y] == 'wall') -1 32 -1 33 sorrunded = lambda x, y: ( -1 34 is_wall(x - 1, y) and -1 35 is_wall(x - 1, y - 1) and -1 36 is_wall(x - 1, y + 1) and -1 37 is_wall(x, y - 1) and -1 38 is_wall(x + 1, y) and -1 39 is_wall(x, y + 1) and -1 40 is_wall(x + 1, y - 1) and -1 41 is_wall(x + 1, y + 1)) -1 42 -1 43 for x, column in enumerate(floor_layer): 25 44 for y, field in enumerate(column): 26 45 if field == 'wall':27 -1 screen.putstr(y, x, '#')-1 46 if not sorrunded(x, y): -1 47 screen.putstr(y, x, '#') 28 48 29 49 def updateReceived(self, action, **kwargs): # TODO 30 50 if action == 'position':