Skip to content
Snippets Groups Projects
Commit b48ee57f authored by Antonio MATTAR's avatar Antonio MATTAR
Browse files

-Added the old_alligator feature.

parent c149129f
No related branches found
No related tags found
No related merge requests found
......@@ -73,11 +73,29 @@ def get_concat_h_multi_resize(im_list, resample=Image.BICUBIC):
pos_x += im.width + space_width
return dst
def createOldAlligator():
old_alligator_img = Image.open("figures/old_alligator.png")
return old_alligator_img
def createOldAlligatorFamily(terme):
old_alli_img = createOldAlligator()
family_img = createImage(terme)
old_alli_img = old_alli_img.resize((max(family_img.image.width, old_alli_img.width), max((int(old_alli_img.height * family_img.image.width / old_alli_img.width),old_alli_img.height))) )
old_alligator_fam = Image.new('RGB', (max(old_alli_img.width, family_img.image.width), old_alli_img.height + family_img.image.height), (255, 255, 255))
old_alligator_fam.paste(old_alli_img, ((max(old_alli_img.width, family_img.image.width)-old_alli_img.width) // 2, 0))
old_alligator_fam.paste(family_img.image, ( 0 , old_alli_img.height))
return old_alligator_fam
def createAppImage(terme):
assert (logic.isApplication(terme))
left = logic.getFirstTerm(terme)
right = logic.getSecondTerm(terme)
im1 = createImage(left)
if logic.isApplication(right):
im2 = createOldAlligatorFamily(right)
application = get_concat_h_multi_resize([im1.image,im2])
else:
im2 = createImage(right)
application = get_concat_h_multi_resize([im1.image,im2.image])
return application
......
......@@ -7,9 +7,9 @@ def run():
# image_maker.saveImage(x, "terme")
# x.show()
logic.beta_reduction_totale(parsing.parseTerm(input("Enter a term: ")))
# x = logic.new_var(logic.freshVar())
# y = logic.new_var(logic.freshVar())
# print(logic.to_string(logic.new_app(x,logic.new_app(x,x))))
# x = logic.new_var('x')
# y = logic.new_var('y')
# print(logic.to_string(logic.new_app(y,logic.new_app(x,logic.new_app(x,x)))))
run()
\ No newline at end of file
......@@ -154,10 +154,28 @@ def buildAbs(terme):
else:
return buildTerm(getTermFromParantheses(terme,0))
def extract_terms(text):
terms = []
current_term = ""
in_parens = False
for char in text:
if char == "(":
in_parens = True
elif char == ")":
in_parens = False
elif char == " " and not in_parens:
terms.append(current_term)
current_term = ""
else:
current_term += char
if current_term:
terms.append(current_term)
return terms
def buildApp(terme):
assert (checkType(terme) == APP)
if terme[0]!='(':
liste_de_termes = terme.split(' ')
liste_de_termes = extract_terms(terme)
# print(terme)
# print(liste_de_termes)
n = len(liste_de_termes)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment