├── assignment_7 ├── 1.mp3 ├── 1.mp4 ├── words.txt ├── mp4_to_mp3.py └── translator.py ├── assignment_6 ├── databace.txt └── store.py ├── assignment_11 ├── apple.jpg ├── pear.jpg ├── poop.jpg ├── README.md ├── checkered board.py └── Super_Snake.py ├── assignment_12 ├── ghalb2.png ├── khodi2.png ├── bullet2.png ├── doshman2.png ├── Bckgroundimage.jpg ├── README.md └── silver_spasecraft.py ├── assignment_8 ├── img │ ├── 0.PNG │ ├── 1.PNG │ ├── 3.PNG │ ├── 4.PNG │ ├── 5.PNG │ ├── 6.PNG │ ├── 7.PNG │ └── 8.PNG ├── panda9.gif ├── Gift.py ├── diamond.py ├── rock_paper_scissor.py ├── complex_number.py ├── deduction.py └── time.py ├── assignment_14 ├── imgg │ ├── c1.png │ ├── c2.png │ ├── c3.png │ ├── c4.png │ ├── bee_w1.png │ ├── bee_w2.png │ ├── bee_w3.png │ ├── bee_w4.png │ ├── cloud 1.png │ ├── cloud 2.png │ ├── cloud 3.png │ ├── cloud 4.png │ ├── cloud 5.png │ ├── cloud 6.png │ ├── cloud 7.png │ ├── cloud 8.png │ ├── human_w1.png │ ├── human_w2.png │ ├── human_w3.png │ ├── human_w4.png │ ├── human_w5.png │ ├── human_w6.png │ ├── human_down.png │ ├── human_jump1.png │ ├── human_jump2.png │ ├── human_jump3.png │ └── background_image.png ├── README.md ├── player.py ├── enemy.py ├── ground.py └── main.py ├── assignment_16 ├── README.md ├── calculator.py └── form.ui ├── assignment_17 ├── README.md ├── main.py └── TicTacToe.ui ├── assignment_2 ├── Dice.py ├── fibonachi.py ├── time_to_second.py ├── seconde_to_time.py ├── user_numbers.py └── average.py ├── assignment_4 ├── Sentence function.py ├── Multiplication table.py ├── Checkered page.py ├── Factoril.py ├── K.M.M.py ├── Equation of degree 2.py └── B.M.M.py ├── assignment_3 ├── random number.py ├── snake.py ├── sort list.py └── hangman.py ├── assignment_1 ├── bmi.py ├── triangle.py ├── average.py └── calculator.py ├── assignment_5 ├── khayam_pas.py ├── turtle.py └── tic_tac_toe.py └── assignment_9 ├── deduction.py └── time.py /assignment_7/1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_7/1.mp3 -------------------------------------------------------------------------------- /assignment_7/1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_7/1.mp4 -------------------------------------------------------------------------------- /assignment_6/databace.txt: -------------------------------------------------------------------------------- 1 | 1000,goje,500,4 2 | 1002,sib,500,86 3 | 1003,moz,500,50 4 | 1004,porteghal,400,51 5 | -------------------------------------------------------------------------------- /assignment_11/apple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_11/apple.jpg -------------------------------------------------------------------------------- /assignment_11/pear.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_11/pear.jpg -------------------------------------------------------------------------------- /assignment_11/poop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_11/poop.jpg -------------------------------------------------------------------------------- /assignment_12/ghalb2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_12/ghalb2.png -------------------------------------------------------------------------------- /assignment_12/khodi2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_12/khodi2.png -------------------------------------------------------------------------------- /assignment_7/words.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_7/words.txt -------------------------------------------------------------------------------- /assignment_8/img/0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/0.PNG -------------------------------------------------------------------------------- /assignment_8/img/1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/1.PNG -------------------------------------------------------------------------------- /assignment_8/img/3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/3.PNG -------------------------------------------------------------------------------- /assignment_8/img/4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/4.PNG -------------------------------------------------------------------------------- /assignment_8/img/5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/5.PNG -------------------------------------------------------------------------------- /assignment_8/img/6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/6.PNG -------------------------------------------------------------------------------- /assignment_8/img/7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/7.PNG -------------------------------------------------------------------------------- /assignment_8/img/8.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/img/8.PNG -------------------------------------------------------------------------------- /assignment_8/panda9.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_8/panda9.gif -------------------------------------------------------------------------------- /assignment_12/bullet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_12/bullet2.png -------------------------------------------------------------------------------- /assignment_12/doshman2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_12/doshman2.png -------------------------------------------------------------------------------- /assignment_14/imgg/c1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/c1.png -------------------------------------------------------------------------------- /assignment_14/imgg/c2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/c2.png -------------------------------------------------------------------------------- /assignment_14/imgg/c3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/c3.png -------------------------------------------------------------------------------- /assignment_14/imgg/c4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/c4.png -------------------------------------------------------------------------------- /assignment_14/imgg/bee_w1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/bee_w1.png -------------------------------------------------------------------------------- /assignment_14/imgg/bee_w2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/bee_w2.png -------------------------------------------------------------------------------- /assignment_14/imgg/bee_w3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/bee_w3.png -------------------------------------------------------------------------------- /assignment_14/imgg/bee_w4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/bee_w4.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 1.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 2.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 3.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 4.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 5.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 6.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 7.png -------------------------------------------------------------------------------- /assignment_14/imgg/cloud 8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/cloud 8.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_w1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_w1.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_w2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_w2.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_w3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_w3.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_w4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_w4.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_w5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_w5.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_w6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_w6.png -------------------------------------------------------------------------------- /assignment_12/Bckgroundimage.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_12/Bckgroundimage.jpg -------------------------------------------------------------------------------- /assignment_14/imgg/human_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_down.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_jump1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_jump1.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_jump2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_jump2.png -------------------------------------------------------------------------------- /assignment_14/imgg/human_jump3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/human_jump3.png -------------------------------------------------------------------------------- /assignment_7/mp4_to_mp3.py: -------------------------------------------------------------------------------- 1 | from moviepy import editor 2 | video = editor.VideoFileClip("1.mp4") 3 | video.audio.write_audiofile("1.mp3") 4 | -------------------------------------------------------------------------------- /assignment_14/imgg/background_image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yasinnorozzadeh/python-assignments/HEAD/assignment_14/imgg/background_image.png -------------------------------------------------------------------------------- /assignment_14/README.md: -------------------------------------------------------------------------------- 1 | ![Screenshot 2022-09-19 232534](https://user-images.githubusercontent.com/88095232/191094140-df1f3b2d-0213-4cf0-9087-e197a227d68c.png) 2 | -------------------------------------------------------------------------------- /assignment_16/README.md: -------------------------------------------------------------------------------- 1 | 2 | ![Screenshot 2022-08-26 005011](https://user-images.githubusercontent.com/88095232/186760890-9a7afe0f-7f30-49d8-b448-8f1f9473c1c3.png) 3 | -------------------------------------------------------------------------------- /assignment_17/README.md: -------------------------------------------------------------------------------- 1 | ## Tic Tac Toe 2 | ![Screenshot 2022-08-26 002957](https://user-images.githubusercontent.com/88095232/186758223-e2ff09d9-9061-4706-b378-8fa20917d413.png) 3 | -------------------------------------------------------------------------------- /assignment_2/Dice.py: -------------------------------------------------------------------------------- 1 | import random 2 | computer_tas = random.randint(1 , 6) 3 | print(computer_tas) 4 | while computer_tas == 6: 5 | computer_tas = random.randint(1 , 6) 6 | print("bonus : " , computer_tas) 7 | -------------------------------------------------------------------------------- /assignment_4/Sentence function.py: -------------------------------------------------------------------------------- 1 | def check_words(s): 2 | count = 0 3 | for i in range(0, len(s)): 4 | if s[i] == " ": 5 | count += 1 6 | return count +1 7 | s = input() 8 | print("number of words : ",check_words(s)) 9 | -------------------------------------------------------------------------------- /assignment_3/random number.py: -------------------------------------------------------------------------------- 1 | import random 2 | list=[] 3 | len_n = int(input("input len of numbers in list : ")) 4 | while len_n != len(list) : 5 | numer_add = random.randint(0 , 31) 6 | if numer_add not in list: 7 | list.append(numer_add) 8 | print(list) 9 | -------------------------------------------------------------------------------- /assignment_8/Gift.py: -------------------------------------------------------------------------------- 1 | import os 2 | import imageio 3 | 4 | myfiles = os.listdir("img") 5 | 6 | images = [] 7 | for i in range(len(myfiles)): 8 | image = imageio.imread("img/" + myfiles[i]) 9 | images.append(image) 10 | 11 | imageio.mimsave("panda9.gif" , images) 12 | -------------------------------------------------------------------------------- /assignment_11/README.md: -------------------------------------------------------------------------------- 1 | ![Screenshot 2022-07-20 205940](https://user-images.githubusercontent.com/88095232/180035023-4e33bae1-777c-42c5-b05d-b7c4db3bd239.png) 2 | ![Screenshot 2022-07-20 210008](https://user-images.githubusercontent.com/88095232/180035031-0c4543c0-94e5-4998-b833-cf1c5ac5a12b.png) 3 | -------------------------------------------------------------------------------- /assignment_4/Multiplication table.py: -------------------------------------------------------------------------------- 1 | n = int(input("input :")) 2 | m = int(input("input :")) 3 | def jadval(): 4 | for i in range(1, n+1): 5 | for j in range (1 , m+1): 6 | print(i *j , end= "\t") 7 | if j == m: 8 | print() 9 | jadval() 10 | -------------------------------------------------------------------------------- /assignment_2/fibonachi.py: -------------------------------------------------------------------------------- 1 | n = int(input('input number of fibonachi list => ')) 2 | fibonachi = [] 3 | for f in range(n): 4 | if f < 2 : 5 | fibonachi.append(1) 6 | else: 7 | fibo = fibonachi[f-1] + fibonachi[f-2] 8 | fibonachi.append(fibo) 9 | print(fibonachi) 10 | -------------------------------------------------------------------------------- /assignment_8/diamond.py: -------------------------------------------------------------------------------- 1 | length = int(input("Please Enter Length: ")) 2 | 3 | for i in range(length): 4 | print((length - i) * " ", end='') 5 | print((i * 2 - 1) * '*') 6 | 7 | for i in range(length, 0, -1): 8 | print((length - i) * " ", end='') 9 | print((i * 2 - 1) * '*') 10 | -------------------------------------------------------------------------------- /assignment_2/time_to_second.py: -------------------------------------------------------------------------------- 1 | hour = int(input("Enter hours:\n")) 2 | minute = int(input("Enter minutes:\n")) 3 | second = int(input("Enter seconds:\n")) 4 | if hour < 0 or minute < 0 or second < 0 : 5 | print("error") 6 | else: 7 | time = (hour * 3600) + (minute * 60) + second 8 | print("second:", time) 9 | -------------------------------------------------------------------------------- /assignment_4/Checkered page.py: -------------------------------------------------------------------------------- 1 | n = int(input("input weight :")) 2 | m = int(input("input height :")) 3 | def adad_safe_shatrangi(): 4 | for i in range(m): 5 | for i in range(n): 6 | print("#", end=("")) 7 | print("*", end=("")) 8 | print() 9 | adad_safe_shatrangi() 10 | -------------------------------------------------------------------------------- /assignment_2/seconde_to_time.py: -------------------------------------------------------------------------------- 1 | seconds = int(input("enter scondes for convert to hours:\n")) 2 | 3 | if seconds == 0: 4 | print("error") 5 | else: 6 | hours = int(seconds // 3600) 7 | seconds -= hours * 3600 8 | minutes = int(seconds // 60) 9 | seconds -= minutes * 60 10 | print("time:", hours, ":", int(minutes), ":", int(seconds)) 11 | -------------------------------------------------------------------------------- /assignment_1/bmi.py: -------------------------------------------------------------------------------- 1 | w = float(input(''' input youre weight (kg) 2 | ''')) 3 | h = float(input(''' input youre height (meter) 4 | ''')) 5 | bmi = w / (h ** 2 ) 6 | 7 | if bmi < 25: 8 | print("1") 9 | else: 10 | if 25 <= bmi >= 29.9: 11 | print("2") 12 | elif 30 <= bmi >= 34.9: 13 | print("3") 14 | else: 15 | print("4") 16 | -------------------------------------------------------------------------------- /assignment_2/user_numbers.py: -------------------------------------------------------------------------------- 1 | sum=0 2 | while True: 3 | user_number = input("__exit__ and __sum__ = exit\nEnter number:") 4 | if user_number == "exit": 5 | if sum == 0: 6 | print("sum:", sum) 7 | exit() 8 | break 9 | else: 10 | sum += float(user_number) 11 | print("sum : ", sum) 12 | print("sum : ", sum) 13 | -------------------------------------------------------------------------------- /assignment_4/Factoril.py: -------------------------------------------------------------------------------- 1 | adad = int(input()) 2 | adad_fct = int(1) 3 | if adad <= 1: 4 | print("no") 5 | exit() 6 | def faktorial(adad_fct): 7 | for i in range(2 , adad+1): 8 | adad_fct = adad_fct * i 9 | if adad_fct == adad : 10 | print(" _yas_ ") 11 | break 12 | if adad != adad_fct: 13 | print(" _no_ ") 14 | faktorial(adad_fct) 15 | -------------------------------------------------------------------------------- /assignment_5/khayam_pas.py: -------------------------------------------------------------------------------- 1 | n = int(input("input number : ")) 2 | kh_pas = [[None for i in range(n)] for i in range(n)] 3 | for i in range(n): 4 | kh_pas[i][0] = 1 5 | kh_pas[i][i] = 1 6 | for i in range(2 , n): 7 | for j in range(1 , i): 8 | kh_pas[i][j] = kh_pas[i-1][j] + kh_pas[i-1][j-1] 9 | for i in range(n): 10 | for j in range(i+1): 11 | print(kh_pas[i][j] ,end = "\t") 12 | print() 13 | -------------------------------------------------------------------------------- /assignment_4/K.M.M.py: -------------------------------------------------------------------------------- 1 | adad1 = int(input("input numbber1 =>")) 2 | adad2 = int(input("input numbber2 =>")) 3 | if adad1 > adad2: 4 | max = adad1 5 | min = adad2 6 | else: 7 | max = adad2 8 | min = adad1 9 | if max % min == 0: 10 | print(max) 11 | exit() 12 | else: 13 | for i in range(max , (adad1*adad2)+1): 14 | if i % adad1 == 0 and i % adad2 == 0: 15 | KMM = i 16 | print("K.M.M =>" , KMM) 17 | -------------------------------------------------------------------------------- /assignment_4/Equation of degree 2.py: -------------------------------------------------------------------------------- 1 | from math import sqrt 2 | a = int(input("input number :")) 3 | b = int(input("input number :")) 4 | c = int(input("input number :")) 5 | mohasebe = b ** 2 - 4*(a * c) 6 | if mohasebe == 0: 7 | x = -b - sqrt(mohasebe) 8 | print(x) 9 | elif mohasebe > 0: 10 | x1 = (-b + sqrt(mohasebe)) / (2 * a) 11 | x2 = (-b - sqrt(mohasebe)) / (2 * a) 12 | print(x1 , x2) 13 | else: 14 | print("no answer") 15 | -------------------------------------------------------------------------------- /assignment_4/B.M.M.py: -------------------------------------------------------------------------------- 1 | adad1 = int(input("input numbber1 =>")) 2 | adad2 = int(input("input numbber2 =>")) 3 | if adad1 == 1 or adad2 == 1: 4 | print("not print b.m.m") 5 | exit() 6 | else: 7 | if adad1 > adad2: 8 | max = adad1 9 | min = adad2 10 | else: 11 | max = adad2 12 | min = adad1 13 | for i in range(1 ,max+1): 14 | if adad1 % i == 0 and adad2 % i == 0: 15 | BMM = i 16 | print("B.M.M =>" , BMM) 17 | -------------------------------------------------------------------------------- /assignment_1/triangle.py: -------------------------------------------------------------------------------- 1 | number1 = int(input('''input number1 for triangel => 2 | ''')) 3 | number2 = int(input('''input number2 for triangel => 4 | ''')) 5 | number3 = int(input('''input number3 for triangel => 6 | ''')) 7 | if number1 == 0 and number2 == 0 and number3 == 0: 8 | print("f") 9 | else: 10 | if number1 + number2 >= number3 or number1 + number3 >= number2 or number2 + number3 >= number1 : 11 | print("True") 12 | else: 13 | print("f") 14 | -------------------------------------------------------------------------------- /assignment_5/turtle.py: -------------------------------------------------------------------------------- 1 | import turtle 2 | import time 3 | t=turtle.Pen() 4 | azlaa = 3 5 | t.shape("turtle") 6 | t.speed(100000) 7 | turtle.bgcolor("red") 8 | adad1 = 0 9 | adad2 = 0 10 | a = 50 11 | t.goto(-adad1 , -adad2) 12 | while not azlaa == 11: 13 | for i in range (azlaa): 14 | t.left(360 / azlaa) 15 | t.forward(a) 16 | azlaa += 1 17 | time.sleep(1) 18 | t.penup() 19 | adad1 += 5 20 | adad2 -= 18 21 | t.goto(adad1 , adad2) 22 | t.pendown() 23 | a += 15 24 | -------------------------------------------------------------------------------- /assignment_2/average.py: -------------------------------------------------------------------------------- 1 | student_number = int(input("input student number as int =>")) 2 | student_list = [] 3 | sum = 0 4 | for i in range(student_number): 5 | sum1 = float(input("input student score : ")) 6 | student_list.append(sum1) 7 | 8 | for i in range(len(student_list)): 9 | sum += student_list[i] 10 | 11 | average = sum / student_number 12 | 13 | student_list.sort() 14 | max = student_list[student_number-1] 15 | min = student_list[0] 16 | print("max score:" , max , "|" , "min score:" , min , "|" , "all average" , average) 17 | -------------------------------------------------------------------------------- /assignment_1/average.py: -------------------------------------------------------------------------------- 1 | name = input(''' input youre name => 2 | ''') 3 | family = input(''' input your family 4 | ''') 5 | 6 | Lesson_1 = float(input(''' input Score Lesson 1 => 7 | ''')) 8 | Lesson_2 = float(input(''' input Score Lesson 2 => 9 | ''')) 10 | Lesson_3 = float(input(''' input Score Lesson 3 => 11 | ''')) 12 | 13 | sum =Lesson_1 + Lesson_2 + Lesson_3 14 | average = sum / 3 15 | 16 | 17 | if average <= 12 : 18 | print("fail") 19 | else: 20 | if 12 <= average <= 17: 21 | print ("normal") 22 | else: 23 | print("great") 24 | 25 | 26 | -------------------------------------------------------------------------------- /assignment_3/snake.py: -------------------------------------------------------------------------------- 1 | n = int(input("input hight snake :")) 2 | i = 0 3 | if n <= 5 : 4 | print("not draw snake") 5 | else: 6 | if n % 2 == 1: 7 | print("*" , end="") 8 | for j in range(n): 9 | i += 2 10 | if n <= i : 11 | exit() 12 | print("#" , end = "" ) 13 | if n <= i : 14 | exit() 15 | print("*" , end = "") 16 | else: 17 | for k in range(n): 18 | i += 2 19 | if n < i : 20 | exit() 21 | print("#" , end = "") 22 | if n < i : 23 | exit() 24 | print("*" , end = "") 25 | -------------------------------------------------------------------------------- /assignment_3/sort list.py: -------------------------------------------------------------------------------- 1 | list1 = [] 2 | sort = [] 3 | tedad = int(input("input numer numbers:")) 4 | if tedad != 0: 5 | for i in range(tedad): 6 | list1_append = int(input("exit = 0 , input numbers:")) 7 | if list1_append == 0: 8 | break 9 | list1.append(list1_append) 10 | for i in range(len(list1)): 11 | if list1[i] < list1[i+1] : 12 | sort.append("sort :)") 13 | else: 14 | sort.append("dont sort!!") 15 | if "dont sort!!" in sort : 16 | print("dont sort!!") 17 | exit() 18 | else: 19 | print("sort :)") 20 | exit() 21 | else: 22 | print("!! dont sort becuse for sort requires 2 numbers !!") 23 | -------------------------------------------------------------------------------- /assignment_12/README.md: -------------------------------------------------------------------------------- 1 | ##Silver_SpaceCraft## 2 | 3 | بر اثر برخورد تیر، سفینه دشمن منهدم شده و منفجر شود✅ 4 | 5 | فاصله زمانی بین ورود دشمن‌ها، دقیقا ۵ ثانیه نباشد. به صورت تصادفی گاهی ۴ ثانیه یا ۶ ثانیه یا … باشد✅ 6 | 7 | با خروج هر دشمن یا تیر از صفحه بازی، شی آن از لیست مورد نظر حذف شود✅ 8 | 9 | در شروع بازی سه تا قلب گوشه پایین سمت چپ چاپ بشود که نشان دهنده جون بازیکن می‌باشد✅ 10 | 11 | در گوشه پایین سمت راست امتیاز بازیکن نمایش داده شود. امتیاز بازیکن = تعداد دشمن‌های منفجر شده✅ 12 | 13 | با رسیدن هر دشمن به سیاره ما، یک جون از بازیکن کم شود✅ 14 | 15 | در صورت تمام شدن جون ها، صفحه سیاه شده و پیام GAME OVER چاپ شود✅ 16 | 17 | سرعت دشمن به مرور اندک اندک افزایش پیدا کند✅ 18 | 19 | ![Untitled](https://user-images.githubusercontent.com/88095232/133442402-eed18b05-d7ff-4ea0-a142-ff181a380e75.png) 20 | 21 | -------------------------------------------------------------------------------- /assignment_1/calculator.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | result = "" 4 | 5 | op = input('''+ , - , * , / , sin , cos , tan , radical 6 | ''' ) 7 | 8 | if op == "radical" or op == "sin" or op == "tan" or op == "cos": 9 | a = float(input("input number => ")) 10 | if op == "sin": 11 | result = math.sin(a) 12 | if op == "cos": 13 | result = math.cos(a) 14 | if op == "tan": 15 | result == math.tan(a) 16 | if op == "radical": 17 | result = math.sqrt(a) 18 | 19 | 20 | else: 21 | b = float(input("input number 1 => ")) 22 | c = float(input("input number 2 => ")) 23 | if op == "+" : 24 | result = b + c 25 | 26 | elif op == "-" : 27 | result = b - c 28 | 29 | elif op == "*": 30 | result = b * c 31 | 32 | elif op == "/": 33 | result = b / c 34 | 35 | print(result) 36 | -------------------------------------------------------------------------------- /assignment_8/rock_paper_scissor.py: -------------------------------------------------------------------------------- 1 | import random 2 | game = ["paper", "scissor", "rock"] 3 | score_players = {"computer": 0, "user": 0} 4 | while True: 5 | computer = random.choice(game) 6 | user = int(input("1:Paper\t 2:Scissor\t 3:Rock\t 4:exit and score")) 7 | if computer == game[0] and user == 2 or computer == game[1] and user == 3 or computer == game[2] and user == 1: 8 | score_players["user"] += 1 9 | print("user get 1 point", score_players["user"]) 10 | elif computer == game[0] and user == 3 or computer == game[1] and user == 1 or computer == game[2] and user == 2: 11 | score_players["computer"] += 1 12 | print("computer get 1 point" , score_players["computer"]) 13 | elif user == 4: 14 | break 15 | else: 16 | print("equal") 17 | if score_players["computer"] > score_players["user"]: 18 | print("computer win!!") 19 | elif score_players["computer"] < score_players["user"]: 20 | print("user win!!") 21 | else: 22 | print("equal !!") 23 | -------------------------------------------------------------------------------- /assignment_11/checkered board.py: -------------------------------------------------------------------------------- 1 | import arcade 2 | COLUMN_SPACING = 20 3 | ROW_SPACING = 20 4 | LEFT_MARGIN = 65 5 | BOTTOM_MARGIN = 65 6 | arcade.open_window(300,300, "Checkered page") 7 | arcade.set_background_color(arcade.color.WHITE) 8 | arcade.start_render() 9 | for row in range(10): 10 | for column in range(10): 11 | adad_1_dimond = column * COLUMN_SPACING + LEFT_MARGIN 12 | adad_2_dimond = row * ROW_SPACING + BOTTOM_MARGIN 13 | if (row+1) % 2 == 0: 14 | if (column+1) % 2 != 0: 15 | arcade.draw_circle_filled(adad_1_dimond, adad_2_dimond, 7, arcade.color.BABY_BLUE) 16 | else: 17 | arcade.draw_circle_filled(adad_1_dimond, adad_2_dimond, 7, arcade.color.RED_PURPLE) 18 | else: 19 | if (column + 1) % 2 != 0: 20 | arcade.draw_circle_filled(adad_1_dimond, adad_2_dimond, 7, arcade.color.RED_PURPLE) 21 | else: 22 | arcade.draw_circle_filled(adad_1_dimond, adad_2_dimond, 7, arcade.color.BABY_BLUE) 23 | arcade.finish_render() 24 | arcade.run() 25 | -------------------------------------------------------------------------------- /assignment_3/hangman.py: -------------------------------------------------------------------------------- 1 | import random 2 | true_ch = [] 3 | print("youre score : 10") 4 | score = 10 5 | words = ["Book" , "Tree" , "Python" , "Bag" , "Umbrella" , "Dog" , "Clock" , "Engineer" , "Toothpast" , "Shirmoz"] 6 | word = random.choice(words) 7 | word = word.lower() 8 | print ("_ " * len(word) , ":") 9 | test = -1 10 | while not score <= 0: 11 | if len(word) == len(true_ch) : 12 | print("|" , "__ you win __", "|", word) 13 | exit() 14 | user_charater = input("\t input youre character : ").lower() 15 | if user_charater in word : 16 | true_ch.append(user_charater) 17 | print("\t youre input true character\n") 18 | else: 19 | score -= 1 20 | print("no |" , "\tyoure score: " , score) 21 | for i in range(len(word)): 22 | if word[i] in true_ch: 23 | print(word[i],end="") 24 | else: 25 | print("_ ",end="") 26 | test += 1 27 | if len(word) == len(true_ch) : 28 | print("|" , "__ you win __", "|", word) 29 | exit() 30 | print("| youre lose |" , word) 31 | -------------------------------------------------------------------------------- /assignment_14/player.py: -------------------------------------------------------------------------------- 1 | import arcade 2 | 3 | 4 | class Player(arcade.AnimatedWalkingSprite): 5 | def __init__(self): 6 | super().__init__() 7 | self.walk_up_textures = [arcade.load_texture_pair("imgg\human_jump3.png")] 8 | self.walk_right_textures = [arcade.load_texture_pair("imgg\human_w1.png"),arcade.load_texture_pair("imgg\human_w2.png"),arcade.load_texture_pair("imgg\human_w6.png"),arcade.load_texture_pair("imgg\human_w4.png"),arcade.load_texture_pair("imgg\human_w5.png"),arcade.load_texture_pair("imgg\human_w6.png")] 9 | 10 | self.width = 80 11 | self.height = 80 12 | self.center_x = 150 13 | self.center_y = 300 14 | self.score = 0 15 | self.control_speed = 0 16 | self.frame = 0 17 | self.down = False 18 | 19 | def update_animation(self, delta_time: float = 1 / 60): 20 | if self.frame>=5: 21 | self.frame = 0 22 | else: 23 | self.frame +=1 24 | self.texture = self.walk_right_textures[self.frame][0] 25 | 26 | def manual_walkDown_animation(self): 27 | self.texture = arcade.load_texture("imgg/human_down.png") 28 | self.change_y -= 5 29 | -------------------------------------------------------------------------------- /assignment_9/deduction.py: -------------------------------------------------------------------------------- 1 | class Fraction(): 2 | def __init__ (self, numerator = None, denominator = None): 3 | self.numerator = numerator 4 | self.denominator = denominator 5 | def sum(self, d2): 6 | sum = Fraction() 7 | sum.numerator = (self.numerator * d2.denominator) + (d2.numerator * self.denominator) 8 | sum.denominator = self.denominator * d2.denominator 9 | return sum 10 | def sub(self, d2): 11 | sub = Fraction() 12 | sub.numerator = (self.numerator * d2.denominator) - (d2.numerator * self.denominator) 13 | sub.denominator = self.denominator * d2.denominator 14 | return sub 15 | def mul(self, d2): 16 | mul = Fraction() 17 | mul.numerator = self.numerator * d2.numerator 18 | mul.denominator = self.denominator * d2.denominator 19 | return mul 20 | def div(self, d2): 21 | div = Fraction() 22 | div.numerator = self.numerator * d2.denominator 23 | div.denominator = self.denominator * d2.numerator 24 | return div 25 | def result(self): 26 | print(self.numerator, "/", self.denominator) 27 | while True: 28 | d1 = Fraction(int(input("numerator1:\t")), int(input("denominator1:\t"))) 29 | d2 = Fraction(int(input("numerator2:\t")), int(input("denominator2:\t"))) 30 | op = int(input("1: sum\n2: sub\n3: mul\n4: div\n5: exit\nenter operation:\t")) 31 | if op == 1: 32 | d1.sum(d2).result() 33 | elif op == 2: 34 | d2.sub(d2).result() 35 | elif op == 3: 36 | d1.mul(d2).result() 37 | elif op == 4: 38 | div = d1.div(d2) 39 | div.result() 40 | elif op == 5: 41 | exit() 42 | else: 43 | print("select number from list") 44 | -------------------------------------------------------------------------------- /assignment_14/enemy.py: -------------------------------------------------------------------------------- 1 | import random 2 | import arcade 3 | 4 | class Enemy_Bee(arcade.AnimatedWalkingSprite): 5 | def __init__(self,x,s): 6 | super().__init__() 7 | self.walk_left_textures = [arcade.load_texture("imgg/bee_w1.png"), 8 | arcade.load_texture("imgg/bee_w2.png"), 9 | arcade.load_texture("imgg/bee_w3.png"), 10 | arcade.load_texture("imgg/bee_w4.png")] 11 | self.width = 5 12 | self.height = 5 13 | self.center_x = x 14 | self.center_y = random.randint(200, 300) 15 | self.change_x -= (s+1) 16 | 17 | class Enemy_Co1(arcade.Sprite): 18 | def __init__(self,x,s): 19 | super().__init__("imgg\c1.png") 20 | self.width = 80 21 | self.height = 100 22 | self.center_y = 90 23 | self.center_x = x 24 | self.change_x -= s 25 | 26 | class Enemy_Co2(arcade.Sprite): 27 | def __init__(self,x,s): 28 | super().__init__("imgg\c2.png") 29 | self.width = 40 30 | self.height = 100 31 | self.center_x = x 32 | self.center_y = 90 33 | self.change_x -= s 34 | 35 | class Enemy_Co3(arcade.Sprite): 36 | def __init__(self,x,s): 37 | super().__init__("imgg\c3.png") 38 | self.width = 70 39 | self.height = 100 40 | self.center_x = x 41 | self.center_y = 90 42 | self.change_x -= s 43 | 44 | class Enemy_Co4(arcade.Sprite): 45 | def __init__(self,x,s): 46 | super().__init__("imgg\c4.png") 47 | self.width = 70 48 | self.height = 100 49 | self.center_x = x 50 | self.center_y = 90 51 | self.change_x -= s -------------------------------------------------------------------------------- /assignment_8/complex_number.py: -------------------------------------------------------------------------------- 1 | def Sum(): 2 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 3 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 4 | sum = {"numerator": 0, "Denominator": 0} 5 | sum["numerator"] = d1["numerator"] + d2["numerator"] 6 | sum["Denominator"] = d1["Denominator"] + d2["Denominator"] 7 | return sum 8 | def Sub(): 9 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 10 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 11 | sub = {} 12 | sub["numerator"] = d1["numerator"] - d2["numerator"] 13 | sub["Denominator"] = d1["Denominator"] - d2["Denominator"] 14 | return sub 15 | def Mul(): 16 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 17 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 18 | mul = {} 19 | mul["numerator"] = (d1["numerator"] * d2["numerator"]) - (d1["Denominator"] * d2["Denominator"]) 20 | mul["Denominator"] = (d1["Denominator"] * d2["numerator"]) + (d1["numerator"] * d2["Denominator"]) 21 | return mul 22 | while True: 23 | op = int(input("1: sum\n2: sub\n3: mul\n4: exit\nenter operation:\t")) 24 | if op == 1: 25 | sum = Sum() 26 | print("sum:", sum["numerator"], sum["Denominator"]) 27 | elif op == 2: 28 | sub = Sub() 29 | print("sub:", sub["numerator"], sub["Denominator"]) 30 | elif op == 3: 31 | mul = Mul() 32 | print("mul:", mul["numerator"], mul["Denominator"]) 33 | elif op == 4: 34 | exit() 35 | else: 36 | print("select number from list") -------------------------------------------------------------------------------- /assignment_14/ground.py: -------------------------------------------------------------------------------- 1 | import arcade 2 | import random 3 | class Ground(arcade.Sprite): 4 | def __init__(self,x,y): 5 | super().__init__(":resources:images/tiles/grassHalf_mid.png") 6 | self.width = 80 7 | self.height = 80 8 | self.center_x = x 9 | self.center_y = y 10 | 11 | class Cloud(arcade.Sprite): 12 | def __init__(self): 13 | super().__init__("imgg\cloud 1.png") 14 | self.width = 100 15 | self.height = 100 16 | self.center_x = 800 17 | self.center_y = random.randint(350, 650) 18 | self.change_x -= 0.5 19 | 20 | class Cloud1(arcade.Sprite): 21 | def __init__(self): 22 | super().__init__("imgg\cloud 2.png") 23 | self.width = 100 24 | self.height = 100 25 | self.center_x = 800 26 | self.center_y = random.randint(350, 650) 27 | self.change_x -= 0.5 28 | 29 | class Cloud2(arcade.Sprite): 30 | def __init__(self): 31 | super().__init__("imgg\cloud 3.png") 32 | self.width = 100 33 | self.height = 100 34 | self.center_x = 800 35 | self.center_y = random.randint(350, 650) 36 | self.change_x -= 0.5 37 | 38 | class Cloud3(arcade.Sprite): 39 | def __init__(self): 40 | super().__init__("imgg\cloud 4.png") 41 | self.width = 100 42 | self.height = 100 43 | self.center_x = 800 44 | self.center_y = random.randint(350, 650) 45 | self.change_x -= 0.5 46 | 47 | class Cloud4(arcade.Sprite): 48 | def __init__(self): 49 | super().__init__("imgg\cloud 5.png") 50 | self.width = 100 51 | self.height = 100 52 | self.center_x = 800 53 | self.center_y = random.randint(350, 650) 54 | self.change_x -= 0.5 55 | 56 | class Cloud5(arcade.Sprite): 57 | def __init__(self): 58 | super().__init__("imgg\cloud 6.png") 59 | self.width = 100 60 | self.height = 100 61 | self.center_x = 800 62 | self.center_y = random.randint(350, 650) 63 | self.change_x -= 0.5 64 | -------------------------------------------------------------------------------- /assignment_8/deduction.py: -------------------------------------------------------------------------------- 1 | def Sum(): 2 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 3 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 4 | sum = {} 5 | if d1["Denominator"] == d2["Denominator"]: 6 | sum["numerator"] = d1["numerator"] + d2["numerator"] 7 | sum["Denominator"] = d1["Denominator"] 8 | else: 9 | sum["Denominator"] = d1["Denominator"] * d2["Denominator"] 10 | sum["numerator"] = (d1["numerator"] * d2["Denominator"]) + (d1["Denominator"] * d2["numerator"]) 11 | return sum 12 | def Sub(): 13 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 14 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 15 | sub = {} 16 | if d1["Denominator"] == d2["Denominator"]: 17 | sub["numerator"] = d1["numerator"] - d2["numerator"] 18 | sub["Denominator"] = d1["Denominator"] 19 | else: 20 | sub["numerator"] = (d1["numerator"] * d2["Denominator"]) - (d1["Denominator"] * d2["numerator"]) 21 | sub["Denominator"] = d1["Denominator"] * d2["Denominator"] 22 | return sub 23 | def Mul(): 24 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 25 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 26 | mul = {} 27 | mul["numerator"] = d1["numerator"] * d2["numerator"] 28 | mul["Denominator"] = d1["Denominator"] * d2["Denominator"] 29 | return mul 30 | def Div(): 31 | d1 = {"numerator": int(input("numerator1:\t")), "Denominator": int(input("Denominator1:\t"))} 32 | d2 = {"numerator": int(input("numerator2:\t")), "Denominator": int(input("Denominator2:\t"))} 33 | div = {} 34 | if d2["numerator"] != 0 and d2["Denominator"] != 0: 35 | div["numerator"] = d1["numerator"] * d2["Denominator"] 36 | div["Denominator"] = d1["Denominator"] * d2["numerator"] 37 | return div 38 | else: 39 | e = 1 40 | return e 41 | 42 | 43 | while True: 44 | op = int(input("1: sum\n2: sub\n3: mul\n4: div\n5: exit\nenter opration:\t")) 45 | if op == 1: 46 | sum = Sum() 47 | print("sum:", sum["numerator"], "/", sum["Denominator"]) 48 | elif op == 2: 49 | sub = Sub() 50 | print("sub:", sub["numerator"], "/", sub["Denominator"]) 51 | elif op == 3: 52 | mul = Mul() 53 | print("mul:", mul["numerator"], "/", mul["Denominator"]) 54 | elif op == 4: 55 | div = Div() 56 | if div != 1: 57 | print("div:", div["numerator"], "/", div["Denominator"]) 58 | else: 59 | print("no answer!") 60 | elif op == 5: 61 | exit() 62 | else: 63 | print("select number from list") -------------------------------------------------------------------------------- /assignment_8/time.py: -------------------------------------------------------------------------------- 1 | def Sum_time(): 2 | time1 = {} 3 | time1["s"] = int(input("enter second time1:\t")) 4 | time1["m"] = int(input("enter minute time1:\t")) 5 | time1["h"] = int(input("enter hour time1:\t")) 6 | time2 = {} 7 | time2["s"] = int(input("enter second time2:\t")) 8 | time2["m"] = int(input("enter minute time2:\t")) 9 | time2["h"] = int(input("enter hour time2:\t")) 10 | sum = {} 11 | sum["s"] = time1["s"] + time2["s"] 12 | sum["m"] = time1["m"] + time2["m"] 13 | sum["h"] = time1["h"] + time2["h"] 14 | while True: 15 | if sum["s"] >= 60: 16 | sum["s"] -= 60 17 | sum["m"] += 1 18 | elif sum["m"] >= 60: 19 | sum["m"] -= 60 20 | sum["h"] += 1 21 | else: 22 | break 23 | return sum 24 | 25 | def Sub_time(): 26 | time1 = {} 27 | time1["s"] = int(input("enter second time1:\t")) 28 | time1["m"] = int(input("enter minute time1:\t")) 29 | time1["h"] = int(input("enter hour time1:\t")) 30 | time2 = {} 31 | time2["s"] = int(input("enter second time2:\t")) 32 | time2["m"] = int(input("enter minute time2:\t")) 33 | time2["h"] = int(input("enter hour time2:\t")) 34 | sub = {} 35 | while True: 36 | if time2["s"] > time1["s"]: 37 | time1["m"] -= 1 38 | time1["s"] += 60 39 | elif time2["m"] > time1["m"]: 40 | time1["h"] -= 1 41 | time1["m"] += 60 42 | else: 43 | break 44 | sub["s"] = time1["s"] - time2["s"] 45 | sub["m"] = time1["m"] - time2["m"] 46 | sub["h"] = time1["h"] - time2["h"] 47 | return sub 48 | 49 | def Second_2_time(): 50 | seconds = int(input("enter seconds:\t")) 51 | s_2_t = {} 52 | s_2_t["s"] = seconds 53 | s_2_t["m"] = 0 54 | s_2_t["h"] = 0 55 | while True: 56 | if s_2_t["s"] >= 60: 57 | s_2_t["s"] -= 60 58 | s_2_t["m"] += 1 59 | elif s_2_t["m"] >= 60: 60 | s_2_t["m"] -= 60 61 | s_2_t["h"] += 1 62 | else: 63 | break 64 | return s_2_t 65 | 66 | def Time_2_second(): 67 | t_2_s = {} 68 | t_2_s['s'] = int(input('enter second:\t')) 69 | t_2_s['m'] = int(input('enter minute:\t')) 70 | t_2_s['h'] = int(input('enter hour:\t')) 71 | 72 | return t_2_s['s'] + (t_2_s['m'] * 60) + (t_2_s['h'] * 3600) 73 | 74 | while True: 75 | op = int(input("1:Sum_time\t 2:Sub_time\t 3:second_2_time\t 4:time_2_second\t -1:_exit_\nenter operation:\n")) 76 | if op == 1: 77 | sum = Sum_time() 78 | print("time:\t", sum["h"], ":", sum["m"], ":", sum["s"]) 79 | elif op == 2: 80 | sub = Sub_time() 81 | print("time:\t", sub["h"], ":", sub["m"], ":", sub["s"]) 82 | elif op == 3: 83 | s_2_t = Second_2_time() 84 | print("time:\t", s_2_t["h"], ":", s_2_t["m"], ":", s_2_t["s"]) 85 | elif op == 4: 86 | print("second:\t", Time_2_second()) 87 | elif op == -1: 88 | exit() 89 | else: 90 | print("select another number:\n") -------------------------------------------------------------------------------- /assignment_7/translator.py: -------------------------------------------------------------------------------- 1 | import pyfiglet 2 | WORDS_LIST = [] 3 | 4 | def Load(): 5 | my_file = open("words.txt", "r") 6 | words = my_file.read().lower().split("\n") 7 | for i in range(1, len(words), 2): 8 | dict = {} 9 | dict["english"] = words[i-1] 10 | dict["persian"] = words[i] 11 | WORDS_LIST.append(dict) 12 | 13 | f = pyfiglet.figlet_format("yasin dictionary", font = "digital" ) 14 | print(f) 15 | def Add(): 16 | f = pyfiglet.figlet_format("add word", font = "isometric1" ) 17 | while True: 18 | print(f) 19 | new_english_word = input("enter english word:\n") 20 | new_persian_word = input("enter persian word:\n") 21 | new_dict_words = {} 22 | new_dict_words["english"] = new_english_word 23 | new_dict_words["persian"] = new_persian_word 24 | WORDS_LIST.append(new_dict_words) 25 | repeat = input("do you want to translate agane?(Y/N)") 26 | if repeat == "N" or repeat == "n": 27 | break 28 | def Save(): 29 | f = open("words.txt", "w") 30 | for i in range(len(WORDS_LIST)): 31 | save_data = WORDS_LIST[i]['english'] + '\n' + WORDS_LIST[i]['persian'] 32 | f.write(str(save_data)) 33 | if i != len(WORDS_LIST) -1: 34 | f.write('\n') 35 | f.close() 36 | def Choice(): 37 | choice = int(input(" 1.add word\n 2.english_2_persian\n 3.persian_2_english\n 4.save_and_exit\n")) 38 | if choice == 1: 39 | Add() 40 | elif choice == 2: 41 | Engelish_2_Persian() 42 | elif choice == 3: 43 | Persian_2_English() 44 | elif choice == 4: 45 | font = pyfiglet.figlet_format("save", font = "doh" ) 46 | print(font) 47 | Save() 48 | exit() 49 | else : 50 | print("number is not in the list, please enter the number\n") 51 | def Persian_2_English(): 52 | while True: 53 | search_persian_word = input('enter persian word:\n').lower().split(".") 54 | for s in range(len(search_persian_word)): 55 | search_persian_word2 = search_persian_word[s].split(" ") 56 | for k in range(len(search_persian_word2)): 57 | for i in range(len(WORDS_LIST)): 58 | if search_persian_word2[k] == WORDS_LIST[i]['persian']: 59 | print(WORDS_LIST[i]['english'], end=" ") 60 | break 61 | repeat = input("\ndo you want to translate agane?(Y/N)") 62 | if repeat == "N" or repeat == "n": 63 | break 64 | def Engelish_2_Persian(): 65 | while True: 66 | search_english_word = input('enter english word:').lower().split(".") 67 | for j in range(len(search_english_word)): 68 | search_english_word2 = search_english_word[j].split(" ") 69 | for s in range(len(search_english_word2)): 70 | for i in range(len(WORDS_LIST)): 71 | if search_english_word2[s] == WORDS_LIST[i]['english']: 72 | print(WORDS_LIST[i]['persian'], end=" ") 73 | break 74 | repeat = input("\ndo you want to translate agane?(Y/N)") 75 | if repeat == "N" or repeat == "n": 76 | break 77 | 78 | Load() 79 | while True: 80 | Choice() 81 | Save() 82 | -------------------------------------------------------------------------------- /assignment_9/time.py: -------------------------------------------------------------------------------- 1 | class Time: 2 | def __init__(self, second = None, minut = None, hour = None): 3 | self.h = hour 4 | self.m = minut 5 | self.s = second 6 | def sum_time(self, time2): 7 | Sum = Time() 8 | self.time2 = time2 9 | Sum.s = self.s + time2.s 10 | Sum.m = self.m + time2.m 11 | Sum.h = self.h + time2.h 12 | r = True 13 | while r: 14 | if Sum.s >= 60: 15 | Sum.s -= 60 16 | Sum.m += 1 17 | elif Sum.m >= 60: 18 | Sum.m -= 60 19 | Sum.h += 1 20 | else: 21 | r = False 22 | return Sum 23 | def sub_time(self, time2): 24 | Sub = Time() 25 | self.time2 = time2 26 | Sub.s = self.s - time2.s 27 | Sub.m = self.m - time2.m 28 | Sub.h = self.h - time2.h 29 | r = True 30 | while r: 31 | if Sub.s < 0 : 32 | Sub.s += 60 33 | Sub.m -= 1 34 | elif Sub.m < 0 : 35 | Sub.m += 60 36 | Sub.h -= 1 37 | else: 38 | r = False 39 | return Sub 40 | def time_2_second(self, s, m, h): 41 | return int(s + (m * 60) + (h * 3600)) 42 | def second_2_time(self, s): 43 | sec_2_time = Time() 44 | sec_2_time.s = s 45 | sec_2_time.m = 0 46 | sec_2_time.h = 0 47 | r = True 48 | while r: 49 | if sec_2_time.s >= 60: 50 | sec_2_time.s -= 60 51 | sec_2_time.m += 1 52 | elif sec_2_time.m >= 60: 53 | sec_2_time.m -= 60 54 | sec_2_time.h += 1 55 | else: 56 | r = False 57 | return sec_2_time 58 | def result(self): 59 | print(self.h, ":", self.m, ":", self.s) 60 | time = Time() 61 | while True: 62 | op_time = int(input("1 => _sum_of_time\n2 => _sub_of_time\n3 => second_2_time\n4 => time_2_second\n5 => _exit_ \nenter number of operation_time:\t")) 63 | if op_time == 1 or op_time == 2: 64 | sec_first = int(input("enter secconds of time1:\t")) 65 | min_first = int(input("enter minutes of time1:\t")) 66 | hour_first = int(input("enter hours of time1:\t")) 67 | sec_second = int(input("enter secconds of time2:\t")) 68 | min_second = int(input("enter minutes of time2:\t")) 69 | hour_second = int(input("enter hours of time2:\t")) 70 | time_first = Time(sec_first, min_first, hour_first) 71 | time_second = Time(sec_second, min_second, hour_second) 72 | if op_time == 1: 73 | time_first.sum_time(time_second).result() 74 | if op_time == 2: 75 | time_first.sub_time(time_second).result() 76 | elif op_time == 3: 77 | time_third = int(input("enter seconds:\n")) 78 | time.second_2_time(time_third).result() 79 | elif op_time == 4: 80 | sec = int(input("enter secconds of time1:\t")) 81 | min = int(input("enter minutes of time1:\t")) 82 | hour= int(input("enter hours of time1:\t")) 83 | print("seconds:\t", time.time_2_second(sec, min, hour)) 84 | elif op_time == 5: 85 | exit() 86 | else: 87 | print("select number of list") 88 | -------------------------------------------------------------------------------- /assignment_5/tic_tac_toe.py: -------------------------------------------------------------------------------- 1 | import random 2 | import time 3 | from colored import fg 4 | from termcolor import colored 5 | 6 | start_time = time.time() 7 | user = int(input('exit = 0 | 1 player = 1 | 2 players = 2\ninput number of options:')) 8 | if user == 0: 9 | exit() 10 | 11 | game_board = [['_ ', '_ ', '_ '], 12 | ['_ ', '_ ', '_ '], 13 | ['_ ', '_ ', '_ ']] 14 | nut = [colored("O ", "red"), colored("X ", "blue")] 15 | 16 | def Game_board(): 17 | for i in range(3): 18 | for j in range(3): 19 | print(game_board[i][j] , fg(3), end="") 20 | print() 21 | 22 | player1 = nut[0] 23 | player2 = nut[1] 24 | 25 | def Win_condition(): 26 | for i in range(3): 27 | s1c = 0 28 | s2c = 0 29 | if game_board[0][i] == player1 and game_board[1][i] == player1 and game_board[2][i] == player1: 30 | s1c += 3 31 | elif game_board[0][i] == player2 and game_board[1][i] == player2 and game_board[2][i] == player2: 32 | s2c += 3 33 | for r in range(3): 34 | s1r = 0 35 | s2r = 0 36 | for c in range(3): 37 | if game_board[r][c] == player1: 38 | s1r += 1 39 | elif game_board[r][c] == player2: 40 | s2r += 1 41 | 42 | if s1r == 3 or s1c == 3: 43 | print("palyer one wins", "\nTime out is:", time.time() - start_time) 44 | exit() 45 | elif s2r == 3 or s2c == 3: 46 | print("player two wins", "\nTime out is:", time.time() - start_time) 47 | exit() 48 | if game_board[0][0] == player1 and game_board[1][1] == player1 and game_board[2][2] == player1 or game_board[0][2] == player1 and game_board[1][1] == player1 and game_board[2][0] == player1: 49 | print("player one wins", "\nTime out is:", time.time() - start_time) 50 | exit() 51 | elif game_board[0][0] == player2 and game_board[1][1] == player2 and game_board[2][2] == player2 or game_board[2][0] == player2 and game_board[1][1] == player2 and game_board[0][2] == player2: 52 | print("player two wins", "\nTime out is:", time.time() - start_time) 53 | exit() 54 | 55 | def Player2(): 56 | r = 4 57 | while True: 58 | row = int(input("enter your row:\n")) 59 | col = int(input("enter your column:\n")) 60 | if r%2==0 and 0<=row<3 and 0<=col<3: 61 | if game_board[row][col]== '_ ': 62 | game_board[row][col] = player1 63 | r+=1 64 | else: 65 | print("That is not empty") 66 | Game_board() 67 | Win_condition() 68 | 69 | elif r%2==1 and 0<=row<3 and 0<=col<3 : 70 | if game_board[row][col]== '_ ': 71 | game_board[row][col] = player2 72 | r+=1 73 | else: 74 | print("That is not empty") 75 | Game_board() 76 | Win_condition() 77 | else: 78 | print("Enter row and columns between 0=< and <2") 79 | 80 | def One_player(): 81 | selection_turn_player = 0 82 | print("player1 nut is:", player1, "player2 nut is:", player2) 83 | while True: 84 | if selection_turn_player == 0: 85 | 86 | row = int(input("enter your row:\n")) 87 | col = int(input("enter your column:\n")) 88 | if 0 <= row < 3 and 0 <= col < 3: 89 | if game_board[row][col] == "_ ": 90 | game_board[row][col] = player1 91 | selection_turn_player += 1 92 | Win_condition() 93 | if selection_turn_player == 1: 94 | row = random.randint(0, 2) 95 | col = random.randint(0, 2) 96 | if 0 <= row < 3 and 0 <= col < 3: 97 | if game_board[row][col] == "_ ": 98 | game_board[row][col] = player2 99 | selection_turn_player -= 1 100 | Game_board() 101 | Win_condition() 102 | if user == 1: 103 | One_player() 104 | elif user == 2: 105 | Player2() 106 | -------------------------------------------------------------------------------- /assignment_12/silver_spasecraft.py: -------------------------------------------------------------------------------- 1 | import math 2 | import random 3 | import time 4 | import arcade 5 | DEFAULT_FONT_SIZE = 45 6 | class Enemy(arcade.Sprite): 7 | def __init__(self , w , h , s= 3): 8 | super().__init__("doshman2.png") 9 | self.speed = s 10 | self.center_x = random.randint(0 , w) 11 | self.center_y = h 12 | self.width = 80 13 | self.height = 80 14 | # def shooot_racket_sound(): 15 | # arcade.play_sound(arcade.sound(":resources:sounds/hit3.wav"), 1.0 , 0.0 , False ) 16 | def move(self): 17 | self.center_y -= self.speed 18 | class Bullet(arcade.Sprite): 19 | def __init__(self , host): 20 | super().__init__("bullet2.png") 21 | self.speed = 4 22 | self.angle = host.angle 23 | self.center_x = host.center_x 24 | self.center_y = host.center_y 25 | def collision(self): 26 | arcade.play_sound(arcade.sound.Sound(':resources:sounds/laser4.wav'), 0.2, 0.0,False) 27 | def move(self): 28 | self.center_x -= self.speed * math.sin(math.radians(self.angle)) 29 | self.center_y += self.speed * math.cos(math.radians(self.angle)) 30 | class SpaseCraft(arcade.Sprite): 31 | def __init__(self , w , h): 32 | super().__init__("khodi2.png") 33 | self.w = 48 34 | self.h = 48 35 | self.center_x = w // 2 36 | self.center_y = 85 37 | self.angel = 0 38 | self.change_angle = 0 39 | self.bullet_list = [] 40 | self.speed = 4 41 | self.score = 0 42 | self.health = 3 43 | def rotate(self): 44 | self.angle += self.change_angle * self.speed 45 | def fire(self): 46 | self.bullet_list.append(Bullet(self)) 47 | class Game(arcade.Window): 48 | def __init__ (self): 49 | self.w = 700 50 | self.h = 700 51 | super().__init__(self.w , self.h , "Silver SpaceCraft") 52 | arcade.set_background_color(arcade.color.BLACK) 53 | self.bckground_image = arcade.load_texture("Bckgroundimage.jpg") 54 | self.me = SpaseCraft(self.w , self.h) 55 | self.enemy = Enemy(self.w , self.h) 56 | self.next_enemy_time = random.randint(2, 5) 57 | self.enemy_list = [] 58 | self.game_start_time = time.time() 59 | self.start_time = time.time() 60 | self.health_image = arcade.load_texture("ghalb2.png") 61 | def on_draw(self): 62 | arcade.start_render() 63 | if self.me.health<=0: 64 | arcade.draw_text('GAME OVER', self.w//2-200, self.h//2, arcade.color.ORANGE, DEFAULT_FONT_SIZE //2, width=400, align='center') 65 | else: 66 | arcade.draw_lrwh_rectangle_textured(0, 0, self.w, self.h, self.bckground_image) 67 | self.me.draw() 68 | for i in range(len(self.me.bullet_list)): 69 | self.me.bullet_list[i].draw() 70 | for i in range(len(self.enemy_list)): 71 | self.enemy_list[i].draw() 72 | for i in range(self.me.health): 73 | arcade.draw_lrwh_rectangle_textured(10+i*35 ,10 ,30 ,30 ,self.health_image) 74 | arcade.draw_text('Score: %i'%self.me.score, self.w-130, 10, arcade.color.RED, DEFAULT_FONT_SIZE //2, width=200, align='left') 75 | def on_update(self, delta_time): 76 | self.end_time = time.time() 77 | if self.end_time - self.start_time > self.next_enemy_time: 78 | self.next_enemy_time = random.randint(2, 6) 79 | self.enemy_list.append(Enemy(self.w, self.h, 3+(self.end_time-self.game_start_time)//24)) 80 | self.start_time = time.time() 81 | self.me.rotate() 82 | for i in range(len(self.me.bullet_list) ): 83 | self.me.bullet_list[i].move() 84 | for i in range(len(self.enemy_list)): 85 | self.enemy_list[i].move() 86 | for enemy in self.enemy_list: 87 | for bullet in self.me.bullet_list: 88 | if arcade.check_for_collision(bullet, enemy): 89 | # self.enemy.shooot_racket_sound() 90 | self.me.bullet_list.remove(bullet) 91 | self.enemy_list.remove(enemy) 92 | self.me.score += 1 93 | for enemy in self.enemy_list: 94 | if enemy.center_y < 0: 95 | self.me.health -= 1 96 | self.enemy_list.remove(enemy) 97 | for bullet in self.me.bullet_list: 98 | if bullet.center_y > self.height or bullet.center_x < 0 or bullet.center_x > self.width: 99 | self.me.bullet_list.remove(bullet) 100 | def on_key_press(self , key , modifiers): 101 | if key == arcade.key.RIGHT: 102 | self.me.change_angle = -1 103 | elif key == arcade.key.LEFT: 104 | self.me.change_angle = 1 105 | elif key == arcade.key.SPACE: 106 | self.me.fire() 107 | self.me.bullet_list[-1] 108 | def on_key_release(self , key , modifiers): 109 | self.me.change_angle = 0 110 | def main(): 111 | window = Game() 112 | window.center_window() 113 | arcade.run() 114 | if __name__ == "__main__": 115 | main() 116 | game = Game() 117 | arcade.run() 118 | -------------------------------------------------------------------------------- /assignment_6/store.py: -------------------------------------------------------------------------------- 1 | from pyfiglet import Figlet 2 | import qrcode 3 | 4 | def Show_List(): 5 | for i in range(len(PRODUCTS)): 6 | print(PRODUCTS[i]) 7 | def Load(): 8 | F = open("databace.txt", "r") 9 | data = F.read() 10 | product_list = data.split("\n") 11 | for i in range(len(product_list)): 12 | product_info = product_list[i].split(",") 13 | mydict = {} 14 | mydict['id'] = product_info[0] 15 | mydict['name'] = product_info[1] 16 | mydict['price'] = product_info[2] 17 | mydict['count'] = int(product_info[3]) 18 | PRODUCTS.append(mydict) 19 | print("welcome") 20 | f = Figlet(font="standard") 21 | print(f.renderText("Yasin Store #_#")) 22 | def Add(): 23 | while True: 24 | new = {} 25 | new["id"] = input("Enter id:\n") 26 | new["name"] = input("Enter name:\n") 27 | new["price"] = input("Enter price:\n") 28 | new["count"] = input("Enter count:\n") 29 | PRODUCTS.append(new) 30 | true_repeat = input("do you add enother product?(Y/N):\n") 31 | if true_repeat == "n" or true_repeat == "N": 32 | break 33 | def Edit(): 34 | while True: 35 | edit_from_name = input("Enter name product:\n") 36 | for i in range(len(PRODUCTS)): 37 | if edit_from_name == PRODUCTS[i]["name"]: 38 | edit_item = int(input('1.Edit id\n 2.Edit name\n 3.Edit price\n 4.Edit count\nEnter number:')) 39 | if edit_item == 1 : 40 | PRODUCTS[i]["id"] = input("Enter new id:\n") 41 | elif edit_item == 2 : 42 | PRODUCTS[i]["name"] = input("Enter new name:\n") 43 | elif edit_item == 3 : 44 | PRODUCTS[i]["price"] = input("Enter new pice:\n") 45 | elif edit_item == 4 : 46 | PRODUCTS[i]["count"] = input("Enter new count:\n") 47 | edit_repeat = input('do you edit enother product(Y/N):') 48 | if edit_repeat == 'n' or 'N': 49 | break 50 | def Delet(): 51 | while True: 52 | id_or_name_deleting = input("enter id or name for delet product:\n") 53 | for i in range(len(PRODUCTS)): 54 | if id_or_name_deleting == PRODUCTS[i]["id"]: 55 | PRODUCTS.remove(PRODUCTS[i]) 56 | elif id_or_name_deleting == PRODUCTS[i]["name"]: 57 | PRODUCTS.remove(PRODUCTS[i]) 58 | repeat_deleting = input("do you repeat deletting?(Y/N)\n") 59 | if repeat_deleting == "n" or "N": 60 | break 61 | def Search(): 62 | while True: 63 | searching_id_or_name = input("enter id or name product:\n") 64 | for i in range(len(PRODUCTS)): 65 | if searching_id_or_name == PRODUCTS[i]["id"]: 66 | print(PRODUCTS[i]) 67 | elif searching_id_or_name == PRODUCTS[i]["name"]: 68 | print(PRODUCTS[i]) 69 | repeat_searching = input('search enother product(Y/N):') 70 | if repeat_searching == 'n' or 'N': 71 | break 72 | def Buy(): 73 | while True: 74 | id_for_buy = input("enter id product for buy:\n") 75 | number = int(input("how many product want?\n")) 76 | for i in range(len(PRODUCTS)): 77 | if id_for_buy == PRODUCTS[i]["id"]: 78 | if PRODUCTS[i]["count"] >= number: 79 | PRODUCTS[i]["count"] = int(PRODUCTS[i]["count"]) - number 80 | else: 81 | print(int(PRODUCTS[i]["count"])) 82 | 83 | repeat_buy = input("do you buy enother product?(Y/N)\n") 84 | if repeat_buy == "n" or "N": 85 | break 86 | def Qrcode(): 87 | while True: 88 | id_qurcode = input("Enter id for qurcode:\n") 89 | for i in range(len(PRODUCTS)): 90 | if id_qurcode == PRODUCTS[i]["id"]: 91 | img = qrcode.make(PRODUCTS[i]['id']) 92 | img.save(PRODUCTS[i]['id'] + '.png') 93 | repeat_qurcode = input("do you make new qurcode?(Y/N)") 94 | if repeat_qurcode == 'n' or 'N': 95 | break 96 | def choice(): 97 | choice = int(input(" 1.Add\n 2.Edit\n 3.Delet\n 4.search\n 5.Show List\n 6.Buy\n 7.Qrcode\n 8.Exit\nPlease choose a number:\n")) 98 | if choice == 1: 99 | Add() 100 | elif choice == 2: 101 | Edit() 102 | elif choice == 3: 103 | Delet() 104 | elif choice == 4: 105 | Search() 106 | elif choice == 5: 107 | Show_List() 108 | elif choice == 6: 109 | Buy() 110 | elif choice == 7: 111 | Qrcode() 112 | elif choice == 8: 113 | f = Figlet(font = 'standard') 114 | print(f.renderText('goodbye')) 115 | exit() 116 | def Register_in_list(): 117 | f = open("databace.txt", "w") 118 | for i in range(len(PRODUCTS)): 119 | f.write(PRODUCTS[i]['id']) 120 | f.write(',') 121 | f.write(PRODUCTS[i]['name']) 122 | f.write(',') 123 | f.write(PRODUCTS[i]['price']) 124 | f.write(',') 125 | f.write(str(PRODUCTS[i]['count'])) 126 | if i != len(PRODUCTS) -1: 127 | f.write('\n') 128 | PRODUCTS = [] 129 | Load() 130 | Show_List() 131 | while True: 132 | choice() 133 | Register_in_list() 134 | -------------------------------------------------------------------------------- /assignment_11/Super_Snake.py: -------------------------------------------------------------------------------- 1 | import random 2 | import arcade 3 | width = 650 4 | height = 650 5 | class Apple(arcade.Sprite): 6 | def __init__(self , w , h): 7 | arcade.Sprite.__init__(self) 8 | self.image = "apple.jpg" 9 | self.apple = arcade.Sprite(self.image, 0.03) 10 | self.apple.center_x = random.randint(10 ,w - 10) 11 | self.apple.center_y = random.randint(10 ,h - 10) 12 | def draw(self): 13 | self.apple.draw() 14 | 15 | class Poop(arcade.Sprite): 16 | def __init__(self, w, h): 17 | arcade.Sprite.__init__(self) 18 | self.image = "poop.jpg" 19 | self.poop = arcade.Sprite(self.image, 0.07) 20 | self.poop.center_x = random.randint(10, w - 10) 21 | self.poop.center_y = random.randint(10, h - 10) 22 | def draw(self): 23 | self.poop.draw() 24 | 25 | class Pear(arcade.Sprite): 26 | def __init__(self, w, h): 27 | arcade.Sprite.__init__(self) 28 | self.image = "pear.jpg" 29 | self.pear = arcade.Sprite(self.image, 0.15) 30 | self.pear.center_x = random.randint(10, w - 10) 31 | self.pear.center_y = random.randint(10, h - 10) 32 | def draw(self): 33 | self.pear.draw() 34 | 35 | class Snake(arcade.Sprite): 36 | def __init__(self , w , h): 37 | arcade.Sprite.__init__(self) 38 | self.color = arcade.color.DARK_OLIVE_GREEN 39 | self.speed = 3 40 | self.width = 16 41 | self.height = 16 42 | self.r = 8 43 | self.snake_score = 1 44 | self.center_x = w // 2 45 | self.center_y = h // 2 46 | self.change_x = 0 47 | self.change_y = 0 48 | self.body = [] 49 | self.length = 0 50 | 51 | def draw(self): 52 | arcade.draw_circle_filled(self.center_x, self.center_y, self.r, self.color) 53 | self.body.append([self.center_x, self.center_y]) 54 | for body_item in self.body: 55 | arcade.draw_circle_filled(body_item[0], body_item[1], self.r ,self.color) 56 | if len(self.body) > self.length: 57 | self.body.pop(0) 58 | 59 | def move(self): 60 | self.center_x += self.speed * self.change_x 61 | self.center_y += self.speed * self.change_y 62 | 63 | def score_food(self, snake_food): 64 | if snake_food == "apple": 65 | self.snake_score += 1 66 | self.length += 2 67 | self.speed += 0.05 68 | elif snake_food == "pear": 69 | self.snake_score += 2 70 | self.length += 3 71 | self.speed += 0.5 72 | elif snake_food == "poop": 73 | self.snake_score -= 1 74 | if self.snake_score == 0: 75 | arcade.draw_text('GAME OVER', width//2, height//2, arcade.color.BLACK, 5 * 5, width=width, align='left') 76 | arcade.exit() 77 | else: 78 | self.speed -= 1 79 | self.body.pop() 80 | 81 | class Game(arcade.Window): 82 | def __init__ (self): 83 | arcade.Window.__init__(self, width, height, "super snake") 84 | arcade.set_background_color(arcade.color.SAND) 85 | self.snake = Snake(width, height) 86 | self.apple = Apple(width, height) 87 | self.pear = Pear(width, height) 88 | self.poop = Poop(width, height) 89 | self.txt = arcade.Camera(width, height) 90 | 91 | def on_draw(self): 92 | arcade.start_render() 93 | self.snake.draw() 94 | self.apple.draw() 95 | self.pear.draw() 96 | self.poop.draw() 97 | score = f"Score: {self.snake.snake_score}" 98 | arcade.draw_text(score, 10, 630, arcade.color.BLACK, 15, align='left') 99 | if self.snake.snake_score <= 0 or self.snake.center_x < 0 or self.snake.center_x > width or self.snake.center_y < 0 or self.snake.center_y > height: 100 | arcade.draw_text('GAME OVER', width//2, height//2, arcade.color.BLACK, 5 * 5, width=width, align='left') 101 | arcade.exit() 102 | 103 | def on_update(self, delta_time: float): 104 | self.snake.move() 105 | if arcade.check_for_collision(self.snake, self.apple.apple): 106 | self.snake.score_food("apple") 107 | self.apple = Apple(width, height) 108 | elif arcade.check_for_collision(self.snake, self.pear.pear): 109 | self.snake.score_food("pear") 110 | self.pear = Pear(width, height) 111 | elif arcade.check_for_collision(self.snake, self.poop.poop): 112 | self.snake.score_food("poop") 113 | self.poop = Poop(width, height) 114 | 115 | def on_key_release(self, key, modifiers): 116 | if key == arcade.key.UP or key == arcade.key.W: 117 | self.snake.change_x = 0 118 | self.snake.change_y = 1 119 | elif key == arcade.key.DOWN or key == arcade.key.S: 120 | self.snake.change_x = 0 121 | self.snake.change_y = -1 122 | elif key == arcade.key.LEFT or key == arcade.key.A: 123 | self.snake.change_x = -1 124 | self.snake.change_y = 0 125 | elif key == arcade.key.RIGHT or key == arcade.key.D: 126 | self.snake.change_x = 1 127 | self.snake.change_y = 0 128 | 129 | Game() 130 | arcade.run() 131 | -------------------------------------------------------------------------------- /assignment_16/calculator.py: -------------------------------------------------------------------------------- 1 | import math 2 | from functools import partial 3 | from PySide6.QtWidgets import * 4 | from PySide6.QtUiTools import * 5 | from PySide6.QtCore import * 6 | 7 | class HelloWorld(QMainWindow): 8 | def __init__(self): 9 | self.chek_op = 0 10 | super().__init__() 11 | loader = QUiLoader() 12 | self.ui = loader.load('form.ui',None) 13 | self.ui.show() 14 | self.ui.btn_sum.clicked.connect(self.sum) 15 | self.ui.btn_sub.clicked.connect(self.sub) 16 | self.ui.btn_mul.clicked.connect(self.mul) 17 | self.ui.btn_div.clicked.connect(self.div) 18 | 19 | self.ui.btn_num_1.clicked.connect(partial(self.numbers, 1)) 20 | self.ui.btn_num_2.clicked.connect(partial(self.numbers, 2)) 21 | self.ui.btn_num_3.clicked.connect(partial(self.numbers, 3)) 22 | self.ui.btn_num_4.clicked.connect(partial(self.numbers, 4)) 23 | self.ui.btn_num_5.clicked.connect(partial(self.numbers, 5)) 24 | self.ui.btn_num_6.clicked.connect(partial(self.numbers, 6)) 25 | self.ui.btn_num_7.clicked.connect(partial(self.numbers, 7)) 26 | self.ui.btn_num_8.clicked.connect(partial(self.numbers, 8)) 27 | self.ui.btn_num_9.clicked.connect(partial(self.numbers, 9)) 28 | self.ui.btn_num_0.clicked.connect(partial(self.numbers, 0)) 29 | 30 | self.ui.btn_tan.clicked.connect(self.tan_n) 31 | self.ui.btn_cot.clicked.connect(self.cot_n) 32 | self.ui.btn_sin.clicked.connect(self.sin_n) 33 | self.ui.btn_cos.clicked.connect(self.cos_n) 34 | self.ui.btn_sqrt.clicked.connect(self.sqrt_n) 35 | self.ui.btn_log.clicked.connect(self.log_n) 36 | self.ui.btn_AC.clicked.connect(self.AC_n) 37 | self.ui.btn_abc.clicked.connect(self.abc_n) 38 | self.ui.btn_dot.clicked.connect(self.dot) 39 | self.ui.btn_equal.clicked.connect(self.equal) 40 | 41 | def numbers(self, x): 42 | self.ui.text_box.setText(self.ui.text_box.text() + str(x)) 43 | 44 | def dot(self): 45 | if "." not in self.ui.text_box.text(): 46 | self.ui.text_box.setText(self.ui.text_box.text() + ".") 47 | 48 | def sum(self): 49 | self.num_1 = float(self.ui.text_box.text()) 50 | self.ui.text_box.setText("") 51 | self.chek_op = "+" 52 | def equl_sum(self): 53 | self.num_2 = float(self.ui.text_box.text()) 54 | self.ui.text_box.setText("") 55 | result = self.num_1 + self.num_2 56 | self.ui.text_box.setText(str(result)) 57 | def sub(self): 58 | self.num_1 = float(self.ui.text_box.text()) 59 | self.ui.text_box.setText("") 60 | self.chek_op = "-" 61 | def equl_sub(self): 62 | self.num_2 = float(self.ui.text_box.text()) 63 | self.ui.text_box.setText("") 64 | result = self.num_1 - self.num_2 65 | self.ui.text_box.setText(str(result)) 66 | def div(self): 67 | self.num_1 = float(self.ui.text_box.text()) 68 | self.ui.text_box.setText("") 69 | self.chek_op = "/" 70 | def equl_div(self): 71 | self.num_2 = float(self.ui.text_box.text()) 72 | self.ui.text_box.setText("") 73 | if self.num_1 == 0 or self.num_2 == 0: 74 | self.ui.text_box.setText("not / becuse 0") 75 | else: 76 | result = self.num_1 / self.num_2 77 | self.ui.text_box.setText(str(result)) 78 | def mul(self): 79 | self.num_1 = float(self.ui.text_box.text()) 80 | self.ui.text_box.setText("") 81 | self.chek_op = "*" 82 | def equl_mul(self): 83 | self.num_2 = float(self.ui.text_box.text()) 84 | self.ui.text_box.setText("") 85 | result = self.num_1 * self.num_2 86 | self.ui.text_box.setText(str(result)) 87 | def equal(self): 88 | if self.chek_op == "+": 89 | self.equl_sum() 90 | elif self.chek_op == "-": 91 | self.equl_sub() 92 | elif self.chek_op == "*": 93 | self.equl_mul() 94 | elif self.chek_op == "/": 95 | self.equl_div() 96 | else: 97 | self.ui.text_box.setText(self.ui.text_box.text()) 98 | 99 | def AC_n(self): 100 | self.ui.text_box.setText("") 101 | def tan_n(self): 102 | self.num_1 = float(self.ui.text_box.text()) 103 | self.ui.text_box.setText(str(math.tan(self.num_1))) 104 | def cot_n(self): 105 | self.num_1 = float(self.ui.text_box.text()) 106 | self.ui.text_box.setText(str(math.cos(self.num_1))) 107 | def sin_n(self): 108 | self.num_1 = float(self.ui.text_box.text()) 109 | self.ui.text_box.setText(str(math.sin(self.num_1))) 110 | def cos_n(self): 111 | self.num_1 = float(self.ui.text_box.text()) 112 | self.ui.text_box.setText(str(math.cos(self.num_1))) 113 | def sqrt_n(self): 114 | self.num_1 = float(self.ui.text_box.text()) 115 | self.ui.text_box.setText(str(math.sqrt(self.num_1))) 116 | def log_n(self): 117 | self.num_1 = float(self.ui.text_box.text()) 118 | self.ui.text_box.setText(str(math.log(self.num_1))) 119 | def abc_n(self): 120 | self.num_1 = float(self.ui.text_box.text()) 121 | self.abc = self.num_1 - self.num_1*2 122 | self.ui.text_box.setText(str(self.abc)) 123 | 124 | app = QApplication([]) 125 | window = HelloWorld() 126 | 127 | app.exec() 128 | -------------------------------------------------------------------------------- /assignment_14/main.py: -------------------------------------------------------------------------------- 1 | import arcade 2 | import time 3 | import random 4 | from player import Player 5 | from ground import Ground, Cloud, Cloud1, Cloud2, Cloud3, Cloud4, Cloud5 6 | from enemy import Enemy_Bee, Enemy_Co1, Enemy_Co2, Enemy_Co3, Enemy_Co4 7 | 8 | 9 | class Game(arcade.View): 10 | def __init__(self): 11 | self.w = 800 12 | self.h = 700 13 | self.speed = 3 14 | super().__init__() 15 | arcade.set_background_color(arcade.color.BABY_BLUE_EYES) 16 | self.player = Player() 17 | self.jump = arcade.load_sound(":resources:sounds/jump1.wav") 18 | self.background = arcade.load_texture("imgg/background_image.png") 19 | self.ground_list = arcade.SpriteList() 20 | self.cloud_list = arcade.SpriteList() 21 | self.cactoos_list = arcade.SpriteList() 22 | self.bee_list = arcade.SpriteList() 23 | self.score_max = 0 24 | self.count = 0 25 | self.gameover = False 26 | for ground in range(0,801,80): 27 | self.ground_list.append(Ground(ground,5)) 28 | self.physic = arcade.PhysicsEnginePlatformer(self.player,self.ground_list,gravity_constant=0.5) 29 | self.start_cactoos_time = time.time() 30 | self.start_bee_time = time.time() 31 | self.start_cloud_time = time.time() 32 | 33 | def on_draw(self): 34 | arcade.start_render() 35 | self.player.draw() 36 | for ground in self.ground_list: 37 | ground.draw() 38 | for cactoos in self.cactoos_list: 39 | cactoos.draw() 40 | for bee in self.bee_list: 41 | bee.draw() 42 | for cloud in self.cloud_list: 43 | cloud.draw() 44 | 45 | if self.count % 20 == 0: 46 | arcade.set_background_color(arcade.color.BABY_BLUE_EYES) 47 | elif self.count % 10 ==0: 48 | arcade.set_background_color(arcade.color.EERIE_BLACK) 49 | arcade.draw_text(f"| {self.player.score}",630,670,arcade.color.BLACK_BEAN,20, italic=True, bold=True) 50 | arcade.draw_text(f"HI: {max(max_list)}",500,670,arcade.color.BLACK_BEAN,20, italic=True, bold=True) 51 | 52 | if self.gameover == True: 53 | arcade.draw_lrwh_rectangle_textured(0,0,self.w,self.h,self.background) 54 | arcade.draw_text("Game Over",230,400,arcade.color.WHITE_SMOKE,50,bold=True) 55 | arcade.draw_text("Press *Space* to Play Agane",230,330,arcade.color.GOLDEN_YELLOW,20) 56 | arcade.draw_text("Press *Q* to Exit Game ",250,280,arcade.color.GOLDEN_YELLOW,20) 57 | time.sleep(2) 58 | 59 | def on_update(self, delta_time: float): 60 | self.player.score +=0.5 61 | self.down = False 62 | self.end_cactoos_time = time.time() 63 | self.Co1 = Enemy_Co1(self.w,self.speed) 64 | self.Co2 = Enemy_Co2(self.w,self.speed) 65 | self.Co3 = Enemy_Co3(self.w,self.speed) 66 | self.Co4 = Enemy_Co4(self.w,self.speed) 67 | self.cloud = Cloud 68 | self.cloud1 = Cloud1() 69 | self.cloud2 = Cloud2() 70 | self.cloud3 = Cloud3() 71 | self.cloud4 = Cloud4() 72 | self.cloud5 = Cloud5() 73 | if self.end_cactoos_time - self.start_cactoos_time > random.randint(3,6): 74 | self.cactoos_list.append(random.choice([self.Co1,self.Co2,self.Co3,self.Co4])) 75 | self.count +=1 76 | if self.count % 5 == 0: 77 | self.speed += 0.5 78 | self.start_cactoos_time = time.time() 79 | 80 | self.end_bee_time = time.time() 81 | if self.end_bee_time - self.start_bee_time > 17 and self.player.score > 1000: 82 | self.cloud_list.append(random.choice([self.cloud,self.cloud1,self.cloud2,self.cloud3,self.cloud4,self.cloud5])) 83 | self.bee = Enemy_Bee(self.w,self.speed) 84 | self.bee_list.append(self.bee) 85 | self.start_bee_time = time.time() 86 | self.physic.update() 87 | if not self.player.down: 88 | self.player.update_animation() 89 | else: 90 | self.player.manual_walkDown_animation() 91 | 92 | for bee in self.bee_list: 93 | bee.update() 94 | bee.update_animation() 95 | if bee.center_x < -30: 96 | self.bee_list.remove(bee) 97 | for cactoos in self.cactoos_list: 98 | cactoos.update() 99 | if cactoos.center_x < -30: 100 | self.cactoos_list.remove(cactoos) 101 | for cloud in self.cloud_list: 102 | cloud.update() 103 | if cloud.center_x < -30: 104 | self.cloud_list.remove(cloud) 105 | 106 | for cactoos in self.cactoos_list: 107 | if arcade.sprite_list.spatial_hash.check_for_collision(self.player,cactoos): 108 | self.gameover = True 109 | max_list.append(self.player.score) 110 | for bee in self.bee_list: 111 | if arcade.sprite_list.spatial_hash.check_for_collision(self.player,bee): 112 | self.gameover = True 113 | max_list.append(self.player.score) 114 | 115 | def on_key_press(self,key,modifiers): 116 | if key== arcade.key.UP: 117 | if self.physic.can_jump(): 118 | self.player.change_y = 18 119 | arcade.play_sound(self.jump) 120 | if key== arcade.key.SPACE: 121 | self.window.show_view(Game()) 122 | if key== arcade.key.DOWN: 123 | self.player.down = True 124 | if key== arcade.key.Q: 125 | arcade.exit() 126 | 127 | def on_key_release(self,key,_modifiers): 128 | self.player.walk_down_texture = self.player.down = False 129 | 130 | max_list = [0] 131 | window = arcade.Window(800,700,"Game") 132 | game = Game() 133 | window.show_view(game) 134 | arcade.run() -------------------------------------------------------------------------------- /assignment_17/main.py: -------------------------------------------------------------------------------- 1 | import random 2 | from functools import partial 3 | from PySide6.QtWidgets import * 4 | from PySide6.QtUiTools import * 5 | from PySide6.QtCore import * 6 | 7 | class TicTacToe(QMainWindow): 8 | def __init__(self): 9 | super().__init__() 10 | loader = QUiLoader() 11 | self.ui = loader.load("TicTacToe.ui", None) 12 | self.ui.show() 13 | self.game = [[self.ui.btn_1, self.ui.btn_2, self.ui.btn_3], 14 | [self.ui.btn_4, self.ui.btn_5, self.ui.btn_6], 15 | [self.ui.btn_7, self.ui.btn_8, self.ui.btn_9]] 16 | for i in range(3): 17 | for j in range(3): 18 | self.game[i][j].setText("") 19 | self.game[i][j].setStyleSheet("color: rgb(255, 255, 255); background-color:rgb(100, 100, 100)") 20 | self.game[i][j].clicked.connect(partial(self.Play, i, j)) 21 | self.ui.btn_new.clicked.connect(self.new_game) 22 | self.ui.btn_abt.clicked.connect(self.about) 23 | self.ui.btn_newscore.clicked.connect(self.new_score) 24 | self.player = "X" 25 | self.player_score = 0 26 | self.player2_score = 0 27 | def check(self): 28 | if ((self.game[0][0].text() == "X" and self.game[1][1].text() == "X" and self.game[2][2].text() == "X") or (self.game[0][2].text() == "X" and self.game[1][1].text() == "X" and self.game[2][0].text() == "X") or (self.game[0][0].text() == "X" and self.game[0][1].text() == "X" and self.game[0][2].text() == "X") or (self.game[1][0].text() == "X" and self.game[1][1].text() == "X" and self.game[1][2].text() == "X") or (self.game[2][0].text() == "X" and self.game[2][1].text() == "X" and self.game[2][2].text() == "X") or (self.game[0][0].text() == "X" and self.game[1][0].text() == "X" and self.game[2][0].text() == "X") or (self.game[0][1].text() == "X" and self.game[1][1].text() == "X" and self.game[2][1].text() == "X") or (self.game[0][2].text() == "X" and self.game[1][2].text() == "X" and self.game[2][2].text() == "X")): 29 | self.player_score += 1 30 | ms_box = QMessageBox() 31 | ms_box.setText("player 1 wins") 32 | self.ui.scorex.setText(str(self.player_score)) 33 | ms_box.exec() 34 | self.new_game() 35 | elif ((self.game[0][0].text() == "O" and self.game[1][1].text() == "O" and self.game[2][2].text() == "O") or (self.game[0][2].text() == "O" and self.game[1][1].text() == "O" and self.game[2][0].text() == "O") or (self.game[0][0].text() == "O" and self.game[0][1].text() == "O" and self.game[0][2].text() == "O") or (self.game[1][0].text() == "O" and self.game[1][1].text() == "O" and self.game[1][2].text() == "O") or (self.game[2][0].text() == "O" and self.game[2][1].text() == "O" and self.game[2][2].text() == "O") or (self.game[0][0].text() == "O" and self.game[1][0].text() == "O" and self.game[2][0].text() == "O") or (self.game[0][1].text() == "O" and self.game[1][1].text() == "O" and self.game[2][1].text() == "O") or (self.game[0][2].text() == "O" and self.game[1][2].text() == "O" and self.game[2][2].text() == "O")): 36 | self.player2_score += 1 37 | ms_box = QMessageBox() 38 | ms_box.setText("player2 win") 39 | self.ui.scoreo.setText(str(self.player2_score)) 40 | ms_box.exec() 41 | self.new_game() 42 | if self.game[0][0].text() != "" and self.game[0][1].text() != "" and self.game[0][2].text() != "" and self.game[1][0].text() != "" and self.game[1][1].text() != "" and self.game[1][2].text() != "" and self.game[2][0].text() != "" and self.game[2][1].text() != "" and self.game[2][2].text() != "": 43 | ms_box = QMessageBox() 44 | ms_box.setText("draw") 45 | ms_box.exec() 46 | self.new_game() 47 | def Play(self, i, j): 48 | if self.game[i][j].text() == "": 49 | if self.ui.btn_ptp.isChecked(): 50 | if self.player == "X": 51 | self.game[i][j].setText("X") 52 | self.game[i][j].setStyleSheet("color:rgb(0, 255, 127); background-color:qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(198, 0, 3, 255), stop:0.443182 rgba(255, 0, 127, 255), stop:0.5 rgba(198, 0, 3, 255), stop:0.534091 rgba(255, 0, 127, 255), stop:1 rgba(198, 0, 3, 255))") 53 | self.player = "O" 54 | else: 55 | self.game[i][j].setText("O") 56 | self.game[i][j].setStyleSheet("color:rgb(255, 255, 0); background-color:qlineargradient(spread:pad, x1:0, y1:0.0222727, x2:1, y2:1, stop:0 rgba(0, 10, 154, 255), stop:0.448864 rgba(101, 0, 159, 255), stop:0.482955 rgba(0, 10, 154, 255), stop:0.517045 rgba(101, 0, 159, 255), stop:1 rgba(0, 10, 154, 255))") 57 | self.player = "X" 58 | if self.ui.btn_ptc.isChecked(): 59 | if self.player == "X": 60 | self.game[i][j].setText("X") 61 | self.game[i][j].setStyleSheet("color:rgb(0, 255, 127); background-color:qlineargradient(spread:pad, x1:0, y1:1, x2:1, y2:0, stop:0 rgba(198, 0, 3, 255), stop:0.443182 rgba(255, 0, 127, 255), stop:0.5 rgba(198, 0, 3, 255), stop:0.534091 rgba(255, 0, 127, 255), stop:1 rgba(198, 0, 3, 255))") 62 | self.player = "O" 63 | if self.player == "O": 64 | while True: 65 | i = random.randint(0, 2) 66 | j = random.randint(0, 2) 67 | if self.game[i][j].text() == "": 68 | self.game[i][j].setText("O") 69 | self.game[i][j].setStyleSheet("color:rgb(255, 255, 0); background-color:qlineargradient(spread:pad, x1:0, y1:0.0222727, x2:1, y2:1, stop:0 rgba(0, 10, 154, 255), stop:0.448864 rgba(101, 0, 159, 255), stop:0.482955 rgba(0, 10, 154, 255), stop:0.517045 rgba(101, 0, 159, 255), stop:1 rgba(0, 10, 154, 255))") 70 | self.player = "X" 71 | break 72 | self.check() 73 | def about(self): 74 | ms_box = QMessageBox() 75 | ms_box.setText("Tic-Tac-Toe\n This Game using Pyside6\nprogram was developed by:\nnorozzadehyasin@gmail.com") 76 | ms_box.exec() 77 | def new_score(self): 78 | self.ui.scoreo.setText("0") 79 | self.ui.scorex.setText("0") 80 | self.player_score = 0 81 | self.player2_score = 0 82 | def new_game(self): 83 | for i in range(3): 84 | for j in range(3): 85 | self.game[i][j].setStyleSheet("color: rgb(255, 255, 255); background-color:rgb(100, 100, 100)") 86 | self.game[i][j].setText("") 87 | 88 | app = QApplication([]) 89 | window = TicTacToe() 90 | app.exec() 91 | -------------------------------------------------------------------------------- /assignment_16/form.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 498 10 | 202 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | background-color: rgb(0, 0, 0); 18 | 19 | 20 | 21 | 22 | 23 | 24 | background-color: rgb(255, 0, 0); 25 | 26 | 27 | 6 28 | 29 | 30 | 31 | 32 | 33 | 34 | background-color: rgb(255, 0, 0); 35 | 36 | 37 | 3 38 | 39 | 40 | 41 | 42 | 43 | 44 | background-color: rgb(255, 0, 0); 45 | 46 | 47 | 9 48 | 49 | 50 | 51 | 52 | 53 | 54 | background-color: rgb(255, 0, 0); 55 | 56 | 57 | 5 58 | 59 | 60 | 61 | 62 | 63 | 64 | background-color: rgb(255, 0, 0); 65 | 66 | 67 | 8 68 | 69 | 70 | 71 | 72 | 73 | 74 | background-color: rgb(255, 0, 0); 75 | 76 | 77 | 7 78 | 79 | 80 | 81 | 82 | 83 | 84 | background-color: rgb(255, 0, 0); 85 | 86 | 87 | 4 88 | 89 | 90 | 91 | 92 | 93 | 94 | background-color: rgb(255, 0, 0); 95 | 96 | 97 | 2 98 | 99 | 100 | 101 | 102 | 103 | 104 | background-color: rgb(255, 0, 0); 105 | 106 | 107 | 1 108 | 109 | 110 | 111 | 112 | 113 | 114 | background-color: rgb(255, 0, 0); 115 | 116 | 117 | 0 118 | 119 | 120 | 121 | 122 | 123 | 124 | background-color: rgb(255, 0, 0); 125 | 126 | 127 | . 128 | 129 | 130 | 131 | 132 | 133 | 134 | background-color: rgb(255, 0, 0); 135 | 136 | 137 | +/- 138 | 139 | 140 | 141 | 142 | 143 | 144 | background-color: rgb(255, 255, 0); 145 | background-color: rgb(170, 0, 255); 146 | 147 | 148 | cos 149 | 150 | 151 | 152 | 153 | 154 | 155 | background-color: rgb(85, 0, 0); 156 | 157 | 158 | AC 159 | 160 | 161 | 162 | 163 | 164 | 165 | background-color: rgb(85, 255, 0); 166 | 167 | 168 | = 169 | 170 | 171 | 172 | 173 | 174 | 175 | background-color: rgb(255, 255, 0); 176 | background-color: rgb(170, 0, 255); 177 | 178 | 179 | sin 180 | 181 | 182 | 183 | 184 | 185 | 186 | background-color: rgb(170, 0, 255); 187 | 188 | 189 | tan 190 | 191 | 192 | 193 | 194 | 195 | 196 | background-color: rgb(255, 255, 0); 197 | background-color: rgb(170, 0, 255); 198 | 199 | 200 | sqrt 201 | 202 | 203 | 204 | 205 | 206 | 207 | background-color: rgb(255, 255, 0); 208 | background-color: rgb(170, 0, 255); 209 | 210 | 211 | cot 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 0 220 | 0 221 | 222 | 223 | 224 | background-color: rgb(255, 255, 0); 225 | background-color: rgb(170, 0, 255); 226 | 227 | 228 | log 229 | 230 | 231 | 232 | 233 | 234 | 235 | background-color: rgb(0, 0, 255); 236 | background-color: rgb(255, 255, 0); 237 | 238 | 239 | + 240 | 241 | 242 | 243 | 244 | 245 | 246 | background-color: rgb(255, 255, 0); 247 | 248 | 249 | * 250 | 251 | 252 | 253 | 254 | 255 | 256 | background-color: rgb(255, 255, 0); 257 | 258 | 259 | / 260 | 261 | 262 | 263 | 264 | 265 | 266 | background-color: rgb(255, 255, 0); 267 | 268 | 269 | - 270 | 271 | 272 | 273 | 274 | 275 | 276 | background-color: rgb(0, 85, 0); 277 | background-color: rgb(0, 255, 255); 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 0 287 | 0 288 | 498 289 | 22 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | -------------------------------------------------------------------------------- /assignment_17/TicTacToe.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 462 10 | 394 11 | 12 | 13 | 14 | 15 | 0 16 | 0 17 | 18 | 19 | 20 | MainWindow 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 0 29 | 0 30 | 31 | 32 | 33 | 34 | 40 35 | true 36 | true 37 | false 38 | false 39 | true 40 | 41 | 42 | 43 | false 44 | 45 | 46 | background-color: rgb(170, 0, 255); 47 | border-radius: 17px 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 0 59 | 0 60 | 61 | 62 | 63 | 64 | 40 65 | true 66 | true 67 | false 68 | false 69 | true 70 | 71 | 72 | 73 | false 74 | 75 | 76 | background-color: rgb(170, 0, 255); 77 | border-radius: 17px 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 0 89 | 0 90 | 91 | 92 | 93 | 94 | 40 95 | true 96 | true 97 | false 98 | false 99 | true 100 | 101 | 102 | 103 | false 104 | 105 | 106 | background-color: rgb(170, 0, 255); 107 | border-radius: 17px 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 0 119 | 0 120 | 121 | 122 | 123 | 124 | 40 125 | true 126 | true 127 | false 128 | false 129 | true 130 | 131 | 132 | 133 | OpenHandCursor 134 | 135 | 136 | false 137 | 138 | 139 | background-color: rgb(170, 0, 255); 140 | border-radius: 17px 141 | 142 | 143 | 144 | 145 | 146 | true 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 0 155 | 0 156 | 157 | 158 | 159 | 160 | 40 161 | true 162 | true 163 | false 164 | false 165 | true 166 | 167 | 168 | 169 | false 170 | 171 | 172 | background-color: rgb(170, 0, 255); 173 | border-radius: 17px 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 0 185 | 0 186 | 187 | 188 | 189 | 👁about🤔 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 0 198 | 0 199 | 200 | 201 | 202 | 203 | 40 204 | true 205 | true 206 | false 207 | false 208 | true 209 | 210 | 211 | 212 | false 213 | 214 | 215 | background-color: rgb(170, 0, 255); 216 | border-radius: 17px 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 0 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 0 235 | 0 236 | 237 | 238 | 239 | 240 | 40 241 | true 242 | true 243 | false 244 | false 245 | true 246 | 247 | 248 | 249 | false 250 | 251 | 252 | background-color: rgb(170, 0, 255); 253 | border-radius: 17px 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 0 265 | 0 266 | 267 | 268 | 269 | player vs player 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 0 278 | 0 279 | 280 | 281 | 282 | 283 | 40 284 | true 285 | true 286 | false 287 | false 288 | true 289 | 290 | 291 | 292 | false 293 | 294 | 295 | background-color: rgb(170, 0, 255); 296 | border-radius: 17px 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | scores: 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 0 315 | 0 316 | 317 | 318 | 319 | 0 320 | 321 | 322 | Qt::AlignCenter 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 0 331 | 0 332 | 333 | 334 | 335 | player X ⇛ 336 | 337 | 338 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 0 347 | 0 348 | 349 | 350 | 351 | 352 | 40 353 | true 354 | true 355 | false 356 | false 357 | true 358 | 359 | 360 | 361 | false 362 | 363 | 364 | background-color: rgb(170, 0, 255); 365 | border-radius: 17px 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 0 377 | 0 378 | 379 | 380 | 381 | player vs computer 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 0 390 | 0 391 | 392 | 393 | 394 | player O ⇛ 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 0 403 | 0 404 | 405 | 406 | 407 | 408 | 20 409 | 410 | 411 | 412 | ✨new game✨ 413 | 414 | 415 | 416 | 417 | 418 | 419 | new score🎯 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 0 429 | 0 430 | 462 431 | 22 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | --------------------------------------------------------------------------------