You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 KiB

In [1]:
import random
In [2]:
sentence = 'there are more than six thousand nine hundred more languages across the world'.upper() #makes the sentence caps-locked
words = sentence.split(' ') #split the sentence (taken from "Practical Vision") in a list of words
In [3]:
width = 82 #canvas measures
height = 74
In [4]:
spaces = ''
lista = []
br = ['  ','. ']

for x in range(999): 
    rwords = random.choices(words, weights=(8,4,5,4,8,15,9,20,4,8,6,3,10)) #pick randomly words from the list 'word' with different random ratio
    spaces += rwords[0] #fill the canvas
    rbr = random.choices(br, weights=(70,10)) #pick a dot or a blank space
    spaces += rbr[0] #fill the canvas

        
tmp_line = '' #here quilting time

counter = 0

for character in spaces:
    if counter == height: #it stops when rows = 74
        break
    elif len(tmp_line) < width:
        tmp_line += character #it stops when charachters per line = 82
    else:
        tmp_line += character
        lista.append(tmp_line)
        tmp_line = ''
        counter += 1
    
In [5]:
patch = "\n".join(lista) #creates effectivly the quilt computing the charachters
In [6]:
print(patch)
THAN  NINE  THE. WORLD  MORE  HUNDRED  HUNDRED  HUNDRED  NINE  WORLD  HUNDRED  SIX 
 MORE  WORLD  THOUSAND  NINE  ARE  ARE  HUNDRED  HUNDRED  NINE  THOUSAND. THE  THOU
SAND  THOUSAND  THERE  SIX  LANGUAGES  THOUSAND  NINE  THE  WORLD  WORLD  HUNDRED  
SIX. LANGUAGES  LANGUAGES  THOUSAND  SIX  HUNDRED  THOUSAND  NINE  THOUSAND  HUNDRE
D  HUNDRED  HUNDRED  THERE. MORE  THAN. THAN  HUNDRED  NINE  SIX  THOUSAND  HUNDRED
  NINE  SIX  HUNDRED. WORLD  HUNDRED  ARE  NINE  SIX. THAN  NINE  SIX  NINE. NINE  
MORE  HUNDRED. LANGUAGES  WORLD  HUNDRED  THOUSAND  HUNDRED  NINE  SIX  NINE  MORE 
 THOUSAND  HUNDRED. THOUSAND. NINE  NINE  NINE. ACROSS  THERE  SIX  HUNDRED  MORE  
HUNDRED  WORLD. NINE  THAN  NINE  ACROSS  THOUSAND  NINE  MORE  HUNDRED  SIX  WORLD
  ACROSS  THAN  LANGUAGES  THOUSAND  THOUSAND  MORE  MORE  ARE  THERE  WORLD. LANGU
AGES. NINE  NINE  NINE  HUNDRED  HUNDRED  THOUSAND  WORLD  MORE  ACROSS  THERE  THO
USAND  THOUSAND  THOUSAND  HUNDRED  LANGUAGES  THERE  LANGUAGES  THOUSAND  THE  SIX
  THOUSAND  MORE  NINE  NINE  HUNDRED  NINE  HUNDRED  WORLD  MORE  NINE  THOUSAND  
HUNDRED  ACROSS  NINE  THOUSAND  THAN  THAN  THOUSAND  HUNDRED  THAN  THERE  HUNDRE
D  HUNDRED  LANGUAGES  THERE  MORE  NINE  MORE  LANGUAGES  SIX  NINE  MORE  NINE  M
ORE  HUNDRED  HUNDRED  WORLD  HUNDRED  ACROSS  THE. ARE  HUNDRED  NINE  MORE  HUNDR
ED  HUNDRED  LANGUAGES  WORLD  NINE  NINE  MORE  WORLD  THOUSAND. WORLD  THOUSAND  
THERE  ARE  THOUSAND  MORE  SIX  THOUSAND. NINE  HUNDRED. WORLD  HUNDRED  THERE. WO
RLD. HUNDRED  LANGUAGES  SIX  ACROSS  NINE. THERE  THE  THOUSAND  LANGUAGES  WORLD 
 HUNDRED. ARE  LANGUAGES  WORLD. THOUSAND. HUNDRED  HUNDRED  THERE  THERE. THOUSAND
  THAN  MORE  NINE. ACROSS  MORE  WORLD  THOUSAND  ARE  THOUSAND  HUNDRED  THOUSAND
  SIX  HUNDRED  THERE  ARE  HUNDRED  ARE  ARE. HUNDRED  NINE  THERE  WORLD. HUNDRED
. HUNDRED  THOUSAND  ACROSS  MORE  ACROSS  HUNDRED  NINE  SIX  NINE  THE  LANGUAGES
  HUNDRED  ACROSS. SIX  SIX  NINE  WORLD  SIX  MORE  THOUSAND  THE  THOUSAND  LANGU
AGES  THOUSAND  WORLD  NINE  HUNDRED  WORLD  SIX  HUNDRED  MORE  THOUSAND  HUNDRED 
 THAN. HUNDRED  LANGUAGES  ACROSS  LANGUAGES  MORE  NINE  HUNDRED  MORE  THOUSAND. 
THAN. ARE. THOUSAND  THOUSAND  HUNDRED  THOUSAND  MORE  THOUSAND. HUNDRED  NINE  WO
RLD  THERE  THOUSAND  ACROSS  SIX  WORLD  THOUSAND  THOUSAND  HUNDRED  ARE  THAN. N
INE  THERE  HUNDRED. SIX  THOUSAND  SIX. MORE  THOUSAND. ACROSS. HUNDRED  HUNDRED  
LANGUAGES. THOUSAND  THAN  SIX. HUNDRED  WORLD  HUNDRED  THOUSAND  SIX  HUNDRED  TH
AN  ARE  THERE  LANGUAGES  WORLD  THOUSAND  WORLD  THERE  WORLD  HUNDRED. THAN  THE
RE. MORE  NINE  THERE  WORLD  SIX  THOUSAND  WORLD  HUNDRED. SIX  NINE  HUNDRED  HU
NDRED  HUNDRED  THOUSAND  ARE  HUNDRED  ARE. ACROSS. LANGUAGES  MORE  THERE  HUNDRE
D  THOUSAND  NINE  THERE. HUNDRED  SIX. WORLD  WORLD  SIX  THERE  THOUSAND  NINE  M
ORE  THOUSAND  THAN. WORLD. HUNDRED  ACROSS  THOUSAND  ACROSS  THERE. WORLD  THAN  
MORE  SIX. THAN  WORLD  SIX  NINE  MORE  THOUSAND  THOUSAND  MORE  THE  THOUSAND  T
HOUSAND  THOUSAND  NINE  MORE  LANGUAGES  SIX. THOUSAND  MORE  THOUSAND  THE  NINE 
 THERE  HUNDRED  THERE  WORLD  SIX  ARE  ACROSS  MORE  THOUSAND  SIX  THOUSAND  THO
USAND  HUNDRED  THOUSAND  NINE  MORE  SIX  HUNDRED. MORE. LANGUAGES  LANGUAGES  THE
  THOUSAND. THAN  HUNDRED  THOUSAND  THOUSAND  THOUSAND  THOUSAND  HUNDRED  SIX  AR
E  THERE. MORE  HUNDRED  HUNDRED  THOUSAND  MORE  THE  THERE  ACROSS  THERE  LANGUA
GES  SIX  SIX  WORLD  WORLD  LANGUAGES  WORLD  THERE  THOUSAND  ARE. THOUSAND. HUND
RED  THOUSAND  LANGUAGES  LANGUAGES  HUNDRED  THOUSAND  THOUSAND  NINE  SIX  THAN. 
THOUSAND  THE  THAN  HUNDRED  SIX  ACROSS  HUNDRED  MORE. NINE. THAN  LANGUAGES  MO
RE  HUNDRED  NINE  HUNDRED  THERE  MORE  NINE. WORLD  HUNDRED  HUNDRED  ACROSS  HUN
DRED  NINE  WORLD  SIX  LANGUAGES. THERE  HUNDRED  THOUSAND  THERE  THE  SIX. LANGU
AGES  WORLD  THOUSAND  MORE  HUNDRED  THOUSAND  HUNDRED  HUNDRED  MORE  SIX  THOUSA
ND. WORLD  ACROSS  LANGUAGES  THOUSAND  WORLD  ACROSS. MORE  ACROSS  NINE. MORE  MO
RE  THOUSAND  NINE  WORLD  LANGUAGES  SIX  HUNDRED  NINE  NINE  HUNDRED  LANGUAGES 
 MORE  THOUSAND  THERE. SIX  THAN  WORLD  MORE. THE  THERE  MORE  THERE  THERE  THO
USAND. MORE. WORLD  NINE  NINE  THOUSAND  THOUSAND. SIX  LANGUAGES  HUNDRED  ARE  W
ORLD  ACROSS  SIX  THOUSAND  THERE  HUNDRED  NINE  THERE  SIX. THOUSAND  THOUSAND  
THOUSAND  NINE  THOUSAND  MORE  LANGUAGES. LANGUAGES  THOUSAND  THOUSAND. WORLD  NI
NE  ACROSS  HUNDRED  NINE  LANGUAGES. ACROSS  HUNDRED. THOUSAND  HUNDRED  SIX  HUND
RED  NINE  MORE  LANGUAGES  ACROSS  WORLD  HUNDRED  NINE  ACROSS  ACROSS  HUNDRED  
NINE  MORE  HUNDRED  NINE  HUNDRED  HUNDRED  LANGUAGES. SIX  LANGUAGES  WORLD  SIX 
 HUNDRED  ACROSS  THOUSAND  SIX  LANGUAGES  HUNDRED. THE  THOUSAND  THERE  THERE  L
ANGUAGES  ACROSS  THOUSAND  THE  SIX  WORLD  ACROSS  HUNDRED  THERE. THOUSAND  THOU
SAND  THOUSAND  WORLD  ARE. MORE  HUNDRED  HUNDRED  SIX  SIX  HUNDRED  WORLD  WORLD
  MORE. LANGUAGES  LANGUAGES  THOUSAND  THERE. THOUSAND  THOUSAND  THE  THERE  HUND
RED  SIX  THE  WORLD. THE  THE  LANGUAGES  HUNDRED  HUNDRED  WORLD  ARE  SIX  HUNDR
ED  SIX  SIX  LANGUAGES  HUNDRED  MORE  WORLD  HUNDRED  HUNDRED  HUNDRED  WORLD  HU
NDRED  NINE  THOUSAND  SIX  ARE  WORLD  THERE  ACROSS  THOUSAND. THERE  SIX  HUNDRE
D  THAN  LANGUAGES. ACROSS  THOUSAND  SIX  THE  WORLD  LANGUAGES  MORE  THOUSAND  H
UNDRED  HUNDRED  THERE  WORLD  THOUSAND  THOUSAND  ACROSS  ARE  WORLD. THOUSAND  TH
E  MORE  THOUSAND  THERE. THOUSAND  THOUSAND  WORLD  LANGUAGES  LANGUAGES. SIX  LAN
GUAGES  THAN. NINE  NINE. NINE  HUNDRED  THAN  MORE  SIX  MORE  HUNDRED  THOUSAND  
HUNDRED  THOUSAND  THAN  THERE  THOUSAND  HUNDRED  ACROSS  LANGUAGES  NINE  THAN  M
ORE  LANGUAGES  MORE  THOUSAND. LANGUAGES  LANGUAGES  THOUSAND  HUNDRED  HUNDRED  M
ORE  NINE. THOUSAND  SIX  HUNDRED  THOUSAND  THOUSAND  THAN  HUNDRED  LANGUAGES  MO
RE  THAN  THOUSAND  THOUSAND  THAN  WORLD  HUNDRED. SIX  MORE  SIX  MORE  ACROSS  L
ANGUAGES  THOUSAND  SIX  WORLD  THAN  NINE  HUNDRED  HUNDRED  LANGUAGES  LANGUAGES 
 WORLD  THAN  HUNDRED  HUNDRED  LANGUAGES  ACROSS  HUNDRED  LANGUAGES  NINE  ARE  T
HOUSAND  THOUSAND  THOUSAND. HUNDRED  HUNDRED  THOUSAND  ACROSS  THERE  THERE  NINE
In [21]:
f = 'patcherico.txt' #export the patch for the quilt in .txt
export = open(f, 'w')
export.write(patch)
Out[21]:
7825
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: