fork(1) download
  1. # simply put, what this does is let you select your priorities for rooms, and fill in which
  2. # champions you have.
  3. # then the logic finds the champion for each room who has the highest value, with the
  4. # least remaining value for all the other rooms.
  5. # My "database" is missing a lot of information for champions I don't have. If you can
  6. # fill in the blanks, PM me.
  7. # -- Carnou, Earth-228
  8.  
  9. # Special thanks to Zero and Zero's league, [GLC] The Corps, for helping me fill in the "database".
  10. # Currently missing champions: Martian Manhunter, Nightwing, Sinestro
  11. # Constantine, Zatana,
  12.  
  13. # we can fill out these rooms (training, bio_lab, steel, chips, armory, drone, research, power)
  14. # with more data as we get it.
  15. # for any champions not yet listed, it requires clicking on an assignee of each room, getting
  16. # the percentage they contribute, and adding it to each room.
  17.  
  18. ### This section is the "configuration" section
  19. # You list your order of preference for the rooms
  20. # And you list the champions that you have.
  21.  
  22. # Here, we fill out the list of champions that you actually have. As this
  23. # grows, we'll have more champions in each room than are necessarily in this list
  24. champions = [
  25. 'aquaman',
  26. 'atom',
  27. 'bane',
  28. 'batgirl',
  29. 'batman',
  30. 'black adam',
  31. 'black canary',
  32. 'captain cold',
  33. 'catwoman',
  34. 'cyborg',
  35. 'deadshot',
  36. 'dr fate',
  37. 'flash',
  38. 'green arrow',
  39. 'harley quinn',
  40. 'joker',
  41. 'killer croc',
  42. 'luthor',
  43. 'mera',
  44. 'penguin',
  45. 'poison ivy',
  46. 'red hood',
  47. 'red robin',
  48. 'robin',
  49. 'scarecrow',
  50. 'shazam',
  51. 'stargirl',
  52. 'superman',
  53. 'vixen',
  54. 'wonder woman',
  55. ]
  56.  
  57. # Here, we set the priority FROM LOWEST TO HIGHEST
  58. # The algorithm will favor maximizing the rooms at the bottom
  59. # do not add or remove rooms, simply rearrange them
  60. priority = [
  61. 'training',
  62. 'training',
  63. 'armory',
  64. 'steel',
  65. 'steel',
  66. 'chips',
  67. 'chips',
  68. 'research',
  69. 'drone',
  70. 'drone',
  71. 'bio_lab',
  72. 'bio_lab',
  73. 'power',
  74. 'power',
  75. ]
  76.  
  77. ### This is "the database". It's not really a database, but it's where
  78. # we track champion data for each room
  79. # Once I get the complete database information, this will go in the
  80. # "don't touch!" section
  81. training = {
  82. 'aquaman': 30,
  83. 'atom': 15,
  84. 'bane': 30,
  85. 'batgirl': 30,
  86. 'batman': 30,
  87. 'black adam': 10,
  88. 'black canary': 30,
  89. 'captain cold': 10,
  90. 'catwoman': 15,
  91. 'cyborg': 20,
  92. 'deadshot': 20,
  93. 'deathstroke':30,
  94. 'dr fate': 20,
  95. 'flash': 30,
  96. 'green arrow': 15,
  97. 'green lantern': 20,
  98. 'harley quinn': 30,
  99. 'joker': 30,
  100. 'killer croc': 15,
  101. 'luthor': 30,
  102. 'mera': 10,
  103. 'penguin': 20,
  104. 'poison ivy': 20,
  105. 'raven': 20,
  106. 'red hood': 15,
  107. 'red robin': 30,
  108. 'robin': 30,
  109. 'scarecrow': 30,
  110. 'shazam': 20,
  111. 'stargirl': 20,
  112. 'superman': 30,
  113. 'twoface': 20,
  114. 'vixen': 15,
  115. 'wonder woman': 15,
  116. }
  117.  
  118. bio_lab = {
  119. 'aquaman': 30,
  120. 'atom': 15,
  121. 'bane': 30,
  122. 'batgirl': 20,
  123. 'batman': 20,
  124. 'black adam': 10,
  125. 'black canary': 30,
  126. 'captain cold': 10,
  127. 'catwoman': 10,
  128. 'cyborg': 20,
  129. 'deadshot': 20,
  130. 'deathstroke':30,
  131. 'dr fate': 20,
  132. 'flash': 30,
  133. 'green arrow': 10,
  134. 'green lantern': 30,
  135. 'harley quinn': 20,
  136. 'joker': 30,
  137. 'killer croc': 15,
  138. 'luthor': 20,
  139. 'mera': 15,
  140. 'penguin': 20,
  141. 'poison ivy': 30,
  142. 'raven': 30,
  143. 'red hood': 15,
  144. 'red robin': 20,
  145. 'robin': 30,
  146. 'scarecrow': 20,
  147. 'shazam': 30,
  148. 'stargirl': 20,
  149. 'superman': 30,
  150. 'twoface': 30,
  151. 'vixen': 15,
  152. 'wonder woman': 10,
  153. }
  154.  
  155. steel = {
  156. 'aquaman': 20,
  157. 'atom': 10,
  158. 'bane': 20,
  159. 'batgirl': 20,
  160. 'batman': 30,
  161. 'black adam': 15,
  162. 'black canary': 20,
  163. 'captain cold': 10,
  164. 'catwoman': 10,
  165. 'cyborg': 30,
  166. 'deadshot': 30,
  167. 'deathstroke':20,
  168. 'dr fate': 30,
  169. 'flash': 30,
  170. 'green arrow': 10,
  171. 'green lantern': 30,
  172. 'harley quinn': 20,
  173. 'joker': 20,
  174. 'killer croc': 10,
  175. 'luthor': 20,
  176. 'mera': 10,
  177. 'penguin': 20,
  178. 'poison ivy': 20,
  179. 'raven': 30,
  180. 'red hood': 10,
  181. 'red robin': 20,
  182. 'robin': 20,
  183. 'scarecrow': 20,
  184. 'shazam': 30,
  185. 'stargirl': 30,
  186. 'superman': 30,
  187. 'twoface': 20,
  188. 'vixen': 10,
  189. 'wonder woman': 15,
  190. }
  191.  
  192. chips = {
  193. 'aquaman': 20,
  194. 'atom': 10,
  195. 'bane': 20,
  196. 'batgirl': 30,
  197. 'batman': 30,
  198. 'black adam': 10,
  199. 'black canary': 20,
  200. 'captain cold': 10,
  201. 'catwoman': 15,
  202. 'cyborg': 30,
  203. 'deadshot': 20,
  204. 'deathstroke':30,
  205. 'dr fate': 20,
  206. 'flash': 20,
  207. 'green arrow': 15,
  208. 'green lantern': 20,
  209. 'harley quinn': 30,
  210. 'joker': 20,
  211. 'killer croc': 10,
  212. 'luthor': 30,
  213. 'mera': 10,
  214. 'penguin': 30,
  215. 'poison ivy': 20,
  216. 'raven': 20,
  217. 'red hood': 10,
  218. 'red robin': 30,
  219. 'robin': 30,
  220. 'scarecrow': 30,
  221. 'shazam': 20,
  222. 'stargirl': 20,
  223. 'superman': 20,
  224. 'twoface': 20,
  225. 'vixen': 10,
  226. 'wonder woman': 10,
  227. }
  228.  
  229. armory = {
  230. 'aquaman': 20,
  231. 'atom': 10,
  232. 'bane': 30,
  233. 'batgirl': 20,
  234. 'batman': 30,
  235. 'black adam': 15,
  236. 'black canary': 20,
  237. 'captain cold': 10,
  238. 'catwoman': 15,
  239. 'cyborg': 30,
  240. 'deadshot': 30,
  241. 'deathstroke':30,
  242. 'dr fate': 30,
  243. 'flash': 30,
  244. 'green arrow': 15,
  245. 'green lantern': 20,
  246. 'harley quinn': 20,
  247. 'joker': 30,
  248. 'killer croc': 15,
  249. 'luthor': 30,
  250. 'mera': 10,
  251. 'penguin': 20,
  252. 'poison ivy': 20,
  253. 'raven': 20,
  254. 'red hood': 10,
  255. 'red robin': 20,
  256. 'robin': 20,
  257. 'scarecrow': 20,
  258. 'shazam': 20,
  259. 'stargirl': 30,
  260. 'superman': 20,
  261. 'twoface': 30,
  262. 'vixen': 10,
  263. 'wonder woman': 10,
  264. }
  265.  
  266. drone = {
  267. 'aquaman': 20,
  268. 'atom': 15,
  269. 'bane': 20,
  270. 'batgirl': 30,
  271. 'batman': 30,
  272. 'black adam': 10,
  273. 'black canary': 20,
  274. 'catwoman': 10,
  275. 'captain cold': 10,
  276. 'cyborg': 30,
  277. 'deadshot': 20,
  278. 'deathstroke':30,
  279. 'dr fate': 30,
  280. 'flash': 20,
  281. 'green arrow': 15,
  282. 'green lantern': 30,
  283. 'harley quinn': 30,
  284. 'joker': 20,
  285. 'killer croc': 10,
  286. 'luthor': 30,
  287. 'mera': 10,
  288. 'penguin': 20,
  289. 'poison ivy': 20,
  290. 'raven': 20,
  291. 'red hood': 10,
  292. 'red robin': 30,
  293. 'robin': 30,
  294. 'scarecrow': 30,
  295. 'shazam': 30,
  296. 'stargirl': 20,
  297. 'superman': 20,
  298. 'twoface': 20,
  299. 'vixen': 15,
  300. 'wonder woman': 10,
  301. }
  302.  
  303. research = {
  304. 'aquaman': 30,
  305. 'atom': 15,
  306. 'bane': 30,
  307. 'batgirl': 30,
  308. 'batman': 30,
  309. 'black adam': 10,
  310. 'black canary': 20,
  311. 'catwoman': 10,
  312. 'captain cold': 10,
  313. 'cyborg': 20,
  314. 'deadshot': 20,
  315. 'deathstroke':20,
  316. 'dr fate': 20,
  317. 'flash': 30,
  318. 'green arrow': 10,
  319. 'green lantern': 20,
  320. 'harley quinn': 30,
  321. 'joker': 30,
  322. 'killer croc': 10,
  323. 'luthor': 30,
  324. 'mera': 15,
  325. 'penguin': 20,
  326. 'poison ivy': 30,
  327. 'raven': 20,
  328. 'red hood': 15,
  329. 'red robin': 30,
  330. 'robin': 30,
  331. 'scarecrow': 30,
  332. 'shazam': 20,
  333. 'stargirl': 20,
  334. 'superman': 20,
  335. 'twoface': 30,
  336. 'vixen': 10,
  337. 'wonder woman': 10,
  338. }
  339.  
  340. power = {
  341. 'aquaman': 30,
  342. 'atom': 10,
  343. 'bane': 30,
  344. 'batgirl': 20,
  345. 'batman': 30,
  346. 'black adam': 15,
  347. 'black canary': 30,
  348. 'captain cold': 10,
  349. 'catwoman': 10,
  350. 'cyborg': 30,
  351. 'deadshot': 20,
  352. 'deathstroke':20,
  353. 'dr fate': 20,
  354. 'flash': 30,
  355. 'green arrow': 10,
  356. 'green lantern': 30,
  357. 'harley quinn': 20,
  358. 'joker': 20,
  359. 'killer croc': 10,
  360. 'luthor': 20,
  361. 'mera': 10,
  362. 'penguin': 20,
  363. 'poison ivy': 20,
  364. 'raven': 30,
  365. 'red hood': 10,
  366. 'red robin': 20,
  367. 'robin': 30,
  368. 'scarecrow': 20,
  369. 'shazam': 30,
  370. 'stargirl': 30,
  371. 'superman': 30,
  372. 'twoface': 20,
  373. 'vixen': 10,
  374. 'wonder woman': 10,
  375. }
  376.  
  377. ### DO NOT MODIFY BEYOND THIS POINT
  378. ### (unless you like coding logic)
  379. rooms = {
  380. 'training': training,
  381. 'bio_lab': bio_lab,
  382. 'steel': steel,
  383. 'chips': chips,
  384. 'armory': armory,
  385. 'drone': drone,
  386. 'research': research,
  387. 'power': power,
  388. }
  389.  
  390. def calculate_value(champion):
  391. value = sum([rooms[room][champion] for room in priority])
  392. return value
  393.  
  394. while priority:
  395. room_name = priority.pop()
  396. score = -1
  397. champ = ""
  398. value = 999999
  399.  
  400. for champion in champions:
  401. champ_value = calculate_value(champion)
  402. if rooms[room_name][champion] > score:
  403. score = rooms[room_name][champion]
  404. champ = champion
  405. value = champ_value
  406. if rooms[room_name][champion] == score and champ_value < value:
  407. score = rooms[room_name][champion]
  408. champ = champion
  409. value = champ_value
  410.  
  411. champions.remove(champ)
  412. print(f"{champ} assigned to {room_name} with {score} points")
  413.  
  414.  
  415.  
Success #stdin #stdout 0.11s 14136KB
stdin
Standard input is empty
stdout
stargirl assigned to power with 30 points
black canary assigned to power with 30 points
poison ivy assigned to bio_lab with 30 points
aquaman assigned to bio_lab with 30 points
shazam assigned to drone with 30 points
dr fate assigned to drone with 30 points
bane assigned to research with 30 points
penguin assigned to chips with 30 points
batgirl assigned to chips with 30 points
cyborg assigned to steel with 30 points
deadshot assigned to steel with 30 points
batman assigned to armory with 30 points
flash assigned to training with 30 points
harley quinn assigned to training with 30 points