From 169e85b5fa63c391e11c79d13c2afd30bf9932c8 Mon Sep 17 00:00:00 2001 From: Lyx Date: Thu, 20 Mar 2025 19:16:37 +0100 Subject: [PATCH] Initial commit --- .gitignore | 0 README.md | 0 __pycache__/alphabet.cpython-312.pyc | Bin 0 -> 894 bytes __pycache__/functions.cpython-312.pyc | Bin 0 -> 820 bytes __pycache__/wordList.cpython-312.pyc | Bin 0 -> 894 bytes __pycache__/wordlist.cpython-312.pyc | Bin 0 -> 734 bytes alphabet.py | 31 ++++++++++++++++++++++++++ functions.py | 25 +++++++++++++++++++++ gamemodes.py | 23 +++++++++++++++++++ main.py | 4 ++++ wordlist.py | 24 ++++++++++++++++++++ 11 files changed, 107 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 __pycache__/alphabet.cpython-312.pyc create mode 100644 __pycache__/functions.cpython-312.pyc create mode 100644 __pycache__/wordList.cpython-312.pyc create mode 100644 __pycache__/wordlist.cpython-312.pyc create mode 100644 alphabet.py create mode 100644 functions.py create mode 100644 gamemodes.py create mode 100644 main.py create mode 100644 wordlist.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/__pycache__/alphabet.cpython-312.pyc b/__pycache__/alphabet.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d58f285a41d9188e6331c49adc264b4f6c26cd71 GIT binary patch literal 894 zcmZwFJ#W)c6b9gXlcsS}CvB5{r5|b2w52Xk$1{k58Fgb}b2%mn&f@_!;Dft`AfRW7T0fq z_o}N%k$$HsLs{eu<&d+KM> z0K*ox;cb&9z;6_!GeICt@~C_XNE#5MN1c!Rwu-eT9q+w2{2gS{(mviDT6 WdR3_W|G=f>_;m-PubsGo|KJ~PM&tth^;C=Jv&G){yGjG2X3L}8__UXwwp#VSC zCNtcpHn@Y!5jfxw7d)r|Q89IiM{Cs6Y8vjfS5VU(9WfW>EaR6dw1~{x?)HYg%0i1u zLqsBE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ordlist.cpython-312.pyc b/__pycache__/wordlist.cpython-312.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0597322f8f6f62f3edea29296b3b839495a03a3b GIT binary patch literal 734 zcmXw#yN=W_7=@ilJlDZI6(kMo8Pzd1G&4k=VgbK+_=6O*s+;4J}AK z3gQJu76lU3P(^G<#czjoq)%UtkCQ+79)?{6>)Y9n_=|_oFMD&fTL0zp9mq$-5k=Jd z;L(Po?-)2@$0lvTZricr*mdmDBgjL?zT?1gNJo&59Vd=c#~Ho4=AZCq?#JV zNO6D>k@2aFO>n_=Vlc_`l$qe1q^ZG)EHyhcY^SNCM9S0zg<{M!FBE5jnsy|!yeybH z__ox`m5de1GA?4%PKk(15;N0^5+1!`!gL~*vU5cWb_i_0O}UVol*)ATgr`!=JlQ}i zfwwaevjc|K3Y)MLlqp>h0SDm8rQmPio|!O`LPs3N6ijQ=%Se$h0FSikXFO68CW>H7 zsuwHI;I~py{S{rpW6|FS>qKU3oe>ICiM3+6)az$l5Vd&@qpxi_<+^y3Z%q4fCTW?n zCu#{t?O)Ts0hRB0Ue#E18vCHLJ*|AOpUyB?)kL_reOk4ww-G+to>d*|-8%1CKdST4 zdLQ9%OR9nOVci*7AJ_TB`V`^8&Z}nD=LnB?r`5vxah+eYejVZd_H}i``b~s~yHRz^ u`t7=NV*L)nqusJvTEAO&?peQ&=8OGsw4crQlj(lG`126b_gJ04=l%n#^xOad literal 0 HcmV?d00001 diff --git a/alphabet.py b/alphabet.py new file mode 100644 index 0000000..719517a --- /dev/null +++ b/alphabet.py @@ -0,0 +1,31 @@ +alphabet = { + "a": "(00001)", + "b": "(00010)", + "c": "(00011)", + "d": "(00100)", + "e": "(00101)", + "f": "(00110)", + "g": "(00111)", + "h": "(01000)", + "i": "(01001)", + "j": "(01010)", + "k": "(01011)", + "l": "(01100)", + "m": "(01101)", + "n": "(01110)", + "o": "(01111)", + "p": "(10000)", + "q": "(10001)", + "r": "(10010)", + "s": "(10011)", + "t": "(10100)", + "u": "(10101)", + "v": "(10110)", + "w": "(10111)", + "x": "(11000)", + "y": "(11001)", + "z": "(11010)", + "æ": "(11011)", + "ø": "(11100)", + "å": "(11101)" +} diff --git a/functions.py b/functions.py new file mode 100644 index 0000000..7aa61f0 --- /dev/null +++ b/functions.py @@ -0,0 +1,25 @@ +from alphabet import alphabet +from os import system, name + + +def binarian(word): + wordBin = "" + word = word.lower() + for letter in word: + if letter in alphabet.keys(): + wordBin += alphabet[letter] + elif letter == " ": + wordBin += " " + else: + wordBin += letter + return wordBin + +def clear(): + + # for windows + if name == 'nt': + _ = system('cls') + + # for mac and linux(here, os.name is 'posix') + else: + _ = system('clear') \ No newline at end of file diff --git a/gamemodes.py b/gamemodes.py new file mode 100644 index 0000000..23eaca6 --- /dev/null +++ b/gamemodes.py @@ -0,0 +1,23 @@ +from wordlist import words +import random +from os import system, name +from functions import binarian +from functions import clear + +def norToBin(level): + wordsInLevel = [] + for word, word_level in words.items(): + if word_level == level: + wordsInLevel.append(word) + word = random.choice(wordsInLevel) + correctTranslation = binarian(word) + + print(f'Translate {word} into binary!') + userIn = input("Write anwser\n>") + clear() + if userIn == correctTranslation: + print(f'Yes the word {word} does translate to {userIn}!') + else: + print(f'No, the word {word} translates to {correctTranslation}. Better study some more!') + +norToBin(2) \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..aa706d6 --- /dev/null +++ b/main.py @@ -0,0 +1,4 @@ +from functions import binarian +from alphabet import alphabet + +print(binarian("I am making duolingo for binary")) \ No newline at end of file diff --git a/wordlist.py b/wordlist.py new file mode 100644 index 0000000..a86c0f6 --- /dev/null +++ b/wordlist.py @@ -0,0 +1,24 @@ +words = { + "cat": 1, + "dog": 1, + "fish": 1, + "apple": 1, + "ball": 1, + "house": 2, + "school": 2, + "tree": 2, + "friend": 2, + "computer": 3, + "programming": 3, + "language": 3, + "chicken": 3, + "celebrate": 4, + "dinosaur": 4, + "philosophy": 4, + "challenge": 4, + "understanding": 5, + "universe": 5, + "consciousness": 5, + "mathematics": 5, + "microprocessor": 5 +}