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

3   Pass

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

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))