Skip to content

Commit

Permalink
Simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellShibilski-Unkel committed Mar 6, 2024
1 parent 4d09480 commit 578e2e5
Show file tree
Hide file tree
Showing 28 changed files with 219 additions and 104 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42 changes: 42 additions & 0 deletions Algorthmic_Tests/gobalAlgTest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from Algorthmic_Tests import primeCounter
from Algorthmic_Tests import waveFunction
import time


def algorithmTest():
startTimer = time.process_time()
startTimer2 = time.process_time()

hundred = primeCounter.primeCounter(101)

endTimer2 = time.process_time()

startTimer3 = time.process_time()

thousand = primeCounter.primeCounter(1001)

endTimer3 = time.process_time()

startTimer4 = time.process_time()

tenthousand = primeCounter.primeCounter(10001)

endTimer4 = time.process_time()

startTimer5 = time.process_time()

waveFunction.waveFunc(1000)

endTimer5 = time.process_time()

endTimer = time.process_time()

pointList = []

pointList.append((endTimer2 - startTimer2) // 0.0005 * 0.1)
pointList.append((endTimer3 - startTimer3) // 0.0005 * 0.1)
pointList.append((endTimer4 - startTimer4) // 0.0005 * 0.1)
pointList.append((endTimer5 - startTimer5) // 0.0005 * 0.1)
pointList.append(sum(pointList) + (endTimer - startTimer) // 10)

return pointList[-1]
50 changes: 1 addition & 49 deletions Algorthmic_Tests/primeCounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,4 @@ def primeCounter(countUpTo):
else:
primeList.append(i)

print(primeList)

# --- Primes to 100 --- #
# Start timer
startTimer = time.perf_counter()
startTimer2 = time.process_time()

primeCounter(101)

endTimer = time.perf_counter()
endTimer2 = time.process_time()

print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s")

# --- Primes to 1000 --- #
# Start timer
startTimer = time.perf_counter()
startTimer2 = time.process_time()

primeCounter(1001)

endTimer = time.perf_counter()
endTimer2 = time.process_time()

print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s")

# --- Primes to 10000 --- #
# Start timer
startTimer = time.perf_counter()
startTimer2 = time.process_time()

primeCounter(10001)

endTimer = time.perf_counter()
endTimer2 = time.process_time()

print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s")

# --- Primes to 1000000 --- #
# Start timer
startTimer = time.perf_counter()
startTimer2 = time.process_time()

primeCounter(1000001)

endTimer = time.perf_counter()
endTimer2 = time.process_time()

print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s")
print(primeList)
10 changes: 1 addition & 9 deletions Algorthmic_Tests/waveFunction.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,4 @@ def waveFunc(loopNum):
step2 = float((i * h) * (2 / 2 * t))

# Get the final value
print(f"SE: {step1 - step2}\n")

# Run the function with a specific amount of times it will have to repeat the loop
waveFunc(None)

endTimer = time.perf_counter()
endTimer2 = time.process_time()

print(f"Task Finished In Performance: {endTimer - startTimer:0.8f}s\nTask Finished In Process/CPU/Kernel + User Space: {endTimer2 - startTimer2:0.8f}s")
print(f"SE: {step1 - step2}\n")
Binary file not shown.
26 changes: 16 additions & 10 deletions General_Computer_Info/generalSpecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import platform
import psutil
import numpy as np
import cpuinfo


# CPU Core Count
Expand All @@ -27,6 +28,10 @@ def phyicalCoresCPU():
# Logical CPU Cores
def logicalCoresCPU():
print(psutil.cpu_count(False))

# CPU Info
def CPU():
return cpuinfo.get_cpu_info()["brand_raw"]

# Overall CPU Usage
def CPUsage():
Expand All @@ -41,13 +46,14 @@ def RAMUsage():
def swapMemory():
swap = np.round(psutil.swap_memory().used/1000000000, 1)
print(f"Swap Memory: {swap} GB")

cpuCoreCount()
processorType()
OS()
computerArchitecture()
phyicalCoresCPU()
logicalCoresCPU()
CPUsage()
RAMUsage()
swapMemory()

def runALl():
cpuCoreCount()
processorType()
OS()
computerArchitecture()
phyicalCoresCPU()
logicalCoresCPU()
CPUsage()
RAMUsage()
swapMemory()
File renamed without changes.
File renamed without changes.
21 changes: 21 additions & 0 deletions ScoringSys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from Algorthmic_Tests import gobalAlgTest
from Simple_Tests import simpleTests
from Sorting_Tests import sortingTest
from General_Computer_Info import generalSpecs
import time
import numpy as np

def allTests(l = [], a = 0, b = 0, l2 = []):
startTimer = time.process_time()

alg = gobalAlgTest.algorithmTest()
sim = simpleTests.simpleTest(l, a, b)
s = sortingTest.sortingTest(l2)

endTimer = time.process_time()

totalTime = (endTimer - startTimer)

totalPoints = (alg + sim + s) // totalTime * 0.1

return str(f"Your {generalSpecs.CPU()} Has A Total Points Of: {np.round(totalPoints, 2)} | Total Time: {totalTime}s | Algorithm Test Points: {alg} | Simple Test Points: {sim} | Sorting Test Points: {s}")
Binary file not shown.
Binary file not shown.
Binary file added Simple_Tests/__pycache__/forTest.cpython-310.pyc
Binary file not shown.
Binary file added Simple_Tests/__pycache__/simpleTests.cpython-310.pyc
Binary file not shown.
25 changes: 13 additions & 12 deletions Simple_Tests/allBasicMath.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,23 @@
sNum = random.randint(0, 9)

# ---- Do math ----#
# Add
addValue = int(fNum + sNum)
def math(a, b):
# Add
addValue = int(a + b)

# Subtract
subValue = int(fNum - sNum)
# Subtract
subValue = int(a - b)

# Multiply
multValue = int(fNum * sNum)
# Multiply
multValue = int(a * b)

# Divide
if fNum == 0 or sNum == 0:
divideValue = 0
else:
divideValue = float(fNum / sNum)
# Divide
if a == 0 or sNum == 0:
divideValue = 0
else:
divideValue = float(a / b)

print(addValue, subValue, multValue, divideValue)
print(addValue, subValue, multValue, divideValue)

endTimer = time.perf_counter()
endTimer2 = time.process_time()
Expand Down
25 changes: 13 additions & 12 deletions Simple_Tests/forBreakTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,20 @@
theList = ["a", "b", "i", "c", "d", "e", "n", "h", "j", ".", "m", "n", "l", "o", "t", "."]

# Start "for" loop to separate values in the list, theList
separation = "."
tempList = []
finalList = []
for i in theList:
if i == ".":
tempList.append(i)
finalList.append(tempList)
tempList = []
else:
tempList.append(i)
def forLoop(l):
separation = "."
tempList = []
finalList = []
for i in theList:
if i == ".":
tempList.append(i)
finalList.append(tempList)
tempList = []
else:
tempList.append(i)

# Append tempList to finalList
finalList.append(tempList)
# Append tempList to finalList
finalList.append(tempList)

endTimer = time.perf_counter()
endTimer2 = time.process_time()
Expand Down
15 changes: 9 additions & 6 deletions Simple_Tests/forTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
theList = ["a", "b", "i", "c", "d", "e", "n", "h", "j", ".", "m", "n", "l", "o", "t", "."]

# Start "for" loop
for i in theList:
if i != ".":
continue
else:
print(i)
break
def forLoop(l):
for i in l:
if i != ".":
continue
else:
print(i)
break

forLoop(theList)

endTimer = time.perf_counter()
endTimer2 = time.process_time()
Expand Down
42 changes: 42 additions & 0 deletions Simple_Tests/simpleTests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
from Simple_Tests import allBasicMath, forBreakTest, forTest
import time


def simpleTest(listInput, num1, num2):
startTimer = time.process_time()
startTimer2 = time.process_time()

allBM = allBasicMath.math(num1, num2)

endTimer2 = time.process_time()

startTimer3 = time.process_time()

for1 = forTest.forLoop(listInput)

endTimer3 = time.process_time()

startTimer4 = time.process_time()

for2 = forBreakTest.forLoop(listInput)

endTimer4 = time.process_time()

endTimer = time.process_time()

pointList = []

pointList.append((endTimer2 - startTimer2) * 0.0005)
pointList.append((endTimer3 - startTimer3) * 0.0005)
pointList.append((endTimer4 - startTimer4) * 0.0005)

points = sum(pointList)

if points == 0:
points = 1
else:
points = 0

pointList.append(points + (endTimer - startTimer) * 0.1)

return pointList[-1]
Binary file added Sorting_Tests/__pycache__/bubbleSort.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file added Sorting_Tests/__pycache__/mergeSort.cpython-310.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 4 additions & 1 deletion Sorting_Tests/bubbleSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
theList = [None]

# Run sort
print(theList.sort())
def bubbleSort(l = []):
return l.sort()

print(bubbleSort)

endTimer = time.perf_counter()
endTimer2 = time.process_time()
Expand Down
4 changes: 2 additions & 2 deletions Sorting_Tests/greatestAndLeastSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# --- Merge Sort --- #
sortedList = []
def mergeSort(array = []):
def gtolSort(array = []):
# --- Least to greatest --- #
# Get each side their vars
leftSum = len(array) // 2
Expand Down Expand Up @@ -44,7 +44,7 @@ def mergeSort(array = []):
print(sorted(sortedArray))
print(sorted(sortedArray, reverse=True))

mergeSort(theList)
gtolSort(theList)

endTimer = time.perf_counter()
endTimer2 = time.process_time()
Expand Down
9 changes: 6 additions & 3 deletions Sorting_Tests/selectionSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
sortedList = []
def selectionSort(array = []):
for arr in range(len(array)):
arrMin = min(array)
sortedList.append(arrMin)
listOfNums.remove(arrMin)
try:
arrMin = min(array)
sortedList.append(arrMin)
listOfNums.remove(arrMin)
except Exception:
pass

# Give list to the func/algorithm
selectionSort(listOfNums)
Expand Down
Loading

0 comments on commit 578e2e5

Please sign in to comment.