<commit_before>diplomacy = {}
-- relation values range from -100 to 100
-- anything below -50 is enemy
-- anything below -20 is unstable
-- anything between -20 and 20 is neutral
-- anything above 20 is stable
-- anything above 50 is friendly

function diplomacy.getplayerrelation(entity)
	local n = mission.commissions[entity]
	for k,v in pairs(diplomacy.relation) do
		if v[entity] then
			n = n + mission.commissions[k] * v[entity]^2 / 100
		end
	end
	for k,v in pairs(diplomacy.relation[entity]) do
		n = n + mission.commissions[k] * v^2 / 100
	end
	return n / mission.total
end

function diplomacy.getrelation(one, other)
	if one > other then one, other = other, one end
	return diplomacy.relation[one][other]
end

function diplomacy.load()
	diplomacy.relation = {}
	local r = diplomacy.relation
	r.a = {b = 70, c = -5, d = -80, spacecorp = 40, ar = -100, br = -40,
		cr = -5, dr = 10}
	r.b = {c = -90, d = 2, spacecorp = 30, ar = -35, br = -100, cr = 20,<commit_msg>Improves getplayerrelation (still not used yet)<commit_after>diplomacy = {}
-- relation values range from -100 to 100
-- anything below -50 is enemy
-- anything below -20 is unstable
-- anything between -20 and 20 is neutral
-- anything above 20 is stable
-- anything above 50 is friendly

local abs = math.abs
function diplomacy.getplayerrelation(entity)
	local n = mission.commissions[entity] * 100
	for k,v in pairs(diplomacy.relation) do
		if v[entity] then
			n = n + mission.commissions[k] * v[entity]*abs(v[entity]) * .01
		end
	end
	for k,v in pairs(diplomacy.relation[entity]) do
		n = n + mission.commissions[k] * v*abs(v) * .01
	end
	return n / mission.total
end

function diplomacy.getrelation(one, other)
	if one > other then one, other = other, one end
	return diplomacy.relation[one][other]
end

function diplomacy.load()
	diplomacy.relation = {}
	local r = diplomacy.relation
	r.a = {b = 70, c = -5, d = -80, spacecorp = 40, ar = -100, br = -40,
		cr = -5, dr = 10}
	r.b = {c = -90, d = 2, spacecorp = 30, ar = -35, br = -100, cr = 20,
{'fraction_non_alphanumeric': 0.1300049431537321, 'fraction_numerical': 0.05190311418685121, 'mean_word_length': 3.3526881720430106, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2168530', 'n_tokens_mistral': 804, 'n_tokens_neox': 703, 'n_words': 250}