Interlock

Interlock is the fabric produced when alternating front knits and back knits, and switching the pattern of alternation every row. It is a dense, balanced fabric.

Interlock is, in effect, two sheets of rib which are interlaced.

for written in
//title: Interlock Sheet (javascript with knitout module)
// Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

//include knitout module:
const knitout = require('knitout'); //include knitout module
const K = new knitout.Writer({ carriers:['1', '2', '3', '4', '5', '6'] });
K.addHeader('Machine', 'Kniterate');

//Parameters:
let min = 1; //needle number of left edge
let max = 20; //needle number of right edge
let rows = 20; //number of rows to knit
let carrier = "3"; //carrier name

//Because of its structure, interlock does not require a [cast-on](/cast-on/).
//Instead, we just bring the yarn in and start knitting:
K.in(carrier);

//On kniterate, we write an extra row here to bring the yarn carrier to the right:
for (let n = min; n <= max; n += 1) {
	if (n === max) {
		//Skip the rightmost stitch in the first row to prevent rightmost column from unravelling:
		continue;
	}
	if ((max - n) % 2 === 0) {
		K.knit("+", 'b' + n, carrier);
	} else {
		K.knit("+", 'f' + n, carrier);
	}
}

// ---- interlock sheet ----
for (let r = 0; r <= rows; r += 1) {
	if (r % 2 === 0) {
		//Even, left-going row:
		for (let n = max; n >= min; n -= 1) {
			if ((max - n) % 2 === 0) {
				K.knit("-", 'f' + n, carrier);
			} else {
				K.knit("-", 'b' + n, carrier);
			}
		}
	} else {
		//Odd, right-going row:
		for (let n = min; n <= max; n += 1) {
			if ((max - n) % 2 === 0) {
				K.knit("+", 'b' + n, carrier);
			} else {
				K.knit("+", 'f' + n, carrier);
			}
		}
	}
}

// ---- take carrier out and drop remaining loops ----
//Send carrier back to its parking location:
K.out(carrier);

//drop loops:
for (let n = min; n <= max; n += 1) {
	K.drop('f' + n);
	K.drop('b' + n);
}

K.write('interlock-sheet.kniterate.k');
;!knitout-2
;;Machine: Kniterate
;;Carriers: 1 2 3 4 5 6

;title: Interlock Sheet (raw knitout)
; Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

;Parameters:
; min = 1 -- needle number of left edge
; max = 20 -- needle number of right edge
; rows = 20 -- number of rows to knit
; carrier = "3" -- carrier name

;Because of its structure, interlock does not require a [cast-on](/cast-on/).
;Instead, we just bring the yarn in and start knitting:
in 3

;On kniterate, we write an extra row here to bring the yarn carrier to the right:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
;Skip the rightmost stitch in the first row to prevent rightmost column from unravelling:

; ---- interlock sheet ----
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

; ---- take carrier out and drop remaining loops ----
;Send carrier back to its parking location:
out 3

;drop loops:
drop f1
drop b1
drop f2
drop b2
drop f3
drop b3
drop f4
drop b4
drop f5
drop b5
drop f6
drop b6
drop f7
drop b7
drop f8
drop b8
drop f9
drop b9
drop f10
drop b10
drop f11
drop b11
drop f12
drop b12
drop f13
drop b13
drop f14
drop b14
drop f15
drop b15
drop f16
drop b16
drop f17
drop b17
drop f18
drop b18
drop f19
drop b19
drop f20
drop b20
//title: Interlock Sheet (plain javascript)
// Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

//Write header:
console.log(';!knitout-2');
console.log(';;Machine: Kniterate');
console.log(';;Carriers: 1 2 3 4 5 6');

//Parameters:
let min = 1; //needle number of left edge
let max = 20; //needle number of right edge
let rows = 20; //number of rows to knit
let carrier = "3"; //carrier name

//Because of its structure, interlock does not require a [cast-on](/cast-on/).
//Instead, we just bring the yarn in and start knitting:
console.log(`in ${carrier}`);

//On kniterate, we write an extra row here to bring the yarn carrier to the right:
for (let n = min; n <= max; n += 1) {
	if (n === max) {
		//Skip the rightmost stitch in the first row to prevent rightmost column from unravelling:
		continue;
	}
	if ((max - n) % 2 === 0) {
		console.log(`knit + b${n} ${carrier}`);
	} else {
		console.log(`knit + f${n} ${carrier}`);
	}
}

// ---- interlock sheet ----
for (let r = 0; r <= rows; r += 1) {
	if (r % 2 === 0) {
		//Even, left-going row:
		for (let n = max; n >= min; n -= 1) {
			if ((max - n) % 2 === 0) {
				console.log(`knit - f${n} ${carrier}`);
			} else {
				console.log(`knit - b${n} ${carrier}`);
			}
		}
	} else {
		//Odd, right-going row:
		for (let n = min; n <= max; n += 1) {
			if ((max - n) % 2 === 0) {
				console.log(`knit + b${n} ${carrier}`);
			} else {
				console.log(`knit + f${n} ${carrier}`);
			}
		}
	}
}

// ---- take carrier out and drop remaining loops ----
//Send carrier back to its parking location:
console.log(`out ${carrier}`);

//drop loops:
for (let n = min; n <= max; n += 1) {
	console.log(`drop f${n}`);
	console.log(`drop b${n}`);
}
#title: Interlock Sheet (plain python)
# Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

#Write header:
print(';!knitout-2')
print(';;Machine: Kniterate')
print(';;Carriers: 1 2 3 4 5 6')

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

#Because of its structure, interlock does not require a [cast-on](/cast-on/).
#Instead, we just bring the yarn in and start knitting:
print(f"in {carrier}")

#On kniterate, we write an extra row here to bring the yarn carrier to the right:
for n in range(min, max+1, 1):
	if n == max:
		#Skip the rightmost stitch in the first row to prevent rightmost column from unravelling:
		continue
	if (max - n) % 2 == 0:
		print(f"knit + b{n} {carrier}")
	else:
		print(f"knit + f{n} {carrier}")

# ---- interlock sheet ----
for r in range(0, rows+1, 1):
	if r % 2 == 0:
		#Even, left-going row:
		for n in range(max, min-1, -1):
			if (max - n) % 2 == 0:
				print(f"knit - f{n} {carrier}")
			else:
				print(f"knit - b{n} {carrier}")
	else:
		#Odd, right-going row:
		for n in range(min, max+1, 1):
			if (max - n) % 2 == 0:
				print(f"knit + b{n} {carrier}")
			else:
				print(f"knit + f{n} {carrier}")

# ---- take carrier out and drop remaining loops ----
#Send carrier back to its parking location:
print(f"out {carrier}")

#drop loops:
for n in range(min, max+1, 1):
	print(f"drop f{n}")
	print(f"drop b{n}")
#title: Interlock Sheet (python with knitout module)
# Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

import knitout
K = knitout.Writer('1 2 3 4 5 6');
K.addHeader('Machine', 'Kniterate');

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

#Because of its structure, interlock does not require a [cast-on](/cast-on/).
#Instead, we just bring the yarn in and start knitting:
K.ingripper(carrier)

#On kniterate, we write an extra row here to bring the yarn carrier to the right:
for n in range(min, max+1, 1):
	if n == max:
		#Skip the rightmost stitch in the first row to prevent rightmost column from unravelling:
		continue
	if (max - n) % 2 == 0:
		K.knit("+", 'b' + str(n), carrier)
	else:
		K.knit("+", 'f' + str(n), carrier)

# ---- interlock sheet ----
for r in range(0, rows+1, 1):
	if r % 2 == 0:
		#Even, left-going row:
		for n in range(max, min-1, -1):
			if (max - n) % 2 == 0:
				K.knit("-", 'f' + str(n), carrier)
			else:
				K.knit("-", 'b' + str(n), carrier)
	else:
		#Odd, right-going row:
		for n in range(min, max+1, 1):
			if (max - n) % 2 == 0:
				K.knit("+", 'b' + str(n), carrier)
			else:
				K.knit("+", 'f' + str(n), carrier)

# ---- take carrier out and drop remaining loops ----
#Send carrier back to its parking location:
K.outgripper(carrier)

#drop loops:
for n in range(min, max+1, 1):
	K.drop('f' + str(n))
	K.drop('b' + str(n))

K.write('interlock-sheet.kniterate.k')
//title: Interlock Sheet (javascript with knitout module)
// Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

//include knitout module:
const knitout = require('knitout'); //include knitout module
const K = new knitout.Writer({ carriers:['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] });
K.addHeader('Machine', 'SWGN2');

//Parameters:
let min = 1; //needle number of left edge
let max = 20; //needle number of right edge
let rows = 20; //number of rows to knit
let carrier = "3"; //carrier name

//Because of its structure, interlock does not require a [cast-on](/cast-on/).
//Instead, we just bring the yarn in and start knitting:
K.inhook(carrier);
K.stitchNumber(105);

// ---- interlock sheet ----
for (let r = 0; r <= rows; r += 1) {
	if (r % 2 === 0) {
		//Even, left-going row:
		for (let n = max; n >= min; n -= 1) {
			if (r === 0 && n === min) {
				//Skip the leftmost stitch in the first row to prevent leftmost column from unravelling:
				continue;
			}
			if ((max - n) % 2 === 0) {
				K.knit("-", 'f' + n, carrier);
			} else {
				K.knit("-", 'b' + n, carrier);
			}
		}
	} else {
		//Odd, right-going row:
		for (let n = min; n <= max; n += 1) {
			if ((max - n) % 2 === 0) {
				K.knit("+", 'b' + n, carrier);
			} else {
				K.knit("+", 'f' + n, carrier);
			}
		}
	}
	
	//The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
	if (r === 1) {
		K.releasehook(carrier);
	}
}

// ---- take carrier out and drop remaining loops ----
//Take carrier out with yarn inserting hook:
K.outhook(carrier);

//drop loops:
for (let n = min; n <= max; n += 1) {
	K.drop('f' + n);
	K.drop('b' + n);
}

K.write('interlock-sheet.swgn2.k');
;!knitout-2
;;Machine: SWGN2
;;Carriers: 1 2 3 4 5 6 7 8 9 10

;title: Interlock Sheet (raw knitout)
; Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

;Parameters:
; min = 1 -- needle number of left edge
; max = 20 -- needle number of right edge
; rows = 20 -- number of rows to knit
; carrier = "3" -- carrier name

;Because of its structure, interlock does not require a [cast-on](/cast-on/).
;Instead, we just bring the yarn in and start knitting:
inhook 3
x-stitch-number 105

; ---- interlock sheet ----
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
;Skip the leftmost stitch in the first row to prevent leftmost column from unravelling:

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
releasehook 3
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Odd, right-going row:
knit + f1 3
knit + b2 3
knit + f3 3
knit + b4 3
knit + f5 3
knit + b6 3
knit + f7 3
knit + b8 3
knit + f9 3
knit + b10 3
knit + f11 3
knit + b12 3
knit + f13 3
knit + b14 3
knit + f15 3
knit + b16 3
knit + f17 3
knit + b18 3
knit + f19 3
knit + b20 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
;Even, left-going row:
knit - f20 3
knit - b19 3
knit - f18 3
knit - b17 3
knit - f16 3
knit - b15 3
knit - f14 3
knit - b13 3
knit - f12 3
knit - b11 3
knit - f10 3
knit - b9 3
knit - f8 3
knit - b7 3
knit - f6 3
knit - b5 3
knit - f4 3
knit - b3 3
knit - f2 3
knit - b1 3

;The yarn inserting hook can stop holding the yarn tail after two rows have been knit:

; ---- take carrier out and drop remaining loops ----
;Take carrier out with yarn inserting hook:
outhook 3

;drop loops:
drop f1
drop b1
drop f2
drop b2
drop f3
drop b3
drop f4
drop b4
drop f5
drop b5
drop f6
drop b6
drop f7
drop b7
drop f8
drop b8
drop f9
drop b9
drop f10
drop b10
drop f11
drop b11
drop f12
drop b12
drop f13
drop b13
drop f14
drop b14
drop f15
drop b15
drop f16
drop b16
drop f17
drop b17
drop f18
drop b18
drop f19
drop b19
drop f20
drop b20
//title: Interlock Sheet (plain javascript)
// Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

//Write header:
console.log(';!knitout-2');
console.log(';;Machine: SWGN2');
console.log(';;Carriers: 1 2 3 4 5 6 7 8 9 10');

//Parameters:
let min = 1; //needle number of left edge
let max = 20; //needle number of right edge
let rows = 20; //number of rows to knit
let carrier = "3"; //carrier name

//Because of its structure, interlock does not require a [cast-on](/cast-on/).
//Instead, we just bring the yarn in and start knitting:
console.log(`inhook ${carrier}`);
console.log(`x-stitch-number 105`);

// ---- interlock sheet ----
for (let r = 0; r <= rows; r += 1) {
	if (r % 2 === 0) {
		//Even, left-going row:
		for (let n = max; n >= min; n -= 1) {
			if (r === 0 && n === min) {
				//Skip the leftmost stitch in the first row to prevent leftmost column from unravelling:
				continue;
			}
			if ((max - n) % 2 === 0) {
				console.log(`knit - f${n} ${carrier}`);
			} else {
				console.log(`knit - b${n} ${carrier}`);
			}
		}
	} else {
		//Odd, right-going row:
		for (let n = min; n <= max; n += 1) {
			if ((max - n) % 2 === 0) {
				console.log(`knit + b${n} ${carrier}`);
			} else {
				console.log(`knit + f${n} ${carrier}`);
			}
		}
	}
	
	//The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
	if (r === 1) {
		console.log(`releasehook ${carrier}`);
	}
}

// ---- take carrier out and drop remaining loops ----
//Take carrier out with yarn inserting hook:
console.log(`outhook ${carrier}`);

//drop loops:
for (let n = min; n <= max; n += 1) {
	console.log(`drop f${n}`);
	console.log(`drop b${n}`);
}
#title: Interlock Sheet (plain python)
# Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

#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
rows = 20 #number of rows to knit
carrier = "3" #carrier name

#Because of its structure, interlock does not require a [cast-on](/cast-on/).
#Instead, we just bring the yarn in and start knitting:
print(f"inhook {carrier}")
print(f"x-stitch-number 105")

# ---- interlock sheet ----
for r in range(0, rows+1, 1):
	if r % 2 == 0:
		#Even, left-going row:
		for n in range(max, min-1, -1):
			if r == 0 and n == min:
				#Skip the leftmost stitch in the first row to prevent leftmost column from unravelling:
				continue
			if (max - n) % 2 == 0:
				print(f"knit - f{n} {carrier}")
			else:
				print(f"knit - b{n} {carrier}")
	else:
		#Odd, right-going row:
		for n in range(min, max+1, 1):
			if (max - n) % 2 == 0:
				print(f"knit + b{n} {carrier}")
			else:
				print(f"knit + f{n} {carrier}")
	
	#The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
	if r == 1:
		print(f"releasehook {carrier}")

# ---- take carrier out and drop remaining loops ----
#Take carrier out with yarn inserting hook:
print(f"outhook {carrier}")

#drop loops:
for n in range(min, max+1, 1):
	print(f"drop f{n}")
	print(f"drop b{n}")
#title: Interlock Sheet (python with knitout module)
# Knit a sheet with alternating rows of back/front and front/back knits; effectively two [1x1 rib]() sheets interlocked with each-other.

import knitout
K = knitout.Writer('1 2 3 4 5 6 7 8 9 10');
K.addHeader('Machine', 'SWGN2');

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

#Because of its structure, interlock does not require a [cast-on](/cast-on/).
#Instead, we just bring the yarn in and start knitting:
K.inhook(carrier)
K.stitchNumber(105)

# ---- interlock sheet ----
for r in range(0, rows+1, 1):
	if r % 2 == 0:
		#Even, left-going row:
		for n in range(max, min-1, -1):
			if r == 0 and n == min:
				#Skip the leftmost stitch in the first row to prevent leftmost column from unravelling:
				continue
			if (max - n) % 2 == 0:
				K.knit("-", 'f' + str(n), carrier)
			else:
				K.knit("-", 'b' + str(n), carrier)
	else:
		#Odd, right-going row:
		for n in range(min, max+1, 1):
			if (max - n) % 2 == 0:
				K.knit("+", 'b' + str(n), carrier)
			else:
				K.knit("+", 'f' + str(n), carrier)
	
	#The yarn inserting hook can stop holding the yarn tail after two rows have been knit:
	if r == 1:
		K.releasehook(carrier)

# ---- take carrier out and drop remaining loops ----
#Take carrier out with yarn inserting hook:
K.outhook(carrier)

#drop loops:
for n in range(min, max+1, 1):
	K.drop('f' + str(n))
	K.drop('b' + str(n))

K.write('interlock-sheet.swgn2.k')