Skip to content

This repository contains a code that can be run using python to randomly generate a two-color, knitted mosaic scarf pattern.

Notifications You must be signed in to change notification settings

Denise-R/randomly_generated_mosaic_scarf_pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 

Repository files navigation

Denise Rauschendorfer

9/15/2022

Randomly Generated Mosaic Scarf Pattern

This repository contains a code that can be run using python to randomly generate a two-color, knitted mosaic scarf pattern. The pattern created will automatically be written into a .txt file titled "knit_mosaic_pattern.txt".

The pattern created from executing the following code consists of a randomly generated 4 by 2.6 inch rectangular mosaic block that repeats 135 times. A graphical representation of the repeating rectangular block will automatically be created in a .jpg file titled "knit_mosaic_graphic_pattern.jpg".

There are 2(6*4) = 16,777,216 different pattern combinations that can be generated from this code!!

Note: The total number of pattern combinations is 16,777,216 because there are 6 unique stitches per row, 4 unique rows per block, and 2 different types of stitches to choose from (knit/purl or slip)

The following code was executed using Python 3.10.

Creating a Written Pattern

Section 1:

In order to create a randomly generated written pattern, the modules 'random', 're', and 'np' need to be imported. Additionally, the operations 'pyplot' and 'colors' in the module 'matplotlib' are also required.

This section of code also includes creating the lists final_even and final_odd. These lists will later be used to save the finished rows created in Section 5, and are needed for the code in Sections 2-5 to run without resulting in an error. The list graphic is also created and will be useful in Sections 8-9 when creating a graphic representation of the repeating rectangular block.

import random
import re
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import colors

final_even=[]
final_odd=[]
graphic=[]

Section 2:

This section of code specifies the type of stitch needed in one row of the repeated rectangular block. Each 4 by 2.6 inch rectangular block is composed of 18 stitches (x axis) and 16 rows (y axis). In order for the pattern created to show up best on a scarf, each row of the rectangular block is broken up into 6 different sections(18 stitches/6 = 3 stitches per section). Therefore, each row of the rectangular block contains only 6 stitches of interest. To specify the type of stitch for the 6 stitches of interest, the following steps are taken:

  1. A list titled list is created.
  2. A for loop that repeats 6 times is created.
  3. Within the for loop, either a 0 or 1 is assigned to a variable named n. This value is then saved in list. Once this process has repeated 6 times, the for loop is broken.
  4. The list populated by the for loop is then saved and added to final_graphic. The list final_graphic will be used later in Section 8 to make a graphic representation of the repeating rectangular mosaic block.
  5. Another list titled odd_row1 is created.
  6. A second for loop is created that repeats for each item within list.
  7. Within this for loop, if the ith item in list equals 0, this stitch is arbitrarily determined to be "k" or a knit stitch. Similarly, if the ith item in list equals 1, it is "sl" or a slipped stitch. Once this process has repeated for all the items in list, the for loop is broken.
list = []
for i in range(0, 6):
    n = random.randrange(0, 2)
    list.append(n)
print(list)
graphic.append(list)

odd_row1 = []
for i in list:
    if i == 0:
        odd_row1.append("k")
    else:
        odd_row1.append("sl")
print(odd_row1)

Section 3:

In this section of code, the list created in Section 2 named odd_row1 is simplified so that consecutive duplicates are grouped together. The number of stitches is then multiplied by 3 to represent the total number of stitches in one row of the repeated rectangular block.

Note: one row contains 18 stitches in 6 sections of 3 stitches.

To accomplish this, the following steps are taken:

  1. A list titled count1 is created.
  2. The variable n is also created and set to equal 1.
  3. The value 'NULL' is then added to the end of odd_row1.
  4. A for loop that will iterate through the indices 0-5 of odd_row1 is created. This for loop will be used to count each consecutive duplicate of either a "k" or "sl" in the list odd_row1. The grouped number of duplicates are then added to the list count1. For example if odd_row1 equaled ['sl','k','sl','k','k','sl'], the resulting count1 would be [1,1,1,2,1].
  5. Within the for loop, an if/else statement is used to make a running count of consecutive duplicates.
  6. Next, the 'NULL' value added to odd_row1 is removed.
  7. A list titled count2 is created.
  8. A for loop that repeats for each ith item in count1 is created.
  9. Within the for loop, each ith item is multiplied by 3 and this new value is added to the list count2. Once this process has repeated for all the items in count1, the for loop is broken. This for loop has increased each of the 6 stitches of interest by a factor of 3 to create 18 stitches per row.
count1 = []
n = 1
odd_row1.append('NULL')
for i in range(0, 6):
    if odd_row1[i] == odd_row1[i + 1]:
        n += 1
    else:
        count1.append(n)
        n = 1
print(count1)
odd_row1.remove('NULL')

count2 = []
for i in count1:
    i = i * 3
    count2.append(i)
print(count2)

Section 4:

In this section of code, the list count2 created in Sections 3 is combined with the list odd_row1 created in Sections 2 to make a condensed 18 stitch row.

To accomplish this, the following steps are taken:

  1. A list titled condensed_odd_row1 is created.
  2. An if/else statement is used to determine what the first stitch in odd_row1 is ("k" or "sl").
  3. Depending on if the index 0 of odd_row1 is a "k" or "sl", a corresponding for loop is executed for every item in count2.
  4. Within the for loop, the value in each index of count2 is converted into a string with the stitch type ("k" or "sl") it corresponds to and added to the list condensed_odd_row1. For example, if condensed_odd_row1 begins with a knit ("k") stitch, the value in each even index of count2 will have "k" appended to it and the value in each odd index of count2 will have "sl" appended to it. Once this process has repeated for all the items in count2, the for loop is broken.
condensed_odd_row1 = []
if odd_row1[0] == 'k':
    print("k is first")
    for i in range(0, len(count2)):
        if i % 2 == 0:
            condensed_odd_row1.append(str(count2[i]) + "k")
        else:
            condensed_odd_row1.append(str(count2[i]) + "sl")
else:
    print("sl is first")
    for i in range(0, len(count2)):
        if i % 2 == 0:
            condensed_odd_row1.append(str(count2[i]) + "sl")
        else:
            condensed_odd_row1.append(str(count2[i]) + "k")

Section 5:

The 16 different rows of each rectangular block are also broken up into 8 different sections (16 rows/8 = 2 rows per section). Of these 8 different row sections, every other row section must contain all knit stitches. These 4, all-knit row sections are necessary because it will prevent stitches from being slipped more times than is physically possible when knitting. As a result, there are only 4 different row sections within each repeating rectangular block that are unique.

When knitting on straight needles, every odd row you knit will be the front of the project and every even row will be the back of the project. This means that the same type of stitch (knit, purl, etc.) on an odd row will look different on an even row. This will cause a problem for our pattern when we try to repeat a row 2 times. To correct this, we need to make a front row (odd) and back row (even). Therefore, one front row and one back row will make up each 2 row section of the repeated rectangular block.

In Section 4, an odd row was created where 18 stitches were all either knit or slipped purl wise with yarn in back. To make the corresponding even row, every knit stitch should be changed to a purl and every stitch slipped purl wise with yarn in back should be slipped purl wise with yarn in front. This will make the 2 rows of each row section in the repeating rectangular block look uniform.

Note: Changes in where the yarn is held (front/back) for slipped stitches will be noted only in the .txt file

To accomplish this, the following steps are taken:

  1. A copied list of condensed_odd_row1 is created titled con_odd_row1.
  2. The list con_odd_row1 is then added to the list final_odd created in Section 2.
  3. To begin creating the matching even row, the order of the values in condensed_odd_row1 is reversed to match how the stitches on the knitting needles will be configured on an even or "backwards" rows.
  4. A list titled con_even_row1 is created.
  5. A for loop that repeats for each ith item in condensed_odd_row1 is created.
  6. Within the for loop, an if/else statement is used. Using regular expressions to determine if the ith item in condensed_odd_row1 contains either a 'k' or 'sl', the ith item is replaced with a 'p' or remains 'sl'. This new value is then added to con_even_row1. Once this process has repeated for all the items in condensed_odd_row1, the for loop is broken.
  7. The list con_even_row1 is then added to the list final_even created in Section 1.
con_odd_row1 = condensed_odd_row1.copy()
print(con_odd_row1)
final_odd.append(con_odd_row1)
condensed_odd_row1.reverse()
con_even_row1 = []
for i in condensed_odd_row1:
    if re.search("k$", i):
        con_even_row1.append(i.replace('k', 'p'))
    else:
        con_even_row1.append(i.replace('sl', 'sl'))
print(con_even_row1)
final_even.append(con_even_row1)

Section 6:

To create the 4 variable row sections that make up the repeating rectangular block, a for loop is used to repeat all the code in Sections 2-5, 4 times.

Section 7:

In this section, a txt file named "knit_mosaic_pattern.txt" is created and populated with directions that correlate to the values in final_odd and final_even from Section 7.

Note: A new "knit_mosaic_pattern.txt" file will be created/overwritten each time the code is run.

filename = "knit_mosaic_pattern.txt"
with open(filename, 'w') as f:
    f.write('Knit Mosaic Scarf Pattern\n\n')
    f.write("This pattern was inspired by my friend Phia Wilson who designs and makes scarves for fun.\n\n")
    f.write("This pattern consists of a randomly generated 4 by 2.6 inch rectangular mosaic block that repeats 135 times.\n"
            "There are 16,777,216 different pattern combinations that can be generated from this code!!\n\n")
    f.write("Materials\n"
            "\t-255 yards worsted yarn (4) for the main color\n"
            "\t-255 yards worsted yarn (4) for the contrast color\n"
            "\t-US 8 (5mm) needles\n"
            "\t-Stitch markers\n"
            "\t-Tapestry needle\n\n")
    f.write("Abbreviations\n"
            "\t-CC: Contrast Color\n"
            "\t-CO: Cast on\n"
            "\t-k: Knit\n"
            "\t-MC: Main Color\n"
            "\t-p: purl\n"
            "\t-pm: Place Marker\n"
            "\t-pwise: Purlwise\n"
            "\t-wyib: With Yarn in Back\n"
            "\t-wyif: With Yarn in Front\n\n")
    f.write("Size\n"
            "\tCreates a 72 by 20 inch rectangular scarf once washed and blocked.\n\n")
    f.write("Gauge\n"
            "\t18 stitches by 24 rows = 4 inch square\n\n")
    f.write("Instructions\n"
            "\tCasting On\n"
            "\t\tUsing US 8 needles, CO 90 stitches in MC.\n"
            "\tRepeating Pattern\n"
            "\t\tRow 1 (MC): "+str(final_odd[0])+" pm and repeat to end of row.\n"
            "\t\t\t\t* For all odd rows, slip yarn pwise wyib * \n"
            "\t\tRow 2 (MC): "+str(final_even[0])+" Repeat.\n"
            "\t\t\t\t* For all even rows, slip yarn pwise wyif * \n"
            "\t\tRow 3 (MC): ['18k'] Repeat.\n"
	    "\t\tRow 4 (MC): ['18p'] Repeat.\n"
            "\t\tRow 5 (CC): "+str(final_odd[1])+" Repeat.\n"
            "\t\tRow 6 (CC): "+str(final_even[1])+" Repeat.\n"
            "\t\tRow 7 (CC): ['18k'] Repeat.\n"
	    "\t\tRow 8 (CC): ['18p'] Repeat.\n"
            "\t\tRow 9 (MC): "+str(final_odd[2])+" Repeat.\n"
            "\t\tRow 10 (MC): "+str(final_even[2])+" Repeat.\n"
            "\t\tRows 11-12: Repeat rows 3-4.\n"
            "\t\tRow 13 (CC): "+str(final_odd[3])+" Repeat.\n"
            "\t\tRow 14 (CC): "+str(final_even[3])+" Repeat.\n"
            "\t\tRows 15-16: Repeat rows 7-8. \n"
            "\t\tRows 17-432: Repeat rows 1-16, 27 times. \n"
            "\tBinding Off\n"
            "\t\tStep 1: Knit 2 stitches"
            "\t\tStep 2: Move those 2 stitches back to the other needle.\n"
            "\t\tStep 3: Knit the 2 stitches together\n"
            "\t\tStep 4: Knit 1 stitch\n"
            "\t\tStep 5: Repeat steps 2-4 until there is only one stitch left.\n"
            "\t\tStep 6: Cut your yarn leaving a ~5 inch tail and pull it through the last stitch.\n"
            "\t\t\t\tThis will create a knot and prevent your scarf from unraveling.\n"
            "\t\tStep 7: Using the tapestry needle work in all any ends.\n"
            "\t\tStep 8: Wash and block you scarf :)\n"
            "\tAdding Fringe (optional)\n"
            "\t\tStep 1: Cut 4, 8 inch strands of yarn\n"
            "\t\tStep 2: Holding the 4 strands together, use the crochet hook to pull the center of each\n"
            "\t\t\t\tstrand through a stitch along the bottom/top of the scarf. This will create a loop.\n"
            "\t\tStep 3: Pull the fridge ends through the loop, and tighten\n"
            "\t\tStep 4: Trim fringe ends to desired length\n"
            "\t\tStep 5: Repeat steps 1-4 to add additional fringe wherever desired\n\n")
    f.write("Coded by: Denise Rauschendorfer (2022)\n")
f.close()

Creating a Graphic Pattern

Section 8:

In this section, the stitch pattern produced for each odd row is modified and added to the list final_graphic so that a graphic representation of the repeating rectangular block can be created. To do this every unique stitch that shows up on the final knit scarf in the main color will be represented by a 0, and every unique stitch that shows up in the contrast color will be represented by a 1.

Additionally, the pattern switches between the main color and contrast color every 4 rows. This causes all stitches knit (represented in the list graphic by a 0) using the contrast color to appear the same as slipped stitches knit using the main color and vice versa. To visualize this all rows knit using the contrast color (odd indices of graphic) will need to be changed so that 0 (knit stitches) are changed to 1 and 1 (slipped stitches) are changed to 0.

Finally, the 4, all-knit rows will also be added to the list final_graphic.

To accomplish this, the following steps are taken:

  1. A main color and contrast color, all-knit list is created titled mc_knit and cc_knit respectively.
  2. A list titled fianl_graphic is also created.
  3. A for loop that will iterate through the indices 0-3 of graphic is created.
  4. Within the for loop, an if/else statement is used to affect all even (rows created using the main color) and odd (rows created using the contrast color) indices differently.
  5. For all of the even indices, the corresponding index in graphic and a main color, all-knit row (mc_knit) are added to the list fianl_graphic.
  6. For all the odd indices, all of the values of 1 within the corresponding index in graphic are switched to 0 and vice versa. This new list along with a contrast color, all-knit row (mc_knit) are added to the list fianl_graphic.
  7. Once this process has repeated for the indices 0-3 of graphic, the for loop is broken.
mc_knit = [0, 0, 0, 0, 0, 0]
cc_knit = [1, 1, 1, 1, 1, 1]
final_graphic = []
for i in range(0, 4):
    if i % 2 == 0:
        final_graphic.append(graphic[i])
        final_graphic.append(mc_knit)
    else:
        flip = []
        for j in graphic[i]:
            if j == 0:
                flip.append(1)
            else:
                flip.append(0)
        final_graphic.append(flip)
        final_graphic.append(cc_knit)

Section 9:

In this section, a graphic representation of the repeating rectangular block is created and saved as a jpg file titled "knit_mosaic_graphic_pattern.jpg".

To accomplish this, the following steps are taken:

  1. The list final_graphic that contains the 8 different odd row sections of the repeating rectangular block, is reversed. This step is necessary because the scarf is made from bottom to top. Note: Because correlating odd and even rows look the same from the front and back, only the odd rows are needed to visualize the front of the scarf.
  2. A two-toned, red and white color map named cmap is created, where red represents the main color and white represents the contrast color.
  3. Within the color map, cmap, subplots are created to be able to add gridlines.
  4. Black grid lines along the x and y axis are then added to easily visualize each unique stitch (6 unique stitches per row).
  5. The location of the x and y gridlines are then specified.
  6. The x and y axis labels are removed from the graphic.
  7. The title, Repeating Rectangular Block, is added to the graphic.
  8. Using the data from final_graphic, the color map is plotted as an image.
  9. The color map image is then saved as a jpg file titled "knit_mosaic_graphic_pattern.jpg".
final_graphic.reverse()

cmap = colors.ListedColormap(['red', 'white'])

fig, ax = plt.subplots()
ax.grid(color='black', linewidth=2)
ax.set_xticks(np.arange(-0.5, 6, 1))
ax.set_yticks(np.arange(-0.5, 8, 1))
ax.set_xticklabels([])
ax.set_yticklabels([])
plt.title("Repeating Rectangular Block", fontsize=20, color="black")

plt.imshow(final_graphic, cmap=cmap)
plt.savefig("knit_mosaic_graphic_pattern.jpg")

Appendix

Compiled Copy of Raw Code:

import random
import re
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import colors

final_even=[]
final_odd=[]
graphic=[]
for k in range(4):
    list = []
    for i in range(0, 6):
        n = random.randrange(0, 2)
        list.append(n)
    print(list)
    graphic.append(list)

    odd_row1 = []
    for i in list:
        if i == 0:
            odd_row1.append("k")
        else:
            odd_row1.append("sl")
    print(odd_row1)

    count1 = []
    n = 1
    odd_row1.append('NULL')
    for i in range(0, 6):
        if odd_row1[i] == odd_row1[i + 1]:
            n += 1
        else:
            count1.append(n)
            n = 1
    print(count1)
    odd_row1.remove('NULL')

    count2 = []
    for i in count1:
        i = i * 3
        count2.append(i)
    print(count2)

    condensed_odd_row1 = []
    if odd_row1[0] == 'k':
        print("k is first")
        for i in range(0, len(count2)):
            if i % 2 == 0:
                condensed_odd_row1.append(str(count2[i]) + "k")
            else:
                condensed_odd_row1.append(str(count2[i]) + "sl")
    else:
        print("sl is first")
        for i in range(0, len(count2)):
            if i % 2 == 0:
                condensed_odd_row1.append(str(count2[i]) + "sl")
            else:
                condensed_odd_row1.append(str(count2[i]) + "k")

    con_odd_row1 = condensed_odd_row1.copy()
    print(con_odd_row1)
    final_odd.append(con_odd_row1)
    condensed_odd_row1.reverse()
    con_even_row1 = []
    for i in condensed_odd_row1:
        if re.search("k$", i):
            con_even_row1.append(i.replace('k', 'p'))
        else:
            con_even_row1.append(i.replace('sl', 'sl'))
    print(con_even_row1)
    final_even.append(con_even_row1)

filename = "knit_mosaic_pattern.txt"
with open(filename, 'w') as f:
    f.write('Knit Mosaic Scarf Pattern\n\n')
    f.write("This pattern was inspired by my friend Phia Wilson who designs and makes scarves for fun.\n\n")
    f.write("This pattern consists of a randomly generated 4 by 2.6 inch rectangular mosaic block that repeats 135 times.\n"
            "There are 16,777,216 different pattern combinations that can be generated from this code!!.\n\n")
    f.write("Materials\n"
            "\t-255 yards worsted yarn (4) for the main color\n"
            "\t-255 yards worsted yarn (4) for the contrast color\n"
            "\t-US 8 (5mm) needles\n"
            "\t-Stitch markers\n"
            "\t-Tapestry needle\n\n")
    f.write("Abbreviations\n"
            "\t-CC: Contrast Color\n"
            "\t-CO: Cast on\n"
            "\t-k: Knit\n"
            "\t-MC: Main Color\n"
            "\t-p: purl\n"
            "\t-pm: Place Marker\n"
            "\t-pwise: Purlwise\n"
            "\t-wyib: With Yarn in Back\n"
            "\t-wyif: With Yarn in Front\n\n")
    f.write("Size\n"
            "\tCreates a 72 by 20 inch rectangular scarf once washed and blocked.\n\n")
    f.write("Gauge\n"
            "\t18 stitches by 24 rows = 4 inch square\n\n")
    f.write("Instructions\n"
            "\tCasting On\n"
            "\t\tUsing US 8 needles, CO 90 stitches in MC.\n"
            "\tRepeating Pattern\n"
            "\t\tRow 1 (MC): "+str(final_odd[0])+" pm and repeat to end of row.\n"
            "\t\t\t\t* For all odd rows, slip yarn pwise wyib * \n"
            "\t\tRow 2 (MC): "+str(final_even[0])+" Repeat.\n"
            "\t\t\t\t* For all even rows, slip yarn pwise wyif * \n"
            "\t\tRow 3 (MC): ['18k'] Repeat.\n"
	        "\t\tRow 4 (MC): ['18p'] Repeat.\n"
            "\t\tRow 5 (CC): "+str(final_odd[1])+" Repeat.\n"
            "\t\tRow 6 (CC): "+str(final_even[1])+" Repeat.\n"
            "\t\tRow 7 (CC): ['18k'] Repeat.\n"
	        "\t\tRow 8 (CC): ['18p'] Repeat.\n"
            "\t\tRow 9 (MC): "+str(final_odd[2])+" Repeat.\n"
            "\t\tRow 10 (MC): "+str(final_even[2])+" Repeat.\n"
            "\t\tRows 11-12: Repeat rows 3-4.\n"
            "\t\tRow 13 (CC): "+str(final_odd[3])+" Repeat.\n"
            "\t\tRow 14 (CC): "+str(final_even[3])+" Repeat.\n"
            "\t\tRows 15-16: Repeat rows 7-8. \n"
            "\t\tRows 17-432: Repeat rows 1-16, 27 times. \n"
            "\tBinding Off\n"
            "\t\tStep 1: Knit 2 stitches"
            "\t\tStep 2: Move those 2 stitches back to the other needle.\n"
            "\t\tStep 3: Knit the 2 stitches together\n"
            "\t\tStep 4: Knit 1 stitch\n"
            "\t\tStep 5: Repeat steps 2-4 until there is only one stitch left.\n"
            "\t\tStep 6: Cut your yarn leaving a ~5 inch tail and pull it through the last stitch.\n"
            "\t\t\t\tThis will create a knot and prevent your scarf from unraveling.\n"
            "\t\tStep 7: Using the tapestry needle work in all any ends.\n"
            "\t\tStep 8: Wash and block you scarf :)\n"
            "\tAdding Fringe (optional)\n"
            "\t\tStep 1: Cut 4, 8 inch strands of yarn\n"
            "\t\tStep 2: Holding the 4 strands together, use the crochet hook to pull the center of each\n"
            "\t\t\t\tstrand through a stitch along the bottom/top of the scarf. This will create a loop.\n"
            "\t\tStep 3: Pull the fridge ends through the loop, and tighten\n"
            "\t\tStep 4: Trim fringe ends to desired length\n"
            "\t\tStep 5: Repeat steps 1-4 to add additional fringe wherever desired\n\n")
    f.write("Coded by: Denise Rauschendorfer (2022)\n")
f.close()

mc_knit = [1, 1, 1, 1, 1, 1]
cc_knit = [0, 0, 0, 0, 0, 0]
final_graphic = []
for i in range(0, 4):
    if i % 2 == 0:
        final_graphic.append(graphic[i])
        final_graphic.append(mc_knit)
    else:
        flip = []
        for j in graphic[i]:
            if j == 0:
                flip.append(1)
            else:
                flip.append(0)
        final_graphic.append(flip)
        final_graphic.append(cc_knit)

final_graphic.reverse()

cmap = colors.ListedColormap(['red', 'white'])

fig, ax = plt.subplots()

ax.grid(color='black', linewidth=2)
ax.set_xticks(np.arange(-0.5, 6, 1))
ax.set_yticks(np.arange(-0.5, 8, 1))
ax.set_xticklabels([])
ax.set_yticklabels([])
plt.title("Repeating Rectangular Block", fontsize=20, color="black")

plt.imshow(final_graphic, cmap=cmap)
plt.savefig("knit_mosaic_graphic_pattern.jpg")

Example of the 'knit_mosaic_pattern.txt':

Knit Mosaic Scarf Pattern

This pattern was inspired by my friend Phia Wilson who designs and makes scarves for fun.

This pattern consists of a randomly generated 4 by 2.6 inch rectangular mosaic block that repeats 135 times.
There are 16,777,216 different pattern combinations that can be generated from this code!!.

Materials
	-255 yards worsted yarn (4) for the main color
	-255 yards worsted yarn (4) for the contrast color
	-US 8 (5mm) needles
	-Stitch markers
	-Tapestry needle

Abbreviations
	-CC: Contrast Color
	-CO: Cast on
	-k: Knit
	-MC: Main Color
	-p: purl
	-pm: Place Marker
	-pwise: Purlwise
	-wyib: With Yarn in Back
	-wyif: With Yarn in Front

Size
	Creates a 72 by 20 inch rectangular scarf once washed and blocked.

Gauge
	18 stitches by 24 rows = 4 inch square

Instructions
	Casting On
		Using US 8 needles, CO 90 stitches in MC.
	Repeating Pattern
		Row 1 (MC): ['3sl', '3k', '3sl', '6k', '3sl'] pm and repeat to end of row.
				* For all odd rows, slip yarn pwise wyib * 
		Row 2 (MC): ['3sl', '6p', '3sl', '3p', '3sl'] Repeat.
				* For all even rows, slip yarn pwise wyif * 
		Row 3 (MC): ['18k'] Repeat.
		Row 4 (MC): ['18p'] Repeat.
		Row 5 (CC): ['12sl', '3k', '3sl'] Repeat.
		Row 6 (CC): ['3sl', '3p', '12sl'] Repeat.
		Row 7 (CC): ['18k'] Repeat.
		Row 8 (CC): ['18p'] Repeat.
		Row 9 (MC): ['3k', '9sl', '6k'] Repeat.
		Row 10 (MC): ['6p', '9sl', '3p'] Repeat.
		Rows 11-12: Repeat rows 3-4.
		Row 13 (CC): ['6sl', '3k', '3sl', '3k', '3sl'] Repeat.
		Row 14 (CC): ['3sl', '3p', '3sl', '3p', '6sl'] Repeat.
		Rows 15-16: Repeat rows 7-8. 
		Rows 17-432: Repeat rows 1-16, 27 times. 
	Binding Off
		Step 1: Knit 2 stitches		Step 2: Move those 2 stitches back to the other needle.
		Step 3: Knit the 2 stitches together
		Step 4: Knit 1 stitch
		Step 5: Repeat steps 2-4 until there is only one stitch left.
		Step 6: Cut your yarn leaving a ~5 inch tail and pull it through the last stitch.
				This will create a knot and prevent your scarf from unraveling.
		Step 7: Using the tapestry needle work in all any ends.
		Step 8: Wash and block you scarf :)
	Adding Fringe (optional)
		Step 1: Cut 4, 8 inch strands of yarn
		Step 2: Holding the 4 strands together, use the crochet hook to pull the center of each
				strand through a stitch along the bottom/top of the scarf. This will create a loop.
		Step 3: Pull the fridge ends through the loop, and tighten
		Step 4: Trim fringe ends to desired length
		Step 5: Repeat steps 1-4 to add additional fringe wherever desired

Coded by: Denise Rauschendorfer (2022)

Example of 'knit_mosaic_graphic_pattern.jpg':

knit_mosaic_graphic_pattern

About

This repository contains a code that can be run using python to randomly generate a two-color, knitted mosaic scarf pattern.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published