Skip to content

Commit

Permalink
Merge pull request #51 from AllYarnsAreBeautiful/improvements
Browse files Browse the repository at this point in the history
added example and removed prints
  • Loading branch information
niccokunzmann committed Aug 4, 2016
2 parents faf47e9 + 5e291bb commit 1cf94e6
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 3 deletions.
2 changes: 1 addition & 1 deletion knittingpattern/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# there should be no imports

#: the version of the knitting pattern library
__version__ = '0.1.14'
__version__ = '0.1.15'

#: an empty knitting pattern set as specification
EMPTY_KNITTING_PATTERN_SET = {"version": "0.1", "type": "knitting pattern",
Expand Down
78 changes: 78 additions & 0 deletions knittingpattern/examples/block4x4.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{
"type" : "knitting pattern",
"version" : "0.1",
"comment" : {
"content" : "4x4 meshes block",
"type" : "markdown"
},
"patterns" : [
{
"id" : "knit",
"name" : "knit 4x4",
"rows" : [
{
"id" : 1,
"instructions" : [
{"id": "1.0", "color": "green"},
{"id": "1.1"},
{"id": "1.2"},
{"id": "1.3"}
]
},
{
"id" : 3,
"instructions" : [
{"id": "3.0"},
{"id": "3.1"},
{"id": "3.2", "color": "green"},
{"id": "3.3"}
]
},
{
"id" : 2,
"instructions" : [
{"id": "2.0"},
{"id": "2.1", "color": "green"},
{"id": "2.2"},
{"id": "2.3"}
]
},
{
"id" : 4,
"instructions" : [
{"id": "4.0"},
{"id": "4.1"},
{"id": "4.2"},
{"id": "4.3", "color": "green"}
]
}
],
"connections" : [
{
"from" : {
"id" : 1
},
"to" : {
"id" : 2
}
},
{
"from" : {
"id" : 2
},
"to" : {
"id" : 3
}
},
{
"from" : {
"id" : 3
},
"to" : {
"id" : 4
}
}
]
}
]
}
4 changes: 2 additions & 2 deletions knittingpattern/walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ def walk(knitting_pattern):
free_rows.append(row)
assert free_rows
while free_rows:
print("free rows:", free_rows)
# print("free rows:", free_rows)
row = free_rows.pop(0)
walk.append(row)
assert row not in rows_before
for freed_row in reversed(row.rows_after):
todo = rows_before[freed_row]
print(" freed:", freed_row, todo)
# print(" freed:", freed_row, todo)
todo.remove(row)
if not todo:
del rows_before[freed_row]
Expand Down

0 comments on commit 1cf94e6

Please sign in to comment.