Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odstranit Tile(0, 0) #73

Closed
encukou opened this issue Nov 16, 2018 · 1 comment
Closed

Odstranit Tile(0, 0) #73

encukou opened this issue Nov 16, 2018 · 1 comment
Assignees

Comments

@encukou
Copy link
Member

encukou commented Nov 16, 2018

Když je v JSON mapě prázdné políčko (id=0), je reprezentováno pomocí Tile(path=0, rotation=0):

roboprojekt/backend.py

Lines 58 to 66 in 29125f3

for data in layer['data']:
id = get_tile_id(data)
if id == 0:
tile = Tile(0, 0)
else:
rotation_index = get_tile_rotation(data)
rotation = rotation_dict[rotation_index]
tile = Tile(rotation, paths[id])
tilelist_layer.append(tile)

Ve frontendy je pak pro path=0 speciální logika:

roboprojekt/frontend.py

Lines 43 to 47 in 29125f3

for key, value in state[layer].items():
rotation = value.rotation
path = value.path
if path != 0:
img = pyglet.image.load(path)

Nebylo by lepší takovéhle „nepolíčko“ do seznamu tilelist_layer vůbec nedávat?


Na tomhle miniproblému nic dalšího nezávisí. Doporučuju někomu, kdo se v datovém modelu ještě úplně neorientuje (a má nějakou tu hodinku času). Jestli už teď víš jak to vyřešit, přenech to někomu jinému (nebo lépe, nabídni se jako kouč).

@ivet1987 ivet1987 self-assigned this Nov 20, 2018
JureckovaK added a commit to JureckovaK/roboprojekt that referenced this issue Nov 22, 2018
New structure of data in class State(board, robots):

Board is now dictionary with coordinates as a key and the value
for certain key now contain all tiles with the same coordinates.
For example: {(0,0): [Tile, Tile], (0,1): [Tile] ... }

Robots remember now their location on the board.

Tile(0,0) also removed. Issue PyLadiesCZ#73 done.
@vahalova
Copy link
Member

Vyřešeno v #88

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants