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

-Fixed the name of relative int images to see negative nums // -Fixed the...

-Fixed the name of relative int images to see negative nums // -Fixed the possibility of crashing because of relative int operations
parent d0efebc8
No related branches found
No related tags found
No related merge requests found
......@@ -160,7 +160,7 @@ def run_show_numbers(path):
terme = int(input('Enter a number: '))
t = app_functions.dec_to_lambda_relative_integers(terme)
print('Voici le terme:',logic.to_string(t))
logic.captureImage(t,path,'ENTIER-RELATIF-'+str(terme),False)
logic.captureImage(t,path,'ENTIER-RELATIF#'+'('+str(terme)+')',False)
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['y','n','']:
save_image_choice = input('Invalid choice. Do you want to save the images of the reduction? (Y/n): ')
......@@ -328,14 +328,19 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
clear()
print("Voici le terme: "+ logic.to_string(app_functions.ADD))
logic.captureImage(app_functions.ADD,path,'ADD', False)
choix=(input("do you want to try an exemple? (Y/n) : "))
choix=(input("Do you want to try an example? (Y/n) : "))
while choix not in ['y','n','']:
choix = input('Invalid choice. Do you want to try an exemple? (Y/n): ')
choix = input('Invalid choice. Do you want to try an example? (Y/n): ')
if choix=='y' or choix=='':
clear()
print("you are going to try n+m")
n=int(input("give n : "))
m=int(input("give m : "))
while n < 0 or m < 0:
clear()
print('Relative addition is not possible. Try again.')
n=int(input("give n : "))
m=int(input("give m : "))
app_functions.add(app_functions.dec_to_church(n),app_functions.dec_to_church(m))
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['y','n','']:
......@@ -352,14 +357,19 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
clear()
print("Voici le terme: "+ logic.to_string(app_functions.SUB))
logic.captureImage(app_functions.SUB,path,'SUB', False)
choix=(input("do you want to try an exemple? (Y/n) : "))
choix=(input("Do you want to try an example? (Y/n) : "))
while choix not in ['y','n','']:
choix = input('Invalid choice. Do you want to try an exemple? (Y/n): ')
choix = input('Invalid choice. Do you want to try an example? (Y/n): ')
if choix=='y' or choix=='':
clear()
print("you are going to try n-m")
n=int(input("give n : "))
m=int(input("give m : "))
while m > n:
clear()
print('Relative substraction is not possible. Try again.')
n=int(input("give n : "))
m=int(input("give m : "))
app_functions.sub(app_functions.dec_to_church(n),app_functions.dec_to_church(m))
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['Y','n','']:
......@@ -376,15 +386,20 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
clear()
print("Voici le terme: "+ logic.to_string(app_functions.MUL))
logic.captureImage(app_functions.MUL,path,'MUL',False)
choix=(input("do you want to try an exemple? (Y/n) : "))
choix=(input("Do you want to try an example? (Y/n) : "))
while choix not in ['y','n','']:
choix = input('Invalid choice. Do you want to try an exemple? (Y/n): ')
choix = input('Invalid choice. Do you want to try an example? (Y/n): ')
if choix=='y' or choix=='':
clear()
print("you are going to try n*m")
n=int(input("give n : "))
m=int(input("give m : "))
app_functions.mul(app_functions.dec_to_church(n),app_functions.dec_to_church(m))
while m < 0 or n < 0:
clear()
print('Relative multiplication is not possible. Try again.')
n=int(input("give n : "))
m=int(input("give m : "))
app_functions.multiplication(app_functions.dec_to_church(n),app_functions.dec_to_church(m))
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['y','n','']:
save_image_choice = input('Invalid choice. Do you want to save the images? (Y/n): ')
......@@ -400,14 +415,19 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
clear()
print("Voici le terme: "+ logic.to_string(app_functions.POW))
logic.captureImage(app_functions.POW,path,'POWER',False)
choix=(input("do you want to try an exemple? (Y/n) : "))
choix=(input("Do you want to try an example? (Y/n) : "))
while choix not in ['y','n','']:
choix = input('Invalid choice. Do you want to try an exemple? (Y/n): ')
choix = input('Invalid choice. Do you want to try an example? (Y/n): ')
if choix=='y' or choix=='':
clear()
print("you are going to try n puiss m")
n=int(input("give n : "))
m=int(input("give m : "))
while m < 0 or n < 0:
clear()
print('Relative power is not possible. Try again.')
n=int(input("give n : "))
m=int(input("give m : "))
app_functions.power(app_functions.dec_to_church(n),app_functions.dec_to_church(m))
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['y','n','']:
......@@ -424,13 +444,17 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
clear()
print("Voici le terme: "+ logic.to_string(app_functions.SUCCS))
logic.captureImage(app_functions.SUCCS,path,'SUCCS',False)
choix=(input("do you want to try an exemple? (Y/n) : "))
choix=(input("Do you want to try an example? (Y/n) : "))
while choix not in ['y','n','']:
choix = input('Invalid choice. Do you want to try an exemple? (Y/n): ')
choix = input('Invalid choice. Do you want to try an example? (Y/n): ')
if choix=='y'or choix=='':
clear()
print("you are going to try n+1")
n=int(input("give n : "))
while n<0:
clear()
print('Relative integers not possible. Try again.')
n=int(input("give n : "))
app_functions.succ(app_functions.dec_to_church(n))
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['y','n','']:
......@@ -447,13 +471,17 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
clear()
print("Voici le terme: "+ logic.to_string(app_functions.PRED))
logic.captureImage(app_functions.PRED,path,'PRED',False)
choix=(input("do you want to try an exemple? (Y/n) : "))
choix=(input("Do you want to try an example? (Y/n) : "))
while choix not in ['y','n','']:
choix = input('Invalid choice. Do you want to try an exemple? (Y/n): ')
choix = input('Invalid choice. Do you want to try an example? (Y/n): ')
if choix=='y' or choix=='':
clear()
print("you are going to try n-1")
n=int(input("give n : "))
while n<0:
clear()
print('Relative integers not possible. Try again.')
n=int(input("give n : "))
app_functions.predec(app_functions.dec_to_church(n))
save_image_choice = input('Do you want to save the images? (Y/n): ')
while save_image_choice not in ['y','n','']:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment