Skip to content

Instantly share code, notes, and snippets.

@rattrayalex
Created January 14, 2023 07:43
Show Gist options
  • Save rattrayalex/c61fd8cba15e2f01506988ecba938519 to your computer and use it in GitHub Desktop.
Save rattrayalex/c61fd8cba15e2f01506988ecba938519 to your computer and use it in GitHub Desktop.
def row(&blk)
yield
puts
end
def front_stitch
print "1"
end
def back_stitch
print "2"
end
def right_funky_stitch
print "7"
end
def left_funky_stitch
print "6"
end
def pink_stitch
print "5"
end
def blue_stitch
print "4"
end
def skip(n)
print " "
end
5.times do
row do
40.times { front_stitch }
end
end
10.times do
row do
10.times { front_stitch }
5.times { back_stitch }
10.times { front_stitch }
5.times { back_stitch }
10.times { front_stitch }
end
end
row do
15.times { front_stitch }
1.times { right_funky_stitch }
2.times { left_funky_stitch }
4.times { back_stitch }
2.times { left_funky_stitch }
1.times { right_funky_stitch }
15.times { front_stitch }
end
row do
skip(10)
pink_stitch
pink_stitch
blue_stitch
skip(10)
end
def row(&blk)
yield
puts
end
def front_stitch
print "1"
end
def back_stitch
print "2"
end
def right_funky_stitch
print "7"
end
def left_funky_stitch
print "6"
end
def pink_stitch
print "5"
end
def blue_stitch
print "4"
end
def skip(n)
n.times { print " " }
end
def plain_row
row do
40.times { front_stitch }
end
end
def rib_row
row do
4.times do
5.times { front_stitch }
5.times { back_stitch }
end
end
end
def cable
row do
15.times { front_stitch }
1.times { right_funky_stitch }
2.times { left_funky_stitch }
4.times { back_stitch }
2.times { left_funky_stitch }
1.times { right_funky_stitch }
15.times { front_stitch }
end
row do
skip(18)
pink_stitch
pink_stitch
blue_stitch
skip(10)
end
end
5.times do
plain_row
end
10.times do
rib_row
end
cable
10.times do
rib_row
end
cable
10.times do
rib_row
end
5.times do
plain_row
end
def row(&blk)
yield
puts
end
def front_stitch
print "1"
end
def back_stitch
print "2"
end
def right_funky_stitch
print "7"
end
def left_funky_stitch
print "6"
end
def pink_stitch
print "5"
end
def blue_stitch
print "4"
end
def skip(n)
n.times { print " " }
end
def plain_row
row do
40.times { front_stitch }
end
end
def rib_row(width)
row do
(40 / (width * 2)).times do
width.times { front_stitch }
width.times { back_stitch }
end
end
end
def rib(height)
height.times do
rib_row(4)
end
end
def cable
row do
15.times { front_stitch }
1.times { right_funky_stitch }
2.times { left_funky_stitch }
4.times { back_stitch }
2.times { left_funky_stitch }
1.times { right_funky_stitch }
15.times { front_stitch }
end
row do
skip(18)
pink_stitch
pink_stitch
blue_stitch
skip(10)
end
end
5.times do
plain_row
end
rib(4)
cable
rib(4)
cable
rib(4)
5.times do
plain_row
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment