var nouns = ['a','act','active','activity','age','air','amount','answer','anything','apple','area','arm','army','art','ask','attack',
'baby','back','bad','bag','ball','bank','base','basket','bath','bear','beautiful','bed','bedroom','beer','bell','big','bird','birth','birthday','bit','bite','black','block','blood','blow','blue','board','boat','body','bone','book','border','bottle','bottom','bowl','box','boy','branch','brave','bread','break','breakfast','bridge','brother','brown','brush','burn','business','bus','buy',
'cake','call','can','candle','cap','car','card','care','carry','case','cat','catch','chair','chance','change','chicken','child','chocolate','choice','city','class','clock','clothes','cloud','coffee','coat','cold','comfortable','common','computer','condition','control','cook','corner','cost','count','country','course','cover','crash','cross','cry','cup','cut',
'dance','dark','daughter','day','dead','deep','desk','dinner','direction','dish','dog','door','double','draw','dream','dress','drink','drive','drop','dust','duty',
'ear','earth','east','eat','education','effect','egg','end','equal','entrance','escape','evening','event','examination','example','exercise','eye',
'face','fact','fail','fall','family','farm','father','fat','fault','fear','feed','feel','female','few','fight','fill','film','finger','finish','fire','fish','fix','floor','flower','fly','fold','food','foot','football','force','form','freedom','friend','front','fruit','fun','funny','future',
'game','garden','gate','general','gift','give','glad','glass','go','god','gold','good','grandfather','grandmother','grass','great','green','ground','group',
'hair','half','hall','hand','hat','hate','head','heavy','heart','height','hello','help','hide','high','hit','hold','hole','holiday','home','hope','horse','hospital','hotel','house','hour','hurry','husband','hurt',
'ice','idea','if','increase','inside','iron','invite','island','it',
'job','join','juice','jump',
'keep','key','kill','kind','king','kitchen','knee','knife',
'ladder','lady','land','laugh','lead','leave','leg','length','lesson','let','letter','library','lie','life','light','lip','list','listen','lock','long','look','love','low','luck',
'machine','main','make','male','man','many','map','mark','market','matter','meal','meat','medicine','meet','member','mention','method','middle','milk','mind','minute','miss','mistake','mix','model','moment','money','month','morning','most','mother','mountain','mouth','move','music',
'name','nation','nature','neck','net','news','newspaper','night','noise','north','nose','nothing','notice','number',
'object','offer','office','oil','one','opposite','orange','order','other','outside','page','pain','paint','pair','paper','parent','park','part','partner','party','pass','past','path','pay','peace','pen','people','period','person','piano','pick','picture','piece','pin','place','plane','plant','plastic','plate','play','plenty','point','police','pool','position','possible','potato','power','present','press','price','private','prize','problem','produce','promise','public','pull','push','put',
'queen','question','quiet',
'radio','rain','raise','reach','read','record','red','remove','rent','repair','repeat','reply','report','rest','restaurant','result','return','rice','rich','ride','ring','rise','road','rock','room','round','rule','run','rush',
'sad','safe','sail','salt','sand','save','school','science','search','seat','second','sell','sentence','serve','sex','shake','shape','share','she','shine','ship','shirt','shoe','shoot','shop','shoulder','show','sick','side','signal','silly','silver','simple','single','sing','sink','sister','size','skill','skin','skirt','sky','sleep','slip','smell','smile','smoke','snow','sock','soft','son','sound','soup','south','space','special','speed','spell','spend','sport','spread','spring','square','stand','star','start','station','stay','steal','step','still','stomach','stop','store','storm','story','street','structure','student','study','stupid','subject','substance','sugar','summer','sun','support','surprise','sweet','swim',
'table','talk','taste','tea','teach','team','tear','telephone','television','tell','tennis','test','thing','tie','title','today','toe','tomorrow','tonight','tool','tooth','top','total','touch','town','train','travel','tree','trouble','trust','try','turn','type',
'uncle','unit','use','usual',
'vegetable','village','voice','visit',
'wait','wake','walk','wash','watch','water','way','wear','weather','wedding','week','weight','welcome','west','wheel','while','white','wife','will','win','wind','window','wine','winter','wish','woman','wonder','word','work','world','worry',
'yard','yesterday','you','young',
'two'],
nonNouns=['about','above','across','add','afraid','after','again','ago','agree','all','alone','along','already','always','am','an','and','angry','another','any','anyone','anytime','appear','are','around','arrive','as','at','aunt','autumn','away',
'be','bean','behave','before','begin','behind','below','besides','best','better','between','bleed','boil','born','borrow','both','breathe','bright','bring','build','busy','but','by',
'careful','careless','central','century','certain','chase','cheap','cheese','children','choose','circle','clever','clean','clear','climb','cloth','cloudy','close','coin','collect','colour','comb','compare','come','complete','continue','cool','copper','corn','correct','contain','cupboard',
'dangerous','decide','decrease','deer','depend','destroy','develop','die','different','difficult','dirty','discover','do','down','dry','duck',
'each','early','earn','easy','eight','either','electric','elephant','else','empty','enemy','enjoy','enough','enter','even','ever','every','everyone','exact','everybody','except','excited','expect','expensive','explain','extremely',
'false','famous','far','fast','fever','find','fine','first','fit','five','flag','flat','float','flour','fool','for','foreign','forest','forget','forgive','fork','fox','four','free','freeze','fresh','friendly','from','full','furniture','further',
'gentleman','get','goat','goodbye','grave','gray','grow','gun',
'hammer','happen','happy','hard','have','he','healthy','hear','heaven','hen','her','here','hers','hill','him','his','hobby','hot','how','hundred','hungry',
'i','important','in','into','introduce','invent','is','its',
'jelly','just',
'knock','know',
'lamp','large','last','late','lately','lazy','leaf','learn','left','lend','less','like','lion','little','live','lonely','lose','lot','lower',
'marry','may','me','mean','measure','million','modern','monkey','moon','more','much','must','my',
'narrow','near','nearly','need','needle','neighbour','neither','never','new','next','nice','nine','no','noble','none','nor','not','now',
'obey','ocean','of','off','often','old','on','only','open','or','our','out','over','own',
'pan','pencil','pepper','per','perfect','petrol','photograph','pig','pink','please','pleased','pocket','poison','polite','poor','popular','pour','pretty','prevent','prince','prison','probably','proper','protect','provide','punish','pupil',
'quick','quite',
'rainy','ready','real','really','receive','remember','remind','right','rob','rubber','rude','ruler',
'same','say','scissors','see','seem','send','seven','several','shade','shadow','sharp','sheep','sheet','shelf','short','should','shout','silence','similar','since','sit','six','slow','small','so','soap','some','someone','something','sometimes','soon','sorry','speak','spoon','stamp','steam','stone','strange','strong','successful','such','sudden','suitable','sunny','sure','sword',
'take','tall','taxi','ten','terrible','than','that','the','their','then','there','therefore','these','thick','thin','think','third','this','though','threat','three','tidy','to','together','too','tram','true','twice',
'ugly','under','understand','until','up','useful','usually',
'very',
'want','warm','was','waste','we','weak','were','well','wet','what','when','where','which','who','why','wide','wild','wire','wise','with','without',
'yell','yet','your',
'zero','zoo',
'once'];
f=
s=>!/^([aouz]|th|..$)|e.+[ey]|[flo].r|a.p/.test(s)
//truthy:
tnoun = 0;
nouns.forEach(s=>tnoun += f(s));
console.log('Nouns: ' + tnoun + ' correct');
//falsy:
tnonNoun = 0;
nonNouns.forEach(s=>tnonNoun += !f(s));
console.log('Non-nouns: ' + tnonNoun + ' correct');
console.log('Total: ' + (tnoun + tnonNoun) + ' correct');
Just as I was about to comment, with JS specifically in mind, that the byte limit was far too restrictive, you post this! I was thinking, without having looked at the list, that a better score than 586 might just be possible by testing the first letter or 2 in each word. Nicely done :) – Shaggy – 2017-08-12T21:39:39.367
An explanation would be nice, for people less familiar with Javascript. As far as I can tell, this checks whether the word length is 3, 4, 5, 6, 7, 8 or 11, and the word also starts with one of a set of letters? – isaacg – 2017-08-12T22:01:11.290
@isaacg That's correct. Explanation added. – Arnauld – 2017-08-12T22:14:48.173
4Note that the character class
[bcdf-mp-tvwy]
is equivalent to the class[^aenouxz]
. A change would save 4 bytes, which could be capitalized on. – fireflame241 – 2017-08-12T22:14:49.353@fireflame241 Very true. And that can even be shortened to
[^aenouz]
because we don't have any word starting with ax
. – Arnauld – 2017-08-12T22:19:01.123I wonder (again, without having looked at the list): could you use the bytes fireflame saved you to add a check for the 2nd letter and increase your score. I'm coming off the back of an 80 hour week so I'm not even sure that makes sense to me! Just thought it was worth the suggestion. – Shaggy – 2017-08-12T22:58:11.713
I think
y
does not improve the score at all (I thinkbcdfghijklmpqrstvw
suffice). Maybe you can do something with that byte. – Mr. Xcoder – 2017-08-13T10:34:26.953@Shaggy I was too tired to work on that one any further yesterday evening. Rick has since done a much better work in JS, so I've switched to Jelly instead. ;-) – Arnauld – 2017-08-13T16:19:45.590