I tried to make these instructions as simple and concise as possible for a person that doesn’t know anything other than how to open a browser. How to run this:
Windows: Download Notepad++. Download Python 2.7. Paste the code into Notepad++. Go to the Edit menu, hover over the EOL conversion button and click ‘Unix/OSX’ if it is not already selected. Save it in your C:\Python27 folder as normcalculator.py. Open a command line (search for ‘cmd’ in your programs). Type in ‘cd C:\Python27’ and press enter. Type in ‘python normcalculator.py’ and press enter. Follow the prompts.
Mac: Do the same as above, but you should download TextWrangler instead of Notepad++ and you don’t need to do the EOL conversion. Save it to wherever you installed Python. Instead of searching for ‘cmd’ to open a command line, run the ‘Terminal’ application on your Launchpad.
Linux: You probably don’t need my help.
If anyone finds errors (or problems with my instructions, it’s been a while since I set up Python from scratch and tried to run something), please let me know.
1200 corresponds to a 4-norm, 1400 to a 3, 1600 to a 2, 1800 to a 1, 2000 to a C, 2200 to an M, and 2400 to an S.
[code]# Gabriel Ewing 8/1/2014
from pprint import pprint
import sys
rounds = input('Enter the number of rounds: ')
error handling for case where norm cannot be achieved
if rounds < 4:
print ‘Not enough rounds for a norm. Exiting.’
raw_input(“Press enter to continue”)
sys.exit()
list of opponents
opps = range(0, rounds)
prompt for opponent ratings
for x in opps:
opps[x] = input('Enter the rating of the round ’ + str(x + 1) + ’ opponent: ')
dictionary with norm level and required score
levels = {‘1200’ : 0, ‘1400’ : 0, ‘1600’ : 0, ‘1800’ : 0, ‘2000’ : 0, ‘2200’ : 0, ‘2400’ : 0}
Calculating required score. Outer loop is the norm level, inner loop is each opponent.
for k, v in levels.iteritems():
for y in opps:
# Case where norm level is more than 200 above opponent rating
if int(k) - 200 > y:
levels[k] = float(levels[k] + 1)
# Case where norm level is between 200 and 0 points above opponent rating
elif int(k) > y:
levels[k] = float(levels[k] + .5) + float((int(k) - y))/400
# Case where norm level is more than 400 points below opponent rating
elif int(k) + 400 < y:
levels[k] = float(levels[k])
# Case where norm level is between 0 and 400 points below opponent rating
else:
levels[k] = float(levels[k] + .5) - float((y - int(k)))/800
Print the results
print 'If you scored MORE than the following number of points, you made the norm at that level: ’
pprint(levels)
raw_input(“Press enter to continue”)[/code]