string[int] m = file_to_array("data/tcrs all modifiers.txt"); boolean[string][string] rel; file_to_map("tcrs pre-modifier relative order with rings.txt",rel); boolean less_than(string first, string second){ return rel[first][second]; } string[int] order; boolean[string] ordered; order[0]="greedy"; ordered["greedy"] = true; int c; boolean boop; foreach i in m{ c = order.count(); //if modifier is lower than lowest. if(m[i].less_than(order[0])){ //shift up. for j from c to 1 by -1{ order[j] = order[j-1]; } //insert new modifier in lowest spot. order[0] = m[i]; } if(order.count() > c){ continue; } //if modifier is between consecutive modifiers. for j from 1 to c{ //if (j-1)st < modifier i < jth if(m[i].less_than(order[j]) && order[j-1].less_than(m[i])){ //shift jth and beyond up by 1. for k from c to j+1 by -1{ order[k] = order[k-1]; } //insert modifier i into jth position. order[j] = m[i]; break; } } if(order.count() > c){ continue; } //if modifier is larger than all ordered modifiers. boop = true; for j from 0 to c-1{ boop = boop && (!(m[i].less_than(order[j]))); } if(boop){ order[c] = m[i]; } } foreach i in order{ print(i+": "+order[i]); } ============================================================================================================== > run actual tcrs order generator.ash 0: up-at-dawn 1: prompt 2: Usain Bolt's 3: lightning-fast 4: zippy 5: censurious 6: family-friendly 7: executive 8: avaricious 9: greedy 10: miser's 11: Sherlock's 12: inspector's //lucky comes after auspicious and before rosewater-soaked, so it's actually #14 or #15 and everything after it is shifted by one. 13: auspicious 14: perfumed 15: rosewater-soaked 16: aromatic 17: reassuring 18: asbestos-lined 19: flame-retardant 20: lard-coated 21: greasy 22: Jeselnik's 23: ribald 24: scandalous 25: horrifying 26: gravedigger's 27: frightening 28: stanky 29: smelly 30: foul-smelling 31: grievous 32: razor-sharp 33: deadly 34: nasty 35: coward's 36: careful 37: Jim Carey's 38: mansplainer's 39: manspreader's 40: Lo Pan's 41: chaotic 42: MacGyver's 43: resourceful 44: clever 45: crafty 46: Oprah's 47: supercharged 48: energetic 49: forbidden 50: occult 51: baleful 52: sinister 53: wicked 54: extremely unsafe 55: dangerous 56: Rosewater's 57: savvy 58: sage 59: vibrating 60: hardy 61: hale 62: brawny 63: wizardly 64: thinker's 65: brainy 66: beefcake's 67: weightlifter's 68: fireproof 69: flame-wreathed 70: scorching 71: friendly 72: double-paned 73: sizzling 74: toasty 75: lion tamer's 76: dog trainer's 77: Temple Grandin's 78: Annie Oakley's 79: sharpshooter's 80: boxer's 81: stylish 82: beefy 83: Tesla 84: smooth 85: Van der Graaf 86: electrified 87: medical-grade 88: therapeutic 89: curative 90: veiny 91: ruddy 92: rosy-cheeked 93: healthy 94: wholesome 95: steel-toed 96: dance instructor's 97: arcane researcher's 98: personal trainer's 99: Da Vinci's 100: Newton's 101: shellacked 102: rock-hard 103: slick 104: hardened 105: stiffened 106: Socratic 107: Samson's 108: studded 109: fortified 110: quilted 111: experienced 112: educational 113: smartaleck's 114: supercool 115: padded 116: knitted 117: Sinatra's 118: Fonzie's 119: groovy 120: wool 121: Jack Frost's 122: frosty 123: nippy 124: chilly 125: banded 126: Herculean 127: cool 128: strapping 129: of the ox 130: of wisdom 131: of the wise owl 132: of the cougar 133: of the brute 134: of the pedagogue 135: of Tarzan 136: of James Dean 137: of dire peril 138: of the dark arts 139: of vim and vigor 140: of the bloodbag 141: of the storm 142: of Calamity Jane 143: of Gandalf 144: of Leguizamo 145: of the scaredy-cat 146: of extreme caution 147: of the empath 148: of chilblains 149: of the blizzard 150: of the brazier 151: of incineration 152: of the sewer 153: of the overflowing toilet 154: of terror 155: of horror 156: of doom 157: of mayonnaise 158: of courage 159: of bravery 160: of temperance 161: of the detective 162: of the businessman 163: of the boozehound 164: of the sweet-tooth 165: of the glutton 166: of the cheetah 167: of Flo-Jo 168: of the early riser