#title: Sheet Twisted-Tuck Cast-On (plain python)
# Casts on a sheet by knitting twisted tucks on all needles; slow!

#Write header:
print(';!knitout-2')
print(';;Machine: SWGN2')
print(';;Carriers: 1 2 3 4 5 6 7 8 9 10')

#Parameters:
min = 1 #needle number of left edge
max = 20 #needle number of right edge
carrier = "3" #carrier name

#Bring in carrier:
print(f"inhook {carrier}")
#Set stitch table entry for cast-on:
print(f"x-stitch-number 101")

#Use a twisted tuck to cast on every stitch.
#Note: this requires a new pass for every stitch, so is pretty slow!
#There are both faster and fancier cast-ons.
#On SWGN2 machines, carriers start on the right, so will start with rightmost needle.
#Miss the rightmost needle to ensure yarn inserting hook is parked to its right instead of left:
print(f"miss - f{max} {carrier}")
for n in range(max, min-1, -1):
	print(f"tuck + f{n} {carrier}")
#Set stitch table entry for knitting:
print(f"x-stitch-number 105")
#knit a plain row to bring the carrier back to the right:
for n in range(min, max+1, 1):
	print(f"knit + f{n} {carrier}")
#send out yarn inserting hook; it is no longer needed to hold the yarn in place:
print(f"releasehook {carrier}")

#...now can knit on [min,max].
