Skip to content

Commit

Permalink
Version: 0.1.4.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel-de-Oliveira committed Oct 5, 2021
1 parent 3f2cf3a commit 5dcadd8
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---
Expand All @@ -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!
8 changes: 5 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
123 changes: 73 additions & 50 deletions lib/Shufflers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -29,43 +34,45 @@ def Salete(size):
break
if m == 3:
old = m
moves.append('L') # Left
moves.append('F') # Front
break
if m == 4:
old = m
moves.append('D') # Down
break
if m == 5:
old = m
moves.append('F') # Front
moves.append('L') # Left
break
if m == 6:
old = m
moves.append('B') # Back
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:
Expand All @@ -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)

Expand Down Expand Up @@ -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

17 changes: 10 additions & 7 deletions lib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}')

Expand All @@ -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=' ')

Expand All @@ -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='')
Expand All @@ -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

Expand All @@ -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.')
Expand Down
5 changes: 4 additions & 1 deletion uninstall.sh
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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

0 comments on commit 5dcadd8

Please sign in to comment.