I'm super new to python and programming in general. I made this using my computer knowledge to calculate the processing power and power draw of a computer based on the specifications of all the parts.
from termcolor import colored
#COLORS:
#Magenta - welcome/version/credits
#Cyan - questions
#Yellow - scores
#Red - errors
#orange - might use this color later
#green - Copyright
def start():
global type
print(colored("=-_"*50,"white",attrs=["blink"]))
print(colored("* Welcome to Spicy's Processing Power / TDP Calculator! (SPPTDPC) *", "magenta"))
print(colored("* Version Alpha 2.2 *", "magenta"))
print(colored("** This program is still in alpha stage and isn't perfect **", "magenta"))
print(colored("If you are unsure about one of the questions, look up the specs of the part on a website like PCPartPicker or TechPowerUP", "magenta"))
type = float(input(colored("Is your computer a laptop or desktop? 1 for laptop, 2 for desktop.", "cyan")))
cpu()
def cpu():
global r
global cpus
global cputdp
name = input(colored("What is the name of your processor?", "cyan"))
c = float(input(colored("How many cores does the "+name+" have?", "cyan")))
t = float(input(colored("How many threads does the "+name+" have?", "cyan")))
l1 = float(input(colored("How much L1 cache (in total) does the "+name+" have in KB?", "cyan")))
l2 = float(input(colored("How much L2 cache (in total) does the "+name+" have in MB?", "cyan")))
l3 = float(input(colored("How much L3 cache (in total) does the "+name+" have in MB?", "cyan")))
g = float(input(colored("What is the clock speed (in GHz) of the "+name+"?", "cyan")))
n = float(input(colored("What is the fabrication process of the "+name+" in nm?", "cyan")))
r = float(input(colored("What type of RAM does the "+name+" use? Enter 3 for DDR3, 4 for DDR4, etc.", "cyan")))
cputdp = float(input(colored("What is the TDP of the "+name+"? (in W)", "cyan")))
cpus = ((c+t+g+r+l2+(l1/100)+(.3*l3))/n)*type #CPU Processing Power Formula
print(colored("** The "+name+" has a score of "+str(cpus)+". **", "yellow"))
ram()
def ram():
global rtdp
global rams
g = float(input(colored("How much RAM does your system have (in GB?)", "cyan")))
m = float(input(colored("What is the speed of your slowest installed DIMM? (in MHz)", "cyan")))
rtdp = float(input(colored("How many DIMMs do you have installed?", "cyan")))
rtdp = rtdp*4
rams = ((r+(m/500))*g)/150 #RAM Processing Power Formula
print(colored("** Your RAM score is "+str(rams)+". **", "yellow"))
gpu()
def gpu():
gputest()
print(colored("** The "+gpuname+" has a score of "+str(gpus)+". **", "yellow"))
gputdp = float(input(colored("What is the TDP of the "+gpuname+"?", "cyan")))
def gputest():
global gpuname
global memtyp
global gputdp
gpuname = input(colored("What is the name of your GPU?", "cyan"))
memtyp = int(input(colored("What type of memory does your GPU use? 0 for GDDR, 1 for HBM", "cyan")))
gputdp = float(input(colored("What is the TDP of your GPU? (in W)", "cyan")))
if memtyp == 0:
gddr()
if memtyp == 1:
hbm()
def gddr():
global gpus
gc = float(input(colored("How many cores does the "+gpuname+" have?", "cyan")))
gt = float(input(colored("How many TMUs does the "+gpuname+" have?", "cyan")))
go = float(input(colored("How many ROPs does the "+gpuname+" have?", "cyan")))
gm = float(input(colored("How much memory (in MB) does the "+gpuname+" have?", "cyan")))
gr = float(input(colored("What type of memory does the "+gpuname+" have? Enter 3 for GDDR3, 5 for GDDR5, and 8 for GDDR5X (to account for its additional data rate)", "cyan")))
gb = float(input(colored("What is the bus width of the "+gpuname+"?", "cyan")))
gg = float(input(colored("What is the clock speed of the "+gpuname+" in GHz?", "cyan")))
gmg = float(input(colored("What is the effective memory speed of the "+gpuname+" in MHz?", "cyan")))
gn = float(input(colored("What is the fabrication process of the "+gpuname+" in nm?", "cyan")))
gpus = ((((gc/400)+(gt/25)+(go/10)+(gm/1000)+(gb/30)+(gg*2)+(gmg/1000))*((gr/gn)/25)))*type #GDDR GPU Processing Power Formula
drive()
def hbm():
global gpus
hgc = float(input(colored("How many cores does the "+gpuname+" have?", "cyan")))
hgt = float(input(colored("How many TMUs does the "+gpuname+" have?", "cyan")))
hgo = float(input(colored("How many ROPs does the "+gpuname+" have?", "cyan")))
hgm = float(input(colored("How much memory (in MB) does the "+gpuname+" have?", "cyan")))
hgr = float(input(colored("What type of HBM does the "+gpuname+" have? Enter 1 for HBM, 2 for HBM2, etc.", "cyan")))
hgb = float(input(colored("What is the bus width of the "+gpuname+"?", "cyan")))
hgg = float(input(colored("What is the clock speed of the "+gpuname+" in GHz?", "cyan")))
hgmg = float(input(colored("What is the effective memory speed of the "+gpuname+" in MHz?", "cyan")))
hgn = float(input(colored("What is the fabrication process of the "+gpuname+" in nm?", "cyan")))
gpus = (((hgc/400)+(hgt/25)+(hgo/10)+(hgm/1000)+(hgb/250)+(hgg*2)+(hgmg/150))/((hgr/hgn)/25))*type #HBM GPU Processing Power Formula
drive()
def drive():
print(colored("** The "+gpuname+" has a score of "+str(gpus)+". **", "yellow"))
global typ
typ = float(input(colored("Is your boot drive an HDD or SSD? Enter 1 for HDD, 2 for SSD.", "cyan")))
if typ == 1:
hdd()
if typ == 2:
ssd()
def hdd():
global free
global total
global hds
rpm = float(input(colored("What is the RPM of your HDD?", "cyan")))
free = float(input(colored("How much storage is available (not filled) on your boot drive (in GB)", "cyan")))
total = float(input(colored("What is the total amount of storage on your boot drive (in GB)", "cyan")))
freespace()
hds = (((1/p)*100)*(rpm/1000))/30 #HDD Processing Power Formula
drivetdp()
def ssd():
global free
global total
global hds
free = float(input(colored("How much storage is available (not filled) on your boot drive (in GB)", "cyan")))
total = float(input(colored("What is the total amount of storage on your boot drive (in GB)", "cyan")))
freespace()
hds = ((((1/p)*100)*5)*typ)/30 #SSD Processing Power Formula
drivetdp()
def freespace():
global p
p = (free/total)*100
print(colored("* Your boot drive is "+str(p)+"% free. *", "yellow"))
def drivetdp():
global ssdtdp
global hddtdp
ssdtdp = float(input(colored("How many SSDs do you have installed in your system?", "cyan")))
ssdtdp = ssdtdp*3.25
hddtdp = float(input(colored("How many HDDs do you have installed in your system?", "cyan")))
hddtdp = hddtdp*8
print(colored("** Your boot drive's score is "+str(hds)+". **", "yellow"))
final()
def final():
global fns
global tdp
global psu
global fantdp
fns = (cpus+gpus+hds+rams) #Final Score Formula
dvdtdp = float(input(colored("How many optical drives do you have installed?", "cyan")))
dvdtdp = dvdtdp*10*type #1 ODD draws around 20 watts, I'm assuming laptop ODDs use half of that.
if type == 2:
fantdp = float(input(colored("How many case fans do you have installed? (counting CPU cooler)", "cyan")))
fantdp = fantdp*5 #1 120mm fan draws around 5 watts
if type == 1:
fantdp = 0
usbtdp = float(input(colored("How many USB ports does your computer have? (in total)", "cyan")))
usbtdp = usbtdp*2.5 #USB can only pull 2.5 watts
tdp = (((cputdp+gputdp)*(4/5))+rtdp+hddtdp+ssdtdp+dvdtdp+fantdp+usbtdp)+50 #estimated max load TDP equation, the +50 watts is for the motherboard
psu = cputdp+gputdp+rtdp+hddtdp+ssdtdp+dvdtdp+usbtdp+50 #max spec TDP equation
print(colored("Calculating final score...", "magenta"))
print(colored("** Your final score is... **", "yellow"))
print(str(fns))
print(colored("** Your predicted maximum load wattage is... **", "yellow"))
print(str(tdp)+" Watts")
print(colored("** I would recommend using a power supply of at least "+str(psu)+" watts. **", "yellow"))
print(colored("Thank you for using SPPC!", "magenta"))
print(colored("Copyright NFR 2018", "green", attrs=["blink"]))
print(colored("=-_"*50,"white",attrs=["blink"]))
again()
def again():
again = input(colored("Do you want to use the calculator again? Y/N", "cyan"))
if again == "Y":
start()
start()
#Copyright NFR 2018