Skip to content

Commit

Permalink
switch to zero-based index on website
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbenn committed Dec 20, 2018
1 parent 033cdf8 commit 5b5501d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions gengo/app/static/js/board.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ def on_message(evt):
#board = ast.literal_eval(evt.data)
# need to fix, but ast not loaded; should parse manually
board = eval(evt.data)
for x in range(1, size):
for y in range(1, size):
for x in range(size):
for y in range(size):
document[f"{x},{y}"].attrs['fill'] = board[x][y]

#alert(f"Message received: {evt.data}")
Expand All @@ -21,8 +21,8 @@ def on_click(ev):
ws.send(ev.target.id)


for x in range(1, size):
for y in range(1, size):
for x in range(size):
for y in range(size):
ident = f"{x},{y}"
document[ident].bind("click", on_click)

8 changes: 4 additions & 4 deletions gengo/app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
<script src="{{url_for('static', filename='js/board.py')}}" type="text/python"></script>

<svg width="500" height="500">
{% for x in 1,2,3,4,5,6,7,8,9,10 %}
{% for y in 1,2,3,4,5,6,7,8,9,10 %}
{% for x in 0,1,2,3,4,5,6,7,8,9,10 %}
{% for y in 0,1,2,3,4,5,6,7,8,9,10 %}
<rect id="{{'{},{}'.format(x,y)}}"
x="{{x*50}}" y="{{y*50}}"
height="50" width="50" fill="sandybrown", stroke="red"/>
x="{{x*25}}" y="{{y*25}}"
height="25" width="25" fill="sandybrown", stroke="red"/>
{% endfor %}
{% endfor %}
</svg>
Expand Down

0 comments on commit 5b5501d

Please sign in to comment.