Cody

# Problem 3097. Scrabble Scores - 12

Solution 1702006

Submitted on 3 Jan 2019 by Mu
• Size: 49
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
first_word = 'thinning'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'eodnirl'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'diner','doter','droit','drone','elint','eloin','enrol','ident','idler','indol','inert','inlet','inter','intro','irone','lento','lined','liner','lirot','liter','litre','loden','loner','nerol','niter','nitre','nitro','noted','noter','oiled','oiler','olden','older','oldie','olein','oriel','redon','relit','reoil','riled','ronde','teind','teloi','tenor','tilde','tiled','tiler','tined','tired','toile','toled','tondi','toned','toner','trend','tried','trine','triol','trode','trone','dentil','dinero','dotier','editor','entoil','indole','ironed','linted','linter','loiter','neroli','norite','orient','retold','rident','rioted','rodent','roiled','rondel','tinder','tirled','toiled','toiler','tonier','trined','triode','lentoid','retinol','tendril','trindle'}; words{2} = {'dhole','diner','drone','eloin','enrol','helio','heron','hider','hired','holed','honed','honer','horde','idler','indol','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','rhino','riled','ronde','dehorn','dinero','heroin','hinder','hoiden','holden','holder','holier','hondle','honied','horned','indole','ironed','neroli','roiled','rondel','hordein','inholder'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{8} = {'deign','diner','dinge','dingo','dirge','dogie','doing','drone','eloin','enrol','gelid','genro','geoid','giron','glide','goner','gored','gride','grind','groin','idler','indol','ingle','irone','liger','lined','liner','lingo','loden','lodge','login','loner','longe','nerol','ogled','ogler','oiled','oiler','olden','older','oldie','olein','oriel','redon','reign','renig','reoil','ridge','riled','ronde','dinero','dinger','dingle','doling','dongle','eloign','engild','engird','eringo','gilder','girdle','girned','glider','golden','golder','ignore','indole','ironed','legion','linger','lodger','logier','longed','longer','neroli','reding','regild','region','ridgel','ringed','roiled','rondel','eroding','glenoid','gloried','godlier','groined','ignored','lording','negroid','redoing'}; max_score_corr = 12; max_word_corr = {'inholder'}; [max_score,max_word] = scrabble_scores_12(words,first_word); assert(isequal(max_score,max_score_corr)) assert(isequal(max_word,max_word_corr))

2   Pass
first_word = 'novels'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'dmvxeao'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'ad','ae','am','an','ax','da','de','do','ed','em','en','ex','ma','me','mo','na','ne','no','od','oe','om','on','ox','ado','and','ane','ave','avo','axe','dam','dan','den','dev','dex','doe','dom','don','emo','end','eon','mad','mae','man','max','med','men','moa','mod','mon','nae','nam','nav','nod','nom','oda','ode','oma','one','ova','van','vex','voe','vox','aeon','amen','axed','axon','dame','damn','dean','demo','deva','dome','dona','done','dove','exam','exon','made','mane','mano','mead','mean','mend','meno','moan','mode','move','moxa','name','nave','nema','node','noma','nome','nova','odea','omen','oven','oxen','vane','vena','vend','admen','amend','anode','axmen','axone','daven','demon','devon','doven','maned','maven','maxed','menad','monad','monde','moved','named','nomad','novae','vaned','venom','daemon','moaned'}; words{2} = {'ad','ae','am','ax','da','de','do','ed','em','ex','ma','me','mo','od','oe','om','ox','ado','ave','avo','axe','dam','dev','dex','doe','dom','emo','mad','mae','max','med','moa','mod','moo','oda','ode','oma','ova','oxo','vex','voe','vox','axed','dame','demo','deva','dome','doom','dove','exam','made','mead','mode','mood','move','moxa','odea','maxed','mooed','moved'}; words{3} = {'ad','ae','am','ax','da','de','do','ed','em','ex','ma','me','mo','od','oe','om','ox','ado','ave','avo','axe','dam','dev','dex','doe','dom','emo','mad','mae','max','med','moa','mod','oda','ode','oma','ova','vav','vex','voe','vox','axed','dame','demo','deva','dome','dove','exam','made','mead','mode','move','moxa','odea','maxed','moved'}; words{4} = {'ad','ae','am','ax','da','de','do','ed','em','ex','ma','me','mo','od','oe','om','ox','ado','ave','avo','axe','dam','dee','dev','dex','doe','dom','eme','emo','eve','mad','mae','max','med','moa','mod','oda','ode','oma','ova','vee','vex','voe','vox','axed','dame','deem','deme','demo','deva','dome','dove','eave','exam','exed','made','mead','meed','mode','move','moxa','odea','adeem','deave','eaved','edema','evade','maxed','moved','vexed','oedema'}; words{5} = {'ad','ae','al','am','ax','da','de','do','ed','el','em','ex','la','lo','ma','me','mo','od','oe','om','ox','ado','ale','ave','avo','axe','dal','dam','del','dev','dex','doe','dol','dom','eld','elm','emo','lad','lam','lav','lax','lea','led','lev','lex','lox','mad','mae','max','med','mel','moa','mod','mol','oda','ode','old','ole','oma','ova','vex','voe','vox','alme','aloe','axed','axel','axle','dale','dame','deal','demo','deva','dole','dome','dove','exam','lade','lame','lave','lead','leva','levo','load','loam','lode','love','made','male','mead','meal','meld','mode','mola','mold','mole','move','moxa','odea','olde','olea','oval','vale','veal','vela','veld','vole','amole','axled','dolma','domal','laevo','lamed','laved','loved','loxed','maxed','medal','modal','model','moved','voled','voxel','loamed'}; words{6} = {'ad','ae','am','as','ax','da','de','do','ed','em','es','ex','ma','me','mo','od','oe','om','os','ox','so','ado','ads','ave','avo','axe','dam','das','dev','dex','doe','dom','dos','eds','emo','ems','mad','mae','mas','max','med','moa','mod','mos','oda','ode','ods','oes','oma','oms','ose','ova','sad','sae','sax','sea','sev','sex','sod','som','sox','vas','vex','voe','vox','ados','aves','avos','axed','axes','dame','dams','demo','deva','devs','does','dome','doms','dosa','dose','dove','emos','exam','made','mads','maes','mead','meds','mesa','moas','mode','mods','move','moxa','odas','odea','odes','omas','oxes','sade','same','save','seam','soda','soma','some','vase','voes','dames','demos','devas','domes','doves','exams','maxed','maxes','meads','modes','moved','moves','moxas','oaves','saved','soave','vadose','vamose','vamosed'}; max_score_corr = 16; max_word_corr = {'vexed'}; [max_score,max_word] = scrabble_scores_12(words,first_word); assert(isequal(max_score,max_score_corr)) assert(isequal(max_word,max_word_corr))

3   Pass
first_word = 'zoologist'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'aehcmdi'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'aced','ache','acid','acme','adze','ahed','ahem','aide','amid','amie','cade','cadi','caid','came','cami','cazh','cedi','chad','chai','cham','chem','chez','chia','chid','dace','dame','daze','dice','dime','each','emic','hade','haed','haem','hame','haze','head','hide','hied','iced','idea','idem','mace','mach','made','maid','maze','mead','mech','mica','mice','zeda','ached','aimed','amice','amide','azide','chide','chime','demic','hazed','hemic','maced','mache','maize','mazed','media','medic','miche','chimed','haemic','miched','zaideh'}; words{2} = {'aced','ache','acid','acme','ahed','ahem','aide','amid','amie','cade','cadi','caid','came','cami','camo','cedi','chad','chai','cham','chao','chem','chia','chid','ciao','coda','code','coed','coma','come','dace','dame','deco','demo','dice','dime','dome','each','echo','emic','hade','haed','haem','hame','head','hide','hied','hoed','homa','home','iced','idea','idem','mace','mach','made','maid','mead','mech','mica','mice','mode','modi','oche','odah','odea','odic','ohed','ohia','ached','aimed','amice','amide','amido','cameo','chemo','chiao','chide','chime','comae','demic','demoi','domic','hemic','homed','homie','maced','mache','macho','mahoe','media','medic','miche','mocha','mochi','ohmic','chimed','codeia','cohead','comade','haemic','hemoid','medico','miched','modica','haemoid'}; words{2} = {'aced','ache','acid','acme','ahed','ahem','aide','amid','amie','cade','cadi','caid','came','cami','camo','cedi','chad','chai','cham','chao','chem','chia','chid','ciao','coda','code','coed','coma','come','dace','dame','deco','demo','dice','dime','dome','each','echo','emic','hade','haed','haem','hame','head','hide','hied','hoed','homa','home','iced','idea','idem','mace','mach','made','maid','mead','mech','mica','mice','mode','modi','oche','odah','odea','odic','ohed','ohia','ached','aimed','amice','amide','amido','cameo','chemo','chiao','chide','chime','comae','demic','demoi','domic','hemic','homed','homie','maced','mache','macho','mahoe','media','medic','miche','mocha','mochi','ohmic','chimed','codeia','cohead','comade','haemic','hemoid','medico','miched','modica','haemoid'}; words{4} = {'aced','ache','acid','acme','ahed','ahem','aide','alec','alme','amid','amie','cade','cadi','caid','calm','came','cami','cedi','ceil','chad','chai','cham','chem','chia','chid','clad','clam','dace','dahl','dale','dame','deal','deil','deli','dhal','dial','dice','diel','dime','each','elhi','emic','hade','haed','haem','hail','hale','halm','hame','head','heal','heil','held','helm','hide','hied','hila','iced','idea','idem','idle','ilea','lace','lade','laic','laid','lame','lead','lech','lice','lich','lied','lima','lime','mace','mach','made','maid','mail','male','mead','meal','mech','meld','mica','mice','mild','mile','ached','ailed','aimed','alcid','almeh','amice','amide','camel','chela','chide','chiel','child','chile','chime','clade','claim','clime','decal','demic','email','haled','halid','hemal','hemic','ideal','ileac','laced','laich','lamed','leach','limed','maced','mache','macle','maile','malic','medal','media','medic','melic','miche','milch','calmed','chield','childe','chimed','chimla','haemic','hailed','halide','heliac','hiemal','lamedh','macled','mailed','malice','medial','miched','camelid','claimed','decimal','declaim','medical'}; words{2} = {'aced','ache','acid','acme','ahed','ahem','aide','amid','amie','cade','cadi','caid','came','cami','camo','cedi','chad','chai','cham','chao','chem','chia','chid','ciao','coda','code','coed','coma','come','dace','dame','deco','demo','dice','dime','dome','each','echo','emic','hade','haed','haem','hame','head','hide','hied','hoed','homa','home','iced','idea','idem','mace','mach','made','maid','mead','mech','mica','mice','mode','modi','oche','odah','odea','odic','ohed','ohia','ached','aimed','amice','amide','amido','cameo','chemo','chiao','chide','chime','comae','demic','demoi','domic','hemic','homed','homie','maced','mache','macho','mahoe','media','medic','miche','mocha','mochi','ohmic','chimed','codeia','cohead','comade','haemic','hemoid','medico','miched','modica','haemoid'}; words{6} = {'aced','ache','acid','acme','aged','ahed','ahem','aide','amid','amie','cade','cadi','cage','caid','came','cami','cedi','chad','chai','cham','chem','chia','chid','dace','dame','dice','dime','each','egad','emic','gach','gadi','gaed','game','gied','hade','haed','haem','hame','head','hide','hied','iced','idea','idem','mace','mach','made','mage','magi','maid','mead','mech','mega','mica','mice','ached','aimed','amice','amide','cadge','caged','chide','chime','demic','gamed','gamic','hemic','image','maced','mache','magic','media','medic','miche','midge','chimed','degami','gached','haemic','imaged','miched'}; words{7} = {'aced','ache','acid','acme','ahed','ahem','aide','amid','amie','cade','cadi','caid','came','cami','cedi','chad','chai','cham','chem','chia','chid','dace','dame','dice','dime','each','emic','hade','haed','haem','hame','head','hide','hied','iced','idea','idem','imid','mace','mach','made','maid','mead','mech','mica','mice','midi','ached','aimed','amice','amici','amide','chide','chime','demic','hemic','imide','maced','mache','media','medic','medii','miche','amidic','chimed','haemic','miched'}; words{8} = {'aced','aces','ache','acid','acme','ahed','ahem','ahis','aide','aids','aims','amid','amie','amis','asci','cade','cadi','cads','caid','came','cami','cams','case','cash','cedi','chad','chai','cham','chem','chia','chid','chis','dace','dahs','dais','dame','dams','dash','desi','dice','dies','dime','dims','disc','dish','each','edhs','emic','hade','haed','haem','haes','hame','hams','head','hems','hide','hied','hies','hims','iced','ices','ichs','idea','idem','ides','mace','mach','macs','made','mads','maes','maid','mash','mead','mech','meds','mesa','mesh','mica','mice','mics','mids','mise','sade','sadi','said','same','scad','scam','seam','semi','shad','sham','shea','shed','shim','sice','side','sidh','sima','ached','aches','acids','acmes','aides','aimed','amice','amide','amids','amies','asdic','ashed','aside','cades','cadis','caids','cames','camis','cased','cedis','chads','chais','chams','chase','chasm','chems','chias','chide','chime','daces','dames','dashi','deash','deism','demic','deshi','dices','dimes','disme','emics','hades','haems','hames','heads','hemic','hides','ideas','maced','maces','mache','machs','maids','meads','mechs','media','medic','mesic','micas','miche','sadhe','saice','shade','shame','shied','sidhe','amices','amides','camise','cashed','chaise','chased','chiasm','chides','chimed','chimes','emdash','haemic','maches','mashed','mashie','medias','medics','miched','miches','sachem','samech','schema','shamed','simcha','chamise','chasmed'}; words{9} = {'aced','ache','acid','acme','adit','ahed','ahem','aide','amid','amie','cade','cadi','caid','came','cami','cate','cedi','chad','chai','cham','chat','chem','chia','chid','chit','cite','dace','dame','date','dice','diet','dime','dita','dite','each','eath','echt','edit','emic','emit','etch','etic','hade','haed','haem','haet','hame','hate','head','heat','hide','hied','iced','idea','idem','itch','item','mace','mach','made','maid','mate','math','mead','meat','mech','meta','meth','mica','mice','mite','tace','tach','tame','team','tech','thae','them','tide','tied','time','ached','acted','admit','aimed','aitch','amice','amide','cadet','cheat','chide','chime','cited','death','demic','demit','dicta','ditch','edict','ethic','hated','hemic','maced','mache','match','mated','media','medic','miche','tache','tamed','teach','theca','timed','chimed','dacite','detach','haemic','itched','miched','hematic','matched'}; max_score_corr = 19; max_word_corr = {'zaideh'}; [max_score,max_word] = scrabble_scores_12(words,first_word); assert(isequal(max_score,max_score_corr)) assert(isequal(max_word,max_word_corr))

4   Pass
ind = randi(2); switch ind case 1 first_word = 'start'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'aethilm'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'aisle','alist','almeh','almes','amies','email','emits','haems','haets','hails','hales','halms','halts','hames','haste','hates','heals','heats','heils','heist','helms','hemal','hilts','islet','istle','items','laith','lames','lathe','lathi','laths','leash','least','limas','limes','litas','lites','lithe','maile','mails','maist','males','malts','mates','maths','meals','meats','melts','metal','meths','metis','miles','milts','mites','saith','salmi','satem','selah','setal','shale','shalt','shame','sheal','shiel','slate','slime','smalt','smelt','smile','smite','smith','stale','steal','steam','stela','stile','stime','taels','tails','tales','tames','tamis','teals','teams','telia','tesla','thali','tiles','times','almehs','emails','halest','halite','hamlet','haslet','hiemal','lamest','lathes','lathis','latish','mailes','mashie','mesial','metals','misate','miseat','saithe','saltie','samiel','samite','samlet','sheila','shelta','smalti','stelai','tahsil','thalis','theism','atheism','halites','hamlets','heliast'}; words{2} = {'almeh','atilt','email','hemal','laith','lathe','lathi','latte','lithe','maile','matte','metal','telia','thali','theta','tilth','tithe','title','halite','hamlet','hiemal'}; words{3} = {'alate','almah','almeh','email','halma','hamal','hemal','laith','lamia','lathe','lathi','lithe','maile','metal','tamal','telia','thali','althea','haemal','halite','hamate','hamlet','hiatal','hiemal','lamiae','malate','maltha','meatal','tamale','hematal','thalami'}; words{4} = {'aimer','airth','alert','almeh','alter','amrit','ariel','armet','artel','earth','email','haler','harem','hater','heart','hemal','herma','hilar','ihram','irate','ither','laith','lamer','later','lathe','lathi','liter','lithe','litre','maile','mater','merit','metal','miler','mirth','miter','mitre','ramet','ramie','ratel','rathe','realm','relit','remit','retia','taler','tamer','telia','terai','thali','tharm','their','therm','thirl','tiler','timer','trail','trial','armlet','hailer','halier','halite','halter','hamlet','hermai','hermit','hiemal','imaret','lather','lither','mailer','matier','milter','mither','mitral','ramtil','remail','retail','retial','tailer','thairm','thaler','thiram','tramel','lathier','maltier','marlite','thermal'}; words{5} = {'almeh','atilt','email','hemal','laith','lathe','lathi','latte','lithe','maile','matte','metal','telia','thali','theta','tilth','tithe','title','halite','hamlet','hiemal'}; max_score_corr = 12; max_word_corr = {'atheism','hamlets','hematal','thalami','thermal'}; case 2 first_word = 'thinning'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'eodnirl'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'diner','doter','droit','drone','elint','eloin','enrol','ident','idler','indol','inert','inlet','inter','intro','irone','lento','lined','liner','lirot','liter','litre','loden','loner','nerol','niter','nitre','nitro','noted','noter','oiled','oiler','olden','older','oldie','olein','oriel','redon','relit','reoil','riled','ronde','teind','teloi','tenor','tilde','tiled','tiler','tined','tired','toile','toled','tondi','toned','toner','trend','tried','trine','triol','trode','trone','dentil','dinero','dotier','editor','entoil','indole','ironed','linted','linter','loiter','neroli','norite','orient','retold','rident','rioted','rodent','roiled','rondel','tinder','tirled','toiled','toiler','tonier','trined','triode','lentoid','retinol','tendril','trindle'}; words{2} = {'dhole','diner','drone','eloin','enrol','helio','heron','hider','hired','holed','honed','honer','horde','idler','indol','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','rhino','riled','ronde','dehorn','dinero','heroin','hinder','hoiden','holden','holder','holier','hondle','honied','horned','indole','ironed','neroli','roiled','rondel','hordein','inholder'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{8} = {'deign','diner','dinge','dingo','dirge','dogie','doing','drone','eloin','enrol','gelid','genro','geoid','giron','glide','goner','gored','gride','grind','groin','idler','indol','ingle','irone','liger','lined','liner','lingo','loden','lodge','login','loner','longe','nerol','ogled','ogler','oiled','oiler','olden','older','oldie','olein','oriel','redon','reign','renig','reoil','ridge','riled','ronde','dinero','dinger','dingle','doling','dongle','eloign','engild','engird','eringo','gilder','girdle','girned','glider','golden','golder','ignore','indole','ironed','legion','linger','lodger','logier','longed','longer','neroli','reding','regild','region','ridgel','ringed','roiled','rondel','eroding','glenoid','gloried','godlier','groined','ignored','lording','negroid','redoing'}; max_score_corr = 12; max_word_corr = {'inholder'}; end [max_score,max_word] = scrabble_scores_12(words,first_word); assert(isequal(max_score,max_score_corr)) assert(isequal(max_word,max_word_corr))

5   Pass
ind = randi(2); switch ind case 1 first_word = 'novels'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'dmvxeao'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'ad','ae','am','an','ax','da','de','do','ed','em','en','ex','ma','me','mo','na','ne','no','od','oe','om','on','ox','ado','and','ane','ave','avo','axe','dam','dan','den','dev','dex','doe','dom','don','emo','end','eon','mad','mae','man','max','med','men','moa','mod','mon','nae','nam','nav','nod','nom','oda','ode','oma','one','ova','van','vex','voe','vox','aeon','amen','axed','axon','dame','damn','dean','demo','deva','dome','dona','done','dove','exam','exon','made','mane','mano','mead','mean','mend','meno','moan','mode','move','moxa','name','nave','nema','node','noma','nome','nova','odea','omen','oven','oxen','vane','vena','vend','admen','amend','anode','axmen','axone','daven','demon','devon','doven','maned','maven','maxed','menad','monad','monde','moved','named','nomad','novae','vaned','venom','daemon','moaned'}; words{2} = {'ad','ae','am','ax','da','de','do','ed','em','ex','ma','me','mo','od','oe','om','ox','ado','ave','avo','axe','dam','dev','dex','doe','dom','emo','mad','mae','max','med','moa','mod','moo','oda','ode','oma','ova','oxo','vex','voe','vox','axed','dame','demo','deva','dome','doom','dove','exam','made','mead','mode','mood','move','moxa','odea','maxed','mooed','moved'}; words{3} = {'ad','ae','am','ax','da','de','do','ed','em','ex','ma','me','mo','od','oe','om','ox','ado','ave','avo','axe','dam','dev','dex','doe','dom','emo','mad','mae','max','med','moa','mod','oda','ode','oma','ova','vav','vex','voe','vox','axed','dame','demo','deva','dome','dove','exam','made','mead','mode','move','moxa','odea','maxed','moved'}; words{4} = {'ad','ae','am','ax','da','de','do','ed','em','ex','ma','me','mo','od','oe','om','ox','ado','ave','avo','axe','dam','dee','dev','dex','doe','dom','eme','emo','eve','mad','mae','max','med','moa','mod','oda','ode','oma','ova','vee','vex','voe','vox','axed','dame','deem','deme','demo','deva','dome','dove','eave','exam','exed','made','mead','meed','mode','move','moxa','odea','adeem','deave','eaved','edema','evade','maxed','moved','vexed','oedema'}; words{5} = {'ad','ae','al','am','ax','da','de','do','ed','el','em','ex','la','lo','ma','me','mo','od','oe','om','ox','ado','ale','ave','avo','axe','dal','dam','del','dev','dex','doe','dol','dom','eld','elm','emo','lad','lam','lav','lax','lea','led','lev','lex','lox','mad','mae','max','med','mel','moa','mod','mol','oda','ode','old','ole','oma','ova','vex','voe','vox','alme','aloe','axed','axel','axle','dale','dame','deal','demo','deva','dole','dome','dove','exam','lade','lame','lave','lead','leva','levo','load','loam','lode','love','made','male','mead','meal','meld','mode','mola','mold','mole','move','moxa','odea','olde','olea','oval','vale','veal','vela','veld','vole','amole','axled','dolma','domal','laevo','lamed','laved','loved','loxed','maxed','medal','modal','model','moved','voled','voxel','loamed'}; words{6} = {'ad','ae','am','as','ax','da','de','do','ed','em','es','ex','ma','me','mo','od','oe','om','os','ox','so','ado','ads','ave','avo','axe','dam','das','dev','dex','doe','dom','dos','eds','emo','ems','mad','mae','mas','max','med','moa','mod','mos','oda','ode','ods','oes','oma','oms','ose','ova','sad','sae','sax','sea','sev','sex','sod','som','sox','vas','vex','voe','vox','ados','aves','avos','axed','axes','dame','dams','demo','deva','devs','does','dome','doms','dosa','dose','dove','emos','exam','made','mads','maes','mead','meds','mesa','moas','mode','mods','move','moxa','odas','odea','odes','omas','oxes','sade','same','save','seam','soda','soma','some','vase','voes','dames','demos','devas','domes','doves','exams','maxed','maxes','meads','modes','moved','moves','moxas','oaves','saved','soave','vadose','vamose','vamosed'}; max_score_corr = 16; max_word_corr = {'vexed'}; case 2 first_word = 'thinning'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'eodnirl'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'diner','doter','droit','drone','elint','eloin','enrol','ident','idler','indol','inert','inlet','inter','intro','irone','lento','lined','liner','lirot','liter','litre','loden','loner','nerol','niter','nitre','nitro','noted','noter','oiled','oiler','olden','older','oldie','olein','oriel','redon','relit','reoil','riled','ronde','teind','teloi','tenor','tilde','tiled','tiler','tined','tired','toile','toled','tondi','toned','toner','trend','tried','trine','triol','trode','trone','dentil','dinero','dotier','editor','entoil','indole','ironed','linted','linter','loiter','neroli','norite','orient','retold','rident','rioted','rodent','roiled','rondel','tinder','tirled','toiled','toiler','tonier','trined','triode','lentoid','retinol','tendril','trindle'}; words{2} = {'dhole','diner','drone','eloin','enrol','helio','heron','hider','hired','holed','honed','honer','horde','idler','indol','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','rhino','riled','ronde','dehorn','dinero','heroin','hinder','hoiden','holden','holder','holier','hondle','honied','horned','indole','ironed','neroli','roiled','rondel','hordein','inholder'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{8} = {'deign','diner','dinge','dingo','dirge','dogie','doing','drone','eloin','enrol','gelid','genro','geoid','giron','glide','goner','gored','gride','grind','groin','idler','indol','ingle','irone','liger','lined','liner','lingo','loden','lodge','login','loner','longe','nerol','ogled','ogler','oiled','oiler','olden','older','oldie','olein','oriel','redon','reign','renig','reoil','ridge','riled','ronde','dinero','dinger','dingle','doling','dongle','eloign','engild','engird','eringo','gilder','girdle','girned','glider','golden','golder','ignore','indole','ironed','legion','linger','lodger','logier','longed','longer','neroli','reding','regild','region','ridgel','ringed','roiled','rondel','eroding','glenoid','gloried','godlier','groined','ignored','lording','negroid','redoing'}; max_score_corr = 12; max_word_corr = {'inholder'}; end [max_score,max_word] = scrabble_scores_12(words,first_word); assert(isequal(max_score,max_score_corr)) assert(isequal(max_word,max_word_corr))

6   Pass
ind = randi(2); switch ind case 1 first_word = 'start'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'aethilm'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'aisle','alist','almeh','almes','amies','email','emits','haems','haets','hails','hales','halms','halts','hames','haste','hates','heals','heats','heils','heist','helms','hemal','hilts','islet','istle','items','laith','lames','lathe','lathi','laths','leash','least','limas','limes','litas','lites','lithe','maile','mails','maist','males','malts','mates','maths','meals','meats','melts','metal','meths','metis','miles','milts','mites','saith','salmi','satem','selah','setal','shale','shalt','shame','sheal','shiel','slate','slime','smalt','smelt','smile','smite','smith','stale','steal','steam','stela','stile','stime','taels','tails','tales','tames','tamis','teals','teams','telia','tesla','thali','tiles','times','almehs','emails','halest','halite','hamlet','haslet','hiemal','lamest','lathes','lathis','latish','mailes','mashie','mesial','metals','misate','miseat','saithe','saltie','samiel','samite','samlet','sheila','shelta','smalti','stelai','tahsil','thalis','theism','atheism','halites','hamlets','heliast'}; words{2} = {'almeh','atilt','email','hemal','laith','lathe','lathi','latte','lithe','maile','matte','metal','telia','thali','theta','tilth','tithe','title','halite','hamlet','hiemal'}; words{3} = {'alate','almah','almeh','email','halma','hamal','hemal','laith','lamia','lathe','lathi','lithe','maile','metal','tamal','telia','thali','althea','haemal','halite','hamate','hamlet','hiatal','hiemal','lamiae','malate','maltha','meatal','tamale','hematal','thalami'}; words{4} = {'aimer','airth','alert','almeh','alter','amrit','ariel','armet','artel','earth','email','haler','harem','hater','heart','hemal','herma','hilar','ihram','irate','ither','laith','lamer','later','lathe','lathi','liter','lithe','litre','maile','mater','merit','metal','miler','mirth','miter','mitre','ramet','ramie','ratel','rathe','realm','relit','remit','retia','taler','tamer','telia','terai','thali','tharm','their','therm','thirl','tiler','timer','trail','trial','armlet','hailer','halier','halite','halter','hamlet','hermai','hermit','hiemal','imaret','lather','lither','mailer','matier','milter','mither','mitral','ramtil','remail','retail','retial','tailer','thairm','thaler','thiram','tramel','lathier','maltier','marlite','thermal'}; words{5} = {'almeh','atilt','email','hemal','laith','lathe','lathi','latte','lithe','maile','matte','metal','telia','thali','theta','tilth','tithe','title','halite','hamlet','hiemal'}; max_score_corr = 12; max_word_corr = {'atheism','hamlets','hematal','thalami','thermal'}; case 2 first_word = 'thinning'; %the starting word; the new word must be played off of a letter in this word tray_letters = 'eodnirl'; %your tray letters; informational (not part of the problem) %all possible words, including each letter of the starting word combined with your tray letters clear words words{1} = {'diner','doter','droit','drone','elint','eloin','enrol','ident','idler','indol','inert','inlet','inter','intro','irone','lento','lined','liner','lirot','liter','litre','loden','loner','nerol','niter','nitre','nitro','noted','noter','oiled','oiler','olden','older','oldie','olein','oriel','redon','relit','reoil','riled','ronde','teind','teloi','tenor','tilde','tiled','tiler','tined','tired','toile','toled','tondi','toned','toner','trend','tried','trine','triol','trode','trone','dentil','dinero','dotier','editor','entoil','indole','ironed','linted','linter','loiter','neroli','norite','orient','retold','rident','rioted','rodent','roiled','rondel','tinder','tirled','toiled','toiler','tonier','trined','triode','lentoid','retinol','tendril','trindle'}; words{2} = {'dhole','diner','drone','eloin','enrol','helio','heron','hider','hired','holed','honed','honer','horde','idler','indol','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','rhino','riled','ronde','dehorn','dinero','heroin','hinder','hoiden','holden','holder','holier','hondle','honied','horned','indole','ironed','neroli','roiled','rondel','hordein','inholder'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{3} = {'diner','drone','eloin','enrol','idler','indie','indol','indri','iodin','irone','lined','liner','loden','loner','nerol','oiled','oiler','olden','older','oldie','olein','oriel','redon','reoil','riled','ronde','dinero','indole','inlier','iodine','ironed','linier','neroli','oilier','roiled','rondel'}; words{4} = {'diner','donne','drone','eloin','enrol','idler','indol','inned','inner','irone','lined','linen','liner','loden','loner','nerol','niner','oiled','oiler','olden','older','oldie','olein','oriel','redon','renin','reoil','riled','ronde','ronin','dinero','dinner','endrin','indole','ironed','linden','neroli','online','roiled','rondel','ronnel'}; words{8} = {'deign','diner','dinge','dingo','dirge','dogie','doing','drone','eloin','enrol','gelid','genro','geoid','giron','glide','goner','gored','gride','grind','groin','idler','indol','ingle','irone','liger','lined','liner','lingo','loden','lodge','login','loner','longe','nerol','ogled','ogler','oiled','oiler','olden','older','oldie','olein','oriel','redon','reign','renig','reoil','ridge','riled','ronde','dinero','dinger','dingle','doling','dongle','eloign','engild','engird','eringo','gilder','girdle','girned','glider','golden','golder','ignore','indole','ironed','legion','linger','lodger','logier','longed','longer','neroli','reding','regild','region','ridgel','ringed','roiled','rondel','eroding','glenoid','gloried','godlier','groined','ignored','lording','negroid','redoing'}; max_score_corr = 12; max_word_corr = {'inholder'}; end [max_score,max_word] = scrabble_scores_12(words,first_word); assert(isequal(max_score,max_score_corr)) assert(isequal(max_word,max_word_corr))