Nightcrawler Review: True Cost Curve Calculations (click to see code)
import numpy as nP
import matplotlib as mY
import matplotlib.pyplot as plt # For plotting
from collections import Counter as ctr
class card:
def __init__(self, name, printed_cost, true_cost,copies):
self.name = name
self.printed_cost = printed_cost
self.true_cost = true_cost
self.copies = copies
def display(self):
print(f"name: {self.name}")
print(f"printed cost: {self.printed_cost}")
print(f"true cost: {self.true_cost}")
def total_printed_cost(deck):
printed_cost = []
for c in range(len(deck)):
printed_cost.append(deck[c].printed_cost*deck[c].copies)
#initialze total cost
total_printed_cost = 0
for i in printed_cost:
total_printed_cost += i
return total_printed_cost
def printed_cost_curve(deck,total_printed_cost):
num_cards = 0
for c in range(len(deck)):
num_cards += deck[c].copies
avg_printed_cost = total_printed_cost / num_cards
return avg_printed_cost
def total_true_cost(deck):
true_cost = []
for c in range(len(deck)):
true_cost.append(deck[c].true_cost*deck[c].copies)
#initialze total true_cost
total_true_cost = 0
for i in true_cost:
total_true_cost += i
return total_true_cost
def true_cost_curve(deck,total_true_cost):
num_cards = 0
for c in range(len(deck)):
num_cards += deck[c].copies
avg_true_cost = total_true_cost / num_cards
return avg_true_cost
def printed_cost_list(deck):
cost = []
for c in range(len(deck)):
for _ in range(deck[c].copies):
cost.append(deck[c].printed_cost)
return cost
def true_cost_list(deck):
true_cost = []
for c in range(len(deck)):
for _ in range(deck[c].copies):
true_cost.append(deck[c].true_cost)
return true_cost
# Use the card class to define all of Kurt's cards.
# How to use:
# card("insert title of card in quotes", printed cost, true cost, # of copies)
bamf = card("Bamf!", 0, 2/3, 3) # weighted average accounting for how I get it
port_away = card("'Port Away",0, 0+1 + 1, 1) # extra +1 to account for cost of discarding bamf from hand
tally_ho = card("Tally Ho!",1, 1+1, 2) # account for returning bamf to hand but then playing it again
scout_ahead = card("Scout Ahead",1, 1+1, 2)
port_and_punch = card("'Port and Punch'",2, 2+1, 2)
teleport_drop = card("Teleport Drop'",2, 2+1 + bamf.true_cost, 1) # accounts for needing to discard a bamf from play
prehensile_tail = card("Prehensile Tail'",1, 1+1, 1)
kurts_chapel = card("Kurt's Chapel",1, 1+1, 1)
kurts_cutlasses = card("Kurt's Cutlasses",2, 2+1, 1)
day_tripper = card("Daytripper",2, 2+1 - 1 * 2/3, 1) # accounts for her finding a bamf 2/3 of the time, didn't use bamf.true_cost because I didn't want to double count
# create a list that represents the deck
deck = [bamf, port_away,tally_ho,scout_ahead,port_and_punch,teleport_drop,prehensile_tail,kurts_chapel,kurts_cutlasses,day_tripper]
deck = nP.array(deck)
total_printed_cost = total_printed_cost(deck)
printed_cost_curve = printed_cost_curve(deck,total_printed_cost)
total_true_cost = total_true_cost(deck)
true_cost_curve = true_cost_curve(deck,total_true_cost)
print(total_true_cost)
print(true_cost_curve)
print(printed_cost_curve)
# now to create a cost curve plot
# create a line graph that plots every card
sorted_printed_cost = printed_cost_list(deck)
sorted_true_cost = true_cost_list(deck)
print(f'printed cost list {sorted_printed_cost}')
print(f'true cost list {sorted_true_cost}')
sorted_printed_cost = printed_cost_list(deck)
sorted_true_cost = true_cost_list(deck)
print(f'printed cost list {sorted_printed_cost}')
print(f'true cost list {sorted_true_cost}')
# Use Counter from collections to count how many of each unique value there are
pc_counts = ctr(sorted_printed_cost)
tc_counts = ctr(sorted_true_cost)
print('sorted tc:', tc_counts)
# Sort counts by keys
pc_counts_sorted = dict(sorted(pc_counts.items())) # Sorts by keys in ascending order
tc_counts_sorted = dict(sorted(tc_counts.items())) # Sorts by keys in ascending order
# Define x and y axis from the sorted counts
pc_x = nP.array(list(pc_counts_sorted.keys())) # The unique values
pc_y = nP.array(list(pc_counts_sorted.values())) # Their corresponding frequencies (counts)
tc_x = nP.array(list(tc_counts_sorted.keys()))
tc_y = nP.array(list(tc_counts_sorted.values()))
# Now you can use pc_x, pc_y, tc_x, and tc_y for plotting
print('tc_sort is:',tc_x, tc_y)
# First plot
plt.figure(num=1, figsize=[3.0, 3.0], dpi=300)
plt.plot(pc_x, pc_y, marker='o')
plt.xlim(pc_x[0] - 0.1)
y_min, y_max = plt.ylim()
plt.ylim(0, y_max*1.1)
plt.xticks(pc_x)
plt.yticks(nP.arange(0, nP.ceil(y_max) + 1, 1)) # Counts by 1
plt.ylabel('# of cards')
plt.xlabel('printed cost')
plt.title('Nightcrawler Printed Cost Curve', fontsize=10)
# Adjusted text position to match the second plot
plt.text(0.5, 0.05, f'Average Printed Cost = {printed_cost_curve:.2f}',
fontsize=8, transform=plt.gca().transAxes,
ha='center', va='center')
plt.tight_layout()
plt.show()
# Second plot
plt.figure(num=2, figsize=[3.0, 3.0], dpi=300)
plt.plot(tc_x, tc_y, marker='o')
plt.xlim(tc_x[0] - 0.1)
y_min, y_max = plt.ylim()
plt.ylim(0, y_max*1.1)
plt.xticks(nP.round(tc_x,1))
plt.yticks(nP.arange(0, nP.ceil(y_max) + 1, 1)) # Counts by 1
plt.ylabel('# of cards')
plt.xlabel('true cost')
plt.title('Nightcrawler True Cost Curve', fontsize=10)
# Add text for average true cost
plt.text(0.5, 0.05, f'Average True Cost = {true_cost_curve:.2f}',
fontsize=8, transform=plt.gca().transAxes,
ha='center', va='center')
plt.tight_layout()
plt.show()
Basic Ally Tier List: Efficiency Calculations (click to see code)
The Purpose of this file is to calculate the efficiencies of all the basic allies in marvel champions as of 5/7/2024
Efficiency for an ally will be defined as the average of their minimum and maximum output divided by their true cost Most allies this isn't so simple due to their effects, but An example of a function that will work for a generic ally is below shown below:
import csv
def ally_efficiency(card):
if card.attack > card.thwart:
max_efficiency = (card.attack * (card.hp - 1) + block) / card.true_cost
min_efficiency = (card.attack + block) / card.true_cost
else:
max_efficiency = (card.thwart * (card.hp-1) + block )/ card.true_cost
min_efficiency = (card.thwart + block) / card.true_cost
# report average efficiency
avg_efficiency = (max_efficiency + min_efficiency) / 2
return avg_efficiency
def eff(card_max,card_min, card_tc):
eff = (card_max + card_min)/(2*card_tc)
return eff
def eff_weird(card_max, card_min):
eff = (card_max + card_min)/2
return eff
import numpy as np
# Initialize a dictionary to store ally efficiencies
basic_ally_efficiencies = {}
subjective_allies = {}
wild_allies = {}
# I will add global variables here:
avg_villain_atk = 2
avg_boost = 1.5
block = avg_villain_atk + avg_boost + 0.5
confuse = 4
stun = 4
draw = 1.25 # to represent a draw being more valuable than a reduced cost
search_deck = 2 # it is already counted by reducing cost.
weird_effect = 0.5 # represents something that will distinguish between an
# ally that is otherwise identical - effect that cant be quantified
minion_avg_health = 3
# starting with Agent 13: I will quantify her effects by assuming
# she is readying helicarrier which is the most basic support
Agent_13_tc = 4+1 # tc = true cost
# max when thwarting 3 times, readying helicarrier 3 times, and blocks
Agent_13_max_eff = (2*3 + block) / (Agent_13_tc - 3)
# 1 thw + 1 block
Agent_13_min_eff = (2 + block)/ Agent_13_tc
# Calculate Agent 13's efficiency
Agent_13_eff = eff_weird(Agent_13_max_eff, Agent_13_min_eff)
# Store Agent 13's efficiency with the ally name as key
basic_ally_efficiencies['Agent 13'] = Agent_13_eff
subjective_allies['Agent 13'] = Agent_13_eff
## Angel
Angel_tc = 3 # assuming that an x-men or mutant played him
# 2 attacks and 1 block
Angel_max = 2*2 + block
# 1 attacl amd 1 block
Angel_min = 2 + block
Angel_eff = eff(Angel_max,Angel_min,Angel_tc)
basic_ally_efficiencies['Angel'] = Angel_eff
## Atlas Bear
atlas_bear_tc = 4
atlas_bear_max = 2*draw + block #assuming you get to add 2 cards to hand
atlas_bear_min = 1 + block #action doesnt deal damage, so min is 1 thwart
atlas_bear_eff = eff(atlas_bear_max,atlas_bear_min,atlas_bear_tc)
basic_ally_efficiencies['Atlas Bear'] = atlas_bear_eff
## Blade
blade_tc = 2
#blade_max_eff = (2 * 2 + block)/(blade_tc + 2) # max activations paying for cost
blade_max_eff = (block)/(blade_tc) # max activations paying for cost
blade_min_eff = 2 / blade_tc # attack and discard
blade_eff = eff_weird(blade_max_eff, blade_min_eff)
basic_ally_efficiencies['Blade'] = blade_eff
## Cannonball
# this one is difficult because if you always have 2 aerial cards he never dies
# so i will add this to a list of non objective allies
cannonball_tc = 4
cannonball_max = 2*2 + block # assuming he gets 2 activations + block
cannonball_min = 2 # one activation then dies to consequential
cannonball_eff = eff(cannonball_max,cannonball_min,cannonball_tc)
basic_ally_efficiencies['Cannonball'] = cannonball_eff
subjective_allies['Cannonball'] = cannonball_eff
## Colossus
colossus_tc = 4 # assuming played by mutant and xmen
colossus_max = 2*block + 3 # 2 blocks using tough, and one attack
colossus_min = 3 + block # attacks with status card, then blocks
colossus_eff = eff(colossus_max,colossus_min,colossus_tc)
basic_ally_efficiencies['Colossus'] = colossus_eff
## Cosmo
cosmo_tc = 3
cosmo_max = 2 + block # assuming 2 attacks subjective (strange, magic, etc)
cosmo_min = 1 + block
cosmo_eff = cosmo_max / cosmo_tc
basic_ally_efficiencies['Cosmo'] = cosmo_eff
subjective_allies['Cosmo'] = cosmo_eff
## Deadpool
deadpool_tc = 4
deadpool_max = 2*2 + block # not dealing with his effect, subjective
deadpool_min = 2 + block
deadpool_eff = eff(deadpool_max,deadpool_min,deadpool_tc)
basic_ally_efficiencies['Deadpool'] = deadpool_eff
subjective_allies['Deadpool'] = deadpool_eff
wild_allies['Deadpool'] = deadpool_eff
## Deathlok
deathlok_tc = 5
deathlok_max = 3*3 + block # assuming +1+1+1 upgrade attached
deathlok_min = 3 + block
deathlok_eff = eff(deathlok_max,deathlok_min,deathlok_tc)
basic_ally_efficiencies['Deathlok'] = deathlok_eff
## Drax
drax_tc = 4
drax_max = 3*3 + block
drax_min = 3 + block
drax_eff = eff(drax_max,drax_min,drax_tc)
basic_ally_efficiencies['Drax'] = drax_eff
subjective_allies['Drax'] = drax_eff # can only attack villain
## Dum Dum Dugan
dum_dum_dugan_tc = 6
dum_dum_dugan_max = 6*3
dum_dum_dugan_min = 3 + block
dum_dum_dugan_eff = eff(dum_dum_dugan_max,dum_dum_dugan_min,dum_dum_dugan_tc)
basic_ally_efficiencies['Dum Dum Dugan'] = dum_dum_dugan_eff
# ## Forge
# forge_tc = 2 # adds card to hand so reduces cost
# forge_max = 1 + search_deck + block # grabs an support so since you can choose ill value it as 2
# forge_min = forge_max
# forge_eff = eff(forge_max,forge_min,forge_tc)
# basic_ally_efficiencies['Forge'] = forge_eff
# subjective_allies['Forge'] = forge_eff
## Forge
forge_tc = 3 # adds card to hand so reduces cost
forge_max_eff = (1 + block) / (forge_tc - search_deck) # grabs an support so since you can choose ill value it as 2
forge_min_eff = (1 + block) / (forge_tc - 1) # assuming support doesn't help
forge_eff = eff_weird(forge_max_eff,forge_min_eff)
basic_ally_efficiencies['Forge'] = forge_eff
subjective_allies['Forge'] = forge_eff
## Gamora
gamora_tc = 4 # adds card to hand so reduces cost
gamora_max = (2*2 + block) / (gamora_tc - draw - draw) # 2 events with 2 activations
gamora_min = (2*1 +block) / (gamora_tc - 1) # assuming card doesn't help and its already counted in tc reduction
gamora_eff = eff_weird(gamora_max,gamora_min)
basic_ally_efficiencies['Gamora'] = gamora_eff
subjective_allies['Gamora'] = gamora_eff
## Ghost-Spider
ghost_spider_tc = 4 # adds card to hand so reduces cost
ghost_spider_max = (2*2 + block) / (ghost_spider_tc - search_deck) #
ghost_spider_min = (2*1 + block) / (ghost_spider_tc - search_deck) # she has more options than forge or gamora
ghost_spider_eff = eff_weird(ghost_spider_max,ghost_spider_min)
basic_ally_efficiencies['Ghost-Spider'] = ghost_spider_eff
subjective_allies['Ghost-Spider'] = ghost_spider_eff
wild_allies['Ghost-Spider'] = ghost_spider_eff
## Groot
groot_tc = 4
groot_max = 3*block # could block 3 villain attacks
groot_min = 2 + block
groot_eff = eff(groot_max,groot_min,groot_tc)
basic_ally_efficiencies['Groot'] = groot_eff
wild_allies['Groot'] = groot_eff
## Heimdall
heimdall_tc = 6
heimdall_max = 6 + block + weird_effect # orders encounter deck
heimdall_min = 3 + block + weird_effect
heimdall_eff = eff(heimdall_max,heimdall_min,heimdall_tc)
basic_ally_efficiencies['Heimdall'] = heimdall_eff
subjective_allies['Heimdall'] = heimdall_eff
## Hope Summers
# hope_summers_tc = 5 # adds card to hand so reduces cost
# hope_summers_max = 2*2 + weird_effect + search_deck + block # gains each trait and adds superpower card to hand
# hope_summers_min = 2*1 + weird_effect + search_deck + block
# hope_summers_eff = eff(hope_summers_max,hope_summers_min,hope_summers_tc)
# basic_ally_efficiencies['Hope Summers'] = hope_summers_eff
hope_summers_tc = 5 # adds card to hand so reduces cost
hope_summers_max_eff = (2*2 + weird_effect + block) / (hope_summers_tc - search_deck) # gains each trait and adds superpower card to hand
hope_summers_min_eff = (2*1 + weird_effect + block) / (hope_summers_tc - 1) # if search doesn't help
hope_summers_eff = eff_weird(hope_summers_max_eff,hope_summers_min_eff)
basic_ally_efficiencies['Hope Summers'] = hope_summers_eff
## Ironheart
ironheart_tc = 3 # adds card to hand so reduces cost
ironheart_max = (1 + block) / (ironheart_tc - draw) # draws
ironheart_min = ironheart_max
ironheart_eff = eff_weird(ironheart_max,ironheart_min)
basic_ally_efficiencies['Ironheart'] = ironheart_eff
## Lockjaw
lockjaw_tc = 4 # should only play from discard pile
lockjaw_max = 2 + block
lockjaw_min = lockjaw_max
lockjaw_eff = eff(lockjaw_max,lockjaw_min,lockjaw_tc)
basic_ally_efficiencies['Lockjaw'] = lockjaw_eff
subjective_allies['Lockjaw'] = lockjaw_eff
## Longshot
longshot_tc = 5
longshot_max = 2 + (minion_avg_health - 2) + block # 1/3 chance to defeat non elite minion averaging at 3 health
longshot_min = 2 + block
longshot_eff = eff(longshot_max,longshot_min,longshot_tc)
basic_ally_efficiencies['Longshot'] = longshot_eff
subjective_allies['Longshot'] = longshot_eff
## Machine Man
# his ability actually lowers his efficiency so just stored his base amount
machine_man_tc = 3
machine_man_max_eff = (3*4)/(machine_man_tc + 3*3) # uses ability max times
machine_man_min_eff = (1+block) / machine_man_tc
machine_man_max = 1*2+ block
machine_man_min = 1 + block
machine_man_eff = eff(machine_man_max,machine_man_min,machine_man_tc)
machine_man_eff_ability = (machine_man_max_eff + machine_man_min_eff)/2
basic_ally_efficiencies['Machine Man'] = machine_man_eff
subjective_allies['Machine Man'] = machine_man_eff_ability
## Martinex
martinex_tc = 3
martinex_max = 1*3 + block
martinex_min = 1 + block
martinex_eff = eff(martinex_max,martinex_min,martinex_tc)
basic_ally_efficiencies['Martinex'] = martinex_eff
## Mockingbird
mockingbird_tc = 4
mockingbird_max = 2*1 + block + block
mockingbird_min = block + 1 + block
mockingbird_eff = eff(mockingbird_max,mockingbird_min, mockingbird_tc)
basic_ally_efficiencies['Mockingbird'] = mockingbird_eff
## Moon Girl
moon_girl_tc = 4
moon_girl_max_eff = (2 + block) / (moon_girl_tc - draw*3)
moon_girl_min_eff = (2 + block) / moon_girl_tc
moon_girl_eff = eff_weird(moon_girl_max_eff,moon_girl_min_eff)
basic_ally_efficiencies['Moon Girl'] = moon_girl_eff
## Nick Fury
nick_fury_tc = 5
nick_fury_max_eff = (2 + block) / (nick_fury_tc - draw*3)
nick_fury_min_eff = nick_fury_max_eff
nick_fury_eff = eff_weird(nick_fury_max_eff,nick_fury_min_eff)
basic_ally_efficiencies['Nick Fury'] = nick_fury_eff
## Pete Wisdom
pete_wisdom_tc = 5
pete_wisdom_max = 2*4 + block # assuming 2 extra activations from heal
pete_wisdom_min = 3 + block
pete_wisdom_eff = eff(pete_wisdom_max,pete_wisdom_min,pete_wisdom_tc)
basic_ally_efficiencies['Pete Wisdom'] = pete_wisdom_eff
## Professor X
professor_x_tc = 4
professor_x_max = 3 + confuse + block
professor_x_min = 3 + confuse + block
professor_x_eff = eff(professor_x_max,professor_x_min,professor_x_tc)
basic_ally_efficiencies['Professor X'] = professor_x_eff
## Rocket Raccoon
rocket_raccoon_tc = 4
rocket_raccoon_max = 4*2 + block
rocket_raccoon_min = 2 + block
rocket_raccoon_eff = eff(rocket_raccoon_max,rocket_raccoon_min,rocket_raccoon_tc)
basic_ally_efficiencies['Rocket Raccoon'] = rocket_raccoon_eff
wild_allies['Rocket Raccoon'] = rocket_raccoon_eff
## Scarlet Spider
scarlet_spider_tc = 5
scarlet_spider_max_eff = block / (scarlet_spider_tc - draw*3)
scarlet_spider_min_eff = (2+block) / scarlet_spider_tc
scarlet_spider_eff = eff_weird(scarlet_spider_max_eff,scarlet_spider_min_eff)
basic_ally_efficiencies['Scarlet Spider'] = scarlet_spider_eff
## Snowguard
snowguard_tc = 5
snowguard_max = 3*block + 2 # choosing the health option is best in general
snowguard_min = 2*block + 1
snowguard_eff = eff(snowguard_max,snowguard_min,snowguard_tc)
basic_ally_efficiencies['Snowguard'] = snowguard_eff
subjective_allies['Snowguard'] = snowguard_eff
## SP//dr
spdr_tc = 3
spdr_max_eff = (1 + block) / spdr_tc #(1 + 2) / (spdr_tc - 1)
spdr_min_eff = (1 + block) / spdr_tc
spdr_eff = eff_weird(spdr_max_eff,spdr_min_eff)
basic_ally_efficiencies['SP///dr'] = spdr_eff
subjective_allies['SP//dr'] = spdr_eff
## Spider-Ham
spider_ham_tc = 4
spider_ham_max = 2*3 + block
spider_ham_min = 2
spider_ham_eff = eff(spider_ham_max,spider_ham_min,spider_ham_tc)
basic_ally_efficiencies['Spider-Ham'] = spider_ham_eff
subjective_allies['Spider-Ham'] = spider_ham_eff
## Spider-Man Miles Champion
spider_man_miles_champion_tc = 4
spider_man_miles_champion_max = 4 + 2 + block
spider_man_miles_champion_min = 4 + block
spider_man_miles_champion_eff = eff(spider_man_miles_champion_max,spider_man_miles_champion_min,spider_man_miles_champion_tc)
basic_ally_efficiencies['Spider-Man Miles Champion'] = spider_man_miles_champion_eff
## Spider-Man Hobie Brown
# worse against easy villains and better against hard villains
spider_man_hobie_brown_tc = 4
spider_man_hobie_brown_max = 1 + 1 + block + 3*(avg_boost+1)
spider_man_hobie_brown_min = 1 + block + 1
spider_man_hobie_brown_eff = eff(spider_man_hobie_brown_max,spider_man_hobie_brown_min,spider_man_hobie_brown_tc)
basic_ally_efficiencies['Spider-Man Hobie Brown'] = spider_man_hobie_brown_eff
subjective_allies['Spider-Man Hobie Brown'] = spider_man_hobie_brown_eff
## Spider-Man Peter Parker
# higher if you upgrade ur stats
spider_man_peter_parker_tc = 4
spider_man_peter_parker_max = 2*3 + 2*3
spider_man_peter_parker_min = 2+2+block
spider_man_peter_parker_eff = eff(spider_man_peter_parker_max,spider_man_peter_parker_min,spider_man_peter_parker_tc)
basic_ally_efficiencies['Spider-Man Peter Parker'] = spider_man_peter_parker_eff
subjective_allies['Spider-Man Peter Parker'] = spider_man_peter_parker_eff
## Spider-Man Otto Octavius
# will assume he readies a web shooter
spider_man_otto_octavius_tc = 3
spider_man_otto_octavius_max_eff = (1 + block) / (spider_man_otto_octavius_tc - 1*draw - 1)
spider_man_otto_octavius_min_eff = 1 + block
spider_man_otto_octavius_eff = eff_weird(spider_man_otto_octavius_max_eff,spider_man_otto_octavius_min_eff)
basic_ally_efficiencies['Spider-Man Otto Octavius'] = spider_man_otto_octavius_eff
subjective_allies['Spider-Man Otto Octavius'] = spider_man_otto_octavius_eff
## Star-Lord
star_lord_tc = 3
# assume max is an encounter card that doesnt matter
star_lord_max = 2*2 + block
# min is shadow of the past so ill just add a - here because he cant finish it himself
star_lord_min = -1
star_lord_eff = eff(star_lord_max,star_lord_min,star_lord_tc)
basic_ally_efficiencies['Star-Lord'] = star_lord_eff
subjective_allies['Star-Lord'] = star_lord_eff
## Storm
storm_tc = 5 # assuming x men
storm_max = 4*2 + block # with threat sink
storm_min = 2 + block
storm_eff = eff(storm_max,storm_min,storm_tc)
basic_ally_efficiencies['Storm'] = storm_eff
## Venom Eddie Brock
Venom_eddie_brock_tc = 5
Venom_eddie_brock_max = 3*2 + block + 2*avg_boost - 4 # assuming one assault
Venom_eddie_brock_min = 3 + block # dodges encounter card as well
Venom_eddie_brock_eff = eff(Venom_eddie_brock_max,Venom_eddie_brock_min,Venom_eddie_brock_tc)
basic_ally_efficiencies['Venom Eddie Brock'] = Venom_eddie_brock_eff
subjective_allies['Venom Eddie Brock'] = Venom_eddie_brock_eff
wild_allies['Venom Eddie Brock'] = Venom_eddie_brock_eff
## Vivian
vivian_tc = 3
vivian_max = 1 + block + 3 # estimating value of attachment to be 3
vivian_min = 1 + block # assuming no attachment to deal with
vivian_eff = eff(vivian_max,vivian_min,vivian_tc)
basic_ally_efficiencies['Vivian'] = vivian_eff
subjective_allies['Vivian'] = vivian_eff
## War Machine
war_machine_tc = 5
war_machine_max = block + 2*2 + block
war_machine_min = block + block # assuming situation necessitaites an activation
war_machine_eff = eff(war_machine_max,war_machine_min,war_machine_tc)
basic_ally_efficiencies['War Machine'] = war_machine_eff
## White Fox
white_fox_tc = 4
white_fox_max_eff = (1 + 1 + block) / 0.25 # guessing value to assume free, avoiding infinity
white_fox_min_eff = (1 + block) / white_fox_tc
white_fox_eff = eff_weird(white_fox_max_eff,white_fox_min_eff)
basic_ally_efficiencies['White Fox'] = white_fox_eff
subjective_allies['White Fox'] = white_fox_eff
import pprint as pp
pp.pp(basic_ally_efficiencies)
import matplotlib.pyplot as plt
def create_and_sort_histogram(data_dict, title):
plt.figure(figsize=(11.5, 7)) # Adjust width and height values as needed
sorted_data = sorted(data_dict.items(), key=lambda x: x[1], reverse=True)
labels, values = zip(*sorted_data)
bars = plt.barh(range(len(labels)), values, height=0.8, color='#ED1D24') # Red bars
plt.ylabel('Allies', fontsize=12, fontweight='bold', fontstyle='italic', color='#000042') # Blue axis label
plt.xlabel('Efficiencies', fontsize=12, fontweight='bold', fontstyle='italic', color='#000042') # Blue axis label
plt.title(title, fontsize=16, fontweight='bold', fontstyle='italic', color='#000042') # Blue title
# Set font properties for y-axis labels
plt.yticks(range(len(labels)), labels, fontstyle='italic', color='black') # Black y-axis labels
# Set font color for x-axis tick labels
plt.gca().tick_params(axis='x')
# Change the color of the bar edges to red
for bar in bars:
bar.set_edgecolor('#ED1D24')
# Annotate each bar with its efficiency value
for i, bar in enumerate(bars):
plt.text(bar.get_width(), bar.get_y() + bar.get_height()/2, f'{values[i]:.2f}',
va='center', ha='left', color='black', fontweight='bold')
plt.tight_layout() # Ensures the plot fits neatly in the figure area
plt.show()
# Creating and sorting histograms for each dictionary
create_and_sort_histogram(basic_ally_efficiencies, 'Basic Ally Efficiencies')
create_and_sort_histogram(subjective_allies, 'Subjective Allies')
create_and_sort_histogram(wild_allies, 'Wild Allies')
def plot_basic_not_subjective(basic_ally_efficiencies, subjective_allies):
allies_not_subjective = {ally: efficiency for ally, efficiency in basic_ally_efficiencies.items() if ally not in subjective_allies}
create_and_sort_histogram(allies_not_subjective, 'Objective Allies (*mostly)')
# Combine both types of allies into one list
combined_allies = [('Objective', ally, efficiency) for ally, efficiency in allies_not_subjective.items()] + [('Subjective', ally, efficiency) for ally, efficiency in subjective_allies.items()]
# Sort the combined allies by efficiency
sorted_combined_allies = sorted(combined_allies, key=lambda x: x[2])
# Write combined allies to CSV
with open('C:\\Users\\user\\Desktop\\MC_Code\\basic_ally_plots\\allies.csv', 'w', newline='') as csvfile:
fieldnames = ['Type', 'Ally', 'Efficiency']
writer = csv.DictWriter(csvfile, fieldnames=fieldnames)
writer.writeheader()
for ally_type, ally, efficiency in sorted_combined_allies:
writer.writerow({'Type': ally_type, 'Ally': ally, 'Efficiency': efficiency})
# Usage:
plot_basic_not_subjective(basic_ally_efficiencies, subjective_allies)
## This cell will make the same histograms, excluding moongirl and white fox because they are outliers.
import matplotlib.pyplot as plt
def create_and_sort_histogram(data_dict, title):
# Filter out ally efficiencies above 6
filtered_data = {ally: efficiency for ally, efficiency in data_dict.items() if efficiency <= 6}
plt.figure(figsize=(11.5, 7)) # Adjust width and height values as needed
sorted_data = sorted(filtered_data.items(), key=lambda x: x[1], reverse=True)
labels, values = zip(*sorted_data)
bars = plt.barh(range(len(labels)), values, height=0.8, color='#ED1D24') # Red bars
plt.ylabel('Allies', fontsize=12, fontweight='bold', fontstyle='italic', color='#000042') # Blue axis label
plt.xlabel('Efficiencies', fontsize=12, fontweight='bold', fontstyle='italic', color='#000042') # Blue axis label
plt.title(title, fontsize=16, fontweight='bold', fontstyle='italic', color='#000042') # Blue title
# Set font properties for y-axis labels
plt.yticks(range(len(labels)), labels, fontstyle='italic', color='black') # Black y-axis labels
# Set font color for x-axis tick labels
plt.gca().tick_params(axis='x')
# Change the color of the bar edges to red
for bar in bars:
bar.set_edgecolor('#ED1D24')
# Annotate each bar with its efficiency value
for i, bar in enumerate(bars):
plt.text(bar.get_width(), bar.get_y() + bar.get_height()/2, f'{values[i]:.2f}',
va='center', ha='left', color='black', fontweight='bold')
plt.tight_layout() # Ensures the plot fits neatly in the figure area
plt.show()
# Creating and sorting histograms for each dictionary
create_and_sort_histogram(basic_ally_efficiencies, 'Basic Ally Efficiencies')
create_and_sort_histogram(subjective_allies, 'Subjective Allies')
create_and_sort_histogram(wild_allies, 'Wild Allies')
import matplotlib.pyplot as plt
def find_dist(data_dict, title):
# Filter out ally efficiencies above 6
filtered_data = {ally: efficiency for ally, efficiency in data_dict.items() if efficiency <= 6}
plt.figure(figsize=(11.5, 7)) # Adjust width and height values as needed
# Add outliers bin
labels = list(filtered_data.keys())
values = list(filtered_data.values())
if len(data_dict) > len(filtered_data):
labels.append('Outliers')
values.append(len(data_dict) - len(filtered_data))
sorted_data = sorted(filtered_data.items(), key=lambda x: x[1], reverse=True)
labels, values = zip(*sorted_data)
bars = plt.barh(range(len(labels)), values, height=0.8, color='#ED1D24') # Red bars
# Set font properties for y-axis labels
plt.yticks(range(len(labels)), labels, fontstyle='italic', color='black') # Black y-axis labels
plt.ylabel('Allies', fontsize=12, fontweight='bold', fontstyle='italic', color='#000042') # Blue axis label
plt.xlabel('Efficiencies', fontsize=12, fontweight='bold', fontstyle='italic', color='#000042') # Blue axis label
plt.title(title, fontsize=16, fontweight='bold', fontstyle='italic', color='#000042') # Blue title
# Set font color for x-axis tick labels
plt.gca().tick_params(axis='x')
# Change the color of the bar edges to red
for bar in bars:
bar.set_edgecolor('#ED1D24')
# Annotate each bar with its efficiency value
for i, bar in enumerate(bars):
plt.text(bar.get_width(), bar.get_y() + bar.get_height()/2, f'{values[i]:.2f}',
va='center', ha='left', color='black', fontweight='bold')
plt.tight_layout() # Ensures the plot fits neatly in the figure area
plt.show()
# Example usage:
find_dist(basic_ally_efficiencies, 'Basic Ally Efficiencies')
find_dist(subjective_allies, 'Subjective Allies')
find_dist(wild_allies, 'Wild Allies')
print(len(basic_ally_efficiencies))