diff --git a/Main.py b/Main.py index 77d3baa..0b31dec 100644 --- a/Main.py +++ b/Main.py @@ -3,7 +3,7 @@ import json consoleClear() -print('CanUseTimer\'s version: 0.1.4.2 BETA.\n' +print('CanUseTimer\'s version: 0.1.4.3 BETA.\n' 'This software is open to free use and study code,\n' 'for more info: https://github.com/samuel-de-oliveira/CanUseTimer.\n') diff --git a/README.md b/README.md index 502f206..60e9193 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,10 @@ lot :wink:. You can too see our website: [**Fast link!**](https://samuel-de-oliveira.github.io/CanUseTimer-Web/) --- -## Release notes (0.1.4.2) 🗒️ +## Release notes (0.1.4.3) 🗒️ -- Setting manager added; -- timer's completion more accurated; -- New modality added (4x4x4 Cube); +- Modalities shufflers updated; +- New modalities added (5x5x5 Cube and skewb); - Bug fixes. --- @@ -48,7 +47,7 @@ You can too see our website: [**Fast link!**](https://samuel-de-oliveira.github. --- --- -**Version: 0.1.4.2 BETA** +**Version: 0.1.4.3 BETA** ##### Created by: *Samuel de Oliveira 2021* ##### follow me for more! diff --git a/install.sh b/install.sh index afbbe5d..be1bac3 100755 --- a/install.sh +++ b/install.sh @@ -1,10 +1,11 @@ #!/usr/bin/bash #-*-------------- The installer for GNU/Linux --------------*-# - +clear echo -e "\nThis program will install the following packages:\n\ CanUseTimer-Terminal, keyboard_python_lib" echo -e "and will create a folder in /opt/" -echo -e "\nEstimated space used: 125Kb\nVersion of Program: 0.1.4.2\nAre you sure you want to install? [Y/n]:"; read num +echo -e "\nEstimated space used: 125Kb\nVersion of Program: 0.1.4.3\nAre you sure you want to install? [Y/n]:"; read num +clear if [ $num == 'y' ] || [ $num == 'Y' ]; then @@ -30,7 +31,8 @@ if [ $num == 'y' ] || [ $num == 'Y' ]; then sudo cp -rf lib/ /opt/CanUseTimer/ echo -e "\nEverything is done!\n" - + echo "Press return to exit..."; read + clear else echo "abort!" fi diff --git a/lib/Shufflers.py b/lib/Shufflers.py index 5edfdd3..329fea9 100644 --- a/lib/Shufflers.py +++ b/lib/Shufflers.py @@ -5,18 +5,23 @@ #-*-------------- Salete shuffler --------------*-# # # # This shuffler work in: 2x2 and 3x3 puzzles # -# to use in 3x3 then size=20 # -# to 2x2 then size=9 # -# this arguments are in lib.py file # -# Version of salete: 1.0 # +# the arguments are in lib/__init__.py file # +# Version of salete: 1.1 # # # #-*---------------------------------------------*-# -def Salete(size): +def Salete(cube): moves = [] # Letters enter here old = 0 # variable to not repeat letter - for move in range(1, 1+size): + if cube == '2x2': + size = 10 + w = 3 + else: + size = 21 + w = 6 + + for move in range(1, size): while True: - m = randint(1, 6) # the cube have 6 moves these are: + m = randint(1, w) # the cube have 6 moves these are: if not m == old: if m == 1: @@ -29,7 +34,7 @@ def Salete(size): break if m == 3: old = m - moves.append('L') # Left + moves.append('F') # Front break if m == 4: old = m @@ -37,7 +42,7 @@ def Salete(size): break if m == 5: old = m - moves.append('F') # Front + moves.append('L') # Left break if m == 6: old = m @@ -45,27 +50,29 @@ def Salete(size): break # Here is to add apostruphe('), two(2) to the letters randomly - for letter in range(0, size): + for letter in range(0, size - 1): x = randint(1, 3) if x == 1: moves[letter] = f'{moves[letter]}\'' # add apostrophe if x == 2: moves[letter] = f'{moves[letter]}2' # add two if x == 3: pass # do nothing "\_(シ)_/" return moves -#-*-------------- Cida shuffler --------------*-# -# # -# This shuffler work in: pyranmix # -# To use then size=4 # -# this arguments are in lib/__init__ file # -# Version of Cida: 1.0 # -# # -#-*-------------------------------------------*-# -def Cida(size, corner): +#-*--------------- Cida shuffler ---------------*-# +# # +# This shuffler work in: pyranmix and skewb # +# The arguments are in lib/__init__.py file # +# Version of Cida: 1.1 # +# # +#-*---------------------------------------------*-# +def Cida(cube): moves = [] # Letters enter here old = 0 # variable to not repeat letter - for move in range(1, 1+size): + + if cube == 'pyra': w = 11 + else: w = 9 + for move in range(1, 10): while True: - m = randint(1, 4) # the pyranmix have 4 initial moves these are: + m = randint(1, 4) # the pyranmix and skewb have 4 initial moves these are: if not m == old: if m == 1: @@ -85,39 +92,51 @@ def Cida(size, corner): moves.append('B') # Back break - for move in range(1, 1+corner): - while True: - m = randint(1, 4) # the pyranmix have 4 final moves these are: + if cube == 'pyra': + for move in range(1, 4): + while True: + m = randint(1, 5) # the pyranmix have 4 cap moves these are: - if not m == old: - if m == 1: - old = m - moves.append('u') # Up tip - break - if m == 2: - old = m - moves.append('r') # Right - break - if m == 3: - old = m - moves.append('l') # Left - break - if m == 4: - old = m - moves.append('b') # Back - break + if not m == old: + if m == 1: + old = m + moves.append('u') # Up Cap + break + if m == 2: + old = m + moves.append('r') # Right + break + if m == 3: + old = m + moves.append('l') # Left + break + if m == 4: + old = m + moves.append('b') # Back + break # Here is to add apostruphe(') to the letters randomly - for letter in range(0, size + corner): + for letter in range(0, w): x = randint(1, 2) if x == 1: moves[letter] = f'{moves[letter]}\'' # add apostrophe if x == 2: pass # do nothing "\_(シ)_/" return moves -def Lucia(size): +#-*---------------- Lucia shuffler ---------------*-# +# # +# This shuffler work in: 4x4 and 5x5 puzzles. # +# The arguments are in lib/__init__.py file # +# Version of Lucia: 1.0 # +# # +#-*-----------------------------------------------*-# + +def Lucia(cube): moves = [] old = 0 - for move in range(1, 1+size): + if cube == '4x4': size = 41 + else: size = 61 + + for move in range(1, size): while True: m = randint(1, 6) @@ -146,16 +165,20 @@ def Lucia(size): old = m moves.append('B') break - for letter in range(0, size): - x = randint(1, 3) - if moves[letter] in 'RFU': + for letter in range(0, size-1): + x = randint(1, 2) + if cube == '4x4': + if moves[letter] in 'RFU': + if x == 1: moves[letter] = f'{moves[letter]}w' # add 'w' + if x == 2: pass # do nothing "\_(シ)_/" + else: if x == 1: moves[letter] = f'{moves[letter]}w' - if x == 2: moves[letter] = f'{moves[letter]}w2' - if x == 3: pass # do nothing "\_(シ)_/" + if x == 2: pass # do nothing "\_(シ)_/" x = randint(1, 3) if x == 1: moves[letter] = f'{moves[letter]}\'' # add apostrophe - if x == 2: moves[letter] = f'2{moves[letter]}' # add two + if x == 2: moves[letter] = f'{moves[letter]}2' # add two if x == 3: pass # do nothing "\_(シ)_/" return moves + diff --git a/lib/__init__.py b/lib/__init__.py index 44c07f4..19c3923 100644 --- a/lib/__init__.py +++ b/lib/__init__.py @@ -40,7 +40,7 @@ def showAverage(): for t in timesSave: timesUse += float(t) timesUse -= float(max(timesSave)) timesUse -= float(min(timesSave)) - timesUse /= 3 + timesUse /= len(timesSave) - 2 return float(f'{timesUse:.2f}') @@ -67,7 +67,7 @@ def settingManager(): break def defModality(modality): - modals = ('3x3', '2x2', '4x4', 'pyra') + modals = ('3x3', '2x2', '4x4', '5x5', 'pyra', 'skewb') print('All modalities:', end='') for m in modals: print(f' {m}', end=' ') @@ -85,10 +85,12 @@ def defModality(modality): return modality def startTimer(modality): - modalities = {'3x3': Salete(size=20), - '2x2': Salete(size=10), - '4x4': Lucia(size=30), - 'pyra': Cida(size=9, corner=4)} + modalities = {'3x3': Salete('3x3'), + '2x2': Salete('2x2'), + '4x4': Lucia('4x4'), + '5x5': Lucia('5x5'), + 'pyra': Cida('pyra'), + 'skewb': Cida('skewb')} print(f'The actual modality is: {modality}\n' 'Scrable: ', end='') @@ -105,6 +107,7 @@ def startTimer(modality): totalTime = time() - timer if is_pressed('space'): break consoleClear() + if is_pressed('space'): break window(timeFormat(totalTime)) if is_pressed('space'): break @@ -120,7 +123,7 @@ def startTimer(modality): print('_-_-_-_-_-_- Times -_-_-_-_-_-_') for n, t in enumerate(timesSave): print(f'{n+1} - {timeFormat(t)}') print('_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_') - print(f'Average: {timeFormat(showAverage())}') + print(f'Average of 5: {timeFormat(showAverage())}') break else: print('The timer not start, you need press until 0.85secs.') diff --git a/uninstall.sh b/uninstall.sh index 549d5bc..219fdb6 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,7 +1,9 @@ #!/bin/bash #-*------------------ The CanUseTimer Uninstaller ------------------*-# +clear echo -e "\nEverything in /opt/CanUseTimer will be removed, are you sure? [Y/n]"; read num +clear if [ $num == 'y' ] || [ $num == 'Y' ]; then @@ -18,7 +20,8 @@ if [ $num == 'y' ] || [ $num == 'Y' ]; then sudo rm -rf /opt/CanUseTimer/ fi echo -e "\nEverything is removed!\n" - + echo "Press return to exit..."; read + clear else echo "Abort!" fi