<commit_before>#!/usr/bin/env python
from random import gauss

# debug level of output
# 0 = summaries
# 1 = show players before and after
# 2 = show individual game results
# progress shows percentage, rounded to 10, for runtime
debuglevel = 0
progress = False

# game stats
rounds = 10000 #rounded down to 10s
playercount = 10000 #players not grouped yet

# proposed change, where 0 is the rank down point
proposal = False

# skill based rounds are
# player skill level of skillspread stdev
# plus a random number of opponentspread stdev
# if the sum is more than the average of the two, 0, the player wins
# more skilled players win more often
# opponentspread greather than 1 represents a sample of players of a specific spread
# rather than whole population of players
skillbased = False
skillspread = 2
opponentspread = 1



# grades dictionary
grades = {
	0:'C-',
	1:'C',
	2:'C+',
	3:'B-',
	4:'B',
	5:'B+',
	6:'A-',
	7:'A',
	8:'A+',
}

winpoints = {
	0:20,
	1:15,
	2:12,
	3:12,
	4:10,
	5:10,
	6:10,
	7:10,
	8:10,
}

class player(object):
	def __init__(self, player_id):
		self.id = player_id
		if skillbased == True:
			self.skill = gauss(0, skillspread)
		else:
			self.skill = 0
		self.rank = 0
		self.exp = 0
		self.grade = 'C-'

	def __repr__(self):
		return "Player %s, Skill level %s, Rank %s %s" % (self.id, self.skill, self.grade, self.exp)

	def win(self):
		self.exp += winpoints[self.rank]
		if self.exp >= 100:
			self.exp = 30
			self.rank += 1
		if self.rank > 8:
			self.exp = 99
			self.rank = 8
		self.grade = grades[self.rank]

	def lose(self):		
		self.exp -= 10
		if ( self.exp <= 0 and proposal == True ) or ( self.exp < 0 and proposal == False ):
			self.exp = 70
			self.rank -= 1
		if self.rank < 0:
			self.rank = 0
			self.exp = 0
			self.grade = 'C-'
		self.grade = grades[self.rank]


print
print '#############Initializing Players#############'
print

players=[]
for x in range(playercount):
	players.append( player(x) )

if debuglevel >= 1 :
	for x in players:
		print x
else:
	print '%s players' % ( len(players) )


print
print '#################Playing Game#################'<commit_msg>Added modifiers to wins/losses points.<commit_after>#!/usr/bin/env python
from random import gauss

# debug level of output
# 0 = summaries
# 1 = show players before and after
# 2 = show individual game results
# progress shows percentage, rounded to 10, for runtime
debuglevel = 0
progress = False

# game stats
rounds = 10000 #rounded down to 10s
playercount = 10000 #players not grouped yet

# proposed change, where 0 is the rank down point
proposal = False

# skill based rounds are
# player skill level of skillspread stdev
# plus a random number of opponentspread stdev
# if the sum is more than the average of the two, 0, the player wins
# more skilled players win more often
# opponentspread greather than 1 represents a sample of players of a specific spread
# rather than whole population of players
skillbased = False
skillspread = 2
opponentspread = 1



# grades dictionary
grades = {
	0:'C-',
	1:'C',
	2:'C+',
	3:'B-',
	4:'B',
	5:'B+',
	6:'A-',
	7:'A',
	8:'A+',
}

winpoints = {
	0:20,
	1:15,
	2:12,
	3:12,
	4:10,
	5:10,
	6:10,
	7:10,
	8:10,
}

class player(object):
	def __init__(self, player_id):
		self.id = player_id
		if skillbased == True:
			self.skill = gauss(0, skillspread)
		else:
			self.skill = 0
		self.rank = 0
		self.exp = 0
		self.grade = 'C-'

	def __repr__(self):
		return "Player %s, Skill level %s, Rank %s %s" % (self.id, self.skill, self.grade, self.exp)

	def win(self, modifier=0):
		self.exp += winpoints[self.rank] + modifier
		if self.exp >= 100:
			self.exp = 30
			self.rank += 1
		if self.rank > 8:
			self.exp = 99
			self.rank = 8
		self.grade = grades[self.rank]

	def lose(self, modifier=0):		
		self.exp -= 10 + modifier
		if ( self.exp <= 0 and proposal == True ) or ( self.exp < 0 and proposal == False ):
			self.exp = 70
			self.rank -= 1
		if self.rank < 0:
			self.rank = 0
			self.exp = 0
			self.grade = 'C-'
		self.grade = grades[self.rank]


print
print '#############Initializing Players#############'
print

players=[]
for x in range(playercount):
	players.append( player(x) )

if debuglevel >= 1 :
	for x in players:
		print x
else:
	print '%s players' % ( len(players) )


print
print '#################Playing Game#################'
{'fraction_non_alphanumeric': 0.1484393063583815, 'fraction_numerical': 0.03930635838150289, 'mean_word_length': 3.4097859327217126, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '301044', 'n_tokens_mistral': 1747, 'n_tokens_neox': 1526, 'n_words': 533}