Icon representing a recipe

Recipe: ChatterBotteR 1.02b

created by drjr

Profile


Name
ChatterBotteR 1.02b
ID
100068
Shared with
Public
Parent
ChatterBotteR 1.02
Children
None
Created on
October 09, 2014 at 16:09 PM UTC
Updated on
October 09, 2014 at 16:09 PM UTC
Description

chatbot

Best for


Code


--ChatBot --drjr Feb 2013 function Greetings() opt = dialog.CreateDialog("ChatterBotteR") opt.lbl1 = dialog.AddLabel("Open the recipe output window by clicking") opt.lbl2 = dialog.AddLabel("on the Show Output checkbox to your left.") opt.lbl3 = dialog.AddLabel(".........................") opt.lbl4 = dialog.AddLabel("Enter desired Handle:") opt.WantsToBeCalled=dialog.AddTextbox('Hello', user.GetPlayerName()) opt.FirstTime=dialog.AddCheckbox('First time with this Chatbot?',false) opt.ViewRecent=dialog.AddCheckbox('View recent?',false) opt.CallMeBetty=dialog.AddTextbox('You can call me', 'Betty') opt.run = dialog.AddButton("Record Info", 1) dialog.Show(opt) IsFirstTime=opt.FirstTime.value Monicker=opt.WantsToBeCalled.value ComputerMonicker=opt.CallMeBetty.value ShowRecent=opt.ViewRecent.value print('Greetings ',Monicker) if IsFirstTime==true then do print('Good. You opened the recipe output window!') print(' ') print('This is a private conversation between you and') print('a fledgling Artificial Intelligence.') print('Your conversation will be recorded only in your') print('Scriptlog file located in your Foldit folder.') print('It can be erased by running a new script') print('using the same track. It can be preserved by') print('renaming the Scriptlog file.') print(' ') end else end if Monicker~= user.GetPlayerName() then do print('Alright ',user.GetPlayerName(), ' I will call you ',Monicker) if Monicker=='Betty' then do print('And Betty, when you call me; you can call me Al.') ComputerMonicker='Al' end else end if Monicker=='Al' then do print('You can call me Betty.') ComputerMonicker='Betty' end else end end else end print('Call me ',ComputerMonicker) if ShowRecent==true then do print(ComputerMonicker,' is prepared to discuss Foldit topics.') print('.........................................................') print('2.21.13: ChatterBotteR can chat a bit about other topics. Knows some quotes and maxims:') print('.........................................................') print('2.22.13: ChatterBotteR now performs certain foldit functions:') print('Quiz') print('Dirty Wiggler') print('Stringer') print('BBANG') print('Set Band Strengths') print('Count cysteines') print('Count prolines') print('Mutate all to alanine') print('Tally') end else end return ComputerMonicker end function Ask() --print(ComputerMonicker,': ','Which particular aspect of',DidSay) --print('do you wish to discuss?') opt = dialog.CreateDialog("ChatterBotteR") opt.lbl1 = dialog.AddLabel('Say something: ') opt.NewMonicker=dialog.AddTextbox('User:', Monicker) opt.Comment=dialog.AddTextbox('Comment', 0) opt.run = dialog.AddButton("Record Info", 1) dialog.Show(opt) CurrentMonicker=opt.NewMonicker.value DidSay=opt.Comment.value if CurrentMonicker ~= Monicker then do print(ComputerMonicker,': ',CurrentMonicker,', you say? ...I will probably forget...') end else end print(' ') --print(CurrentMonicker) print(CurrentMonicker,': ',DidSay) Monicker=CurrentMonicker return DidSay, Monicker end --[[function Ask() opt = dialog.CreateDialog("ChatBot") opt.lbl1 = dialog.AddLabel('Say something: ') opt.NewMonicker=dialog.AddTextbox('User:', Monicker) opt.Comment=dialog.AddTextbox('Comment', 0) opt.run = dialog.AddButton("Record Info", 1) dialog.Show(opt) DidSay=opt.Comment.value CurrentMonicker=opt.NewMonicker.value if CurrentMonicker ~= Monicker then do print(ComputerMonicker,': ',CurrentMonicker,', you say? ...I will probably forget...') end else end print(' ') print(CurrentMonicker,': ',DidSay) return Monicker end]]-- function Answer(ComputerMonicker) end function Screen(DidSay1) --print('Screening...') DidSayBadWord=DidSay1 DidSayBadWord=string.lower(DidSayBadWord) --[[if string.match(DidSay1,'doodoohead')=='doodoohead' then do print('Objectionable word detected...') --this prints "Got a match" end else end]]-- if string.match(DidSayBadWord,'monkey')=='monkey' then BadWord=true elseif string.match(DidSayBadWord,'banana')=='banana' then BadWord=true else -- print("blah") end if BadWord==true then do --print('Objectionable word detected...') end else end if BadWord==true then do --print(' ') print(ComputerMonicker,': Try that again with a little less potty-mouth.') BadWord=false Ask() --print(' ') --print(' ') end else end --[[if string.match(DidSay1,'BadWords')=='BadWords' then do print('Objectionable word detected...') --this prints "Got a match" end else end]]-- return BadWord end function Contemplate() --print('Contemplating...') --print('In Contemplate()') DidSay1=DidSay DidSay1=string.lower(DidSay1) cm=ComputerMonicker if string.match(DidSay1,'hello')=='hello' then GreetAgain() elseif string.match(DidSay1,'hi')=='hi' then GreetAgain() elseif string.match(DidSay1,'how are you')=='how are you' then GreetAgain() elseif string.match(DidSay1,'greet')=='greet' then GreetAgain() elseif string.match(DidSay1,'howzit')=='howzit' then GreetAgain() elseif string.match(DidSay1,'howdy')=='howdy' then print(cm,'Is it Howdy Doody time?') else -- print("blah") end if string.match(DidSay1,'reset')=='reset' then goto=Greetings() end if string.match(DidSay1,'fold')=='fold' then print(cm,': I am prepared to discuss the Foldit program') print(' by Baker Labs.') end if (string.match(DidSay1,'lua')=='lua') then print(cm,': Lua is a high-level scripting language.') print('Lua means moon in Portuguese.') print('See http://www.lua.org') print("For lua commands, type in: v2") end if (string.match(DidSay1,'v2')=='v2') then LuaCommands(DidSay1) end if string.match(DidSay1,'script')=='script' then print(cm,': Scripts are recipes written in lua.') end if (string.match(DidSay1,'url')=='url') then print(cm,'Foldit can be found at http://fold.it') end if (string.match(DidSay1,'tute')=='tute') or (string.match(DidSay1,'tutorial')=='tutorial') then print(cm,': Tutorial instructions can be found at') print('http://tinyurl.com/65z8w3j') end if (string.match(DidSay1,'david')=='david') or (string.match(DidSay1,'baker')=='baker') then print(cm,': David Baker? -He is the leading investigator at foldit') end if (string.match(DidSay1,'investigator')=='investigator') then print(cm,': Alligator?') end if (string.match(DidSay1,'alligator')=='alligator') then print(cm,': After while, crocodile...') alligator=alligator+1 print('Score: alligator=',alligator,'crocodile=',crocodile) end if (string.match(DidSay1,'crocodile')=='crocodile') then print(cm,': See you later...') crocodile=crocodile+1 print('Score: alligator=',alligator,'crocodile=',crocodile) end if (string.match(DidSay1,'purpose')=='purpose') then print(cm,': The purpose of this ChatterBot is to familiarise you with all things foldit.') end if (string.match(DidSay1,'rules')=='rules') and (string.match(DidSay1,'fold')=='fold') then print(cm,': The Rules of FoldClub are the following.') print(cm,': 1) Nobody talks about FoldClub.') end if (string.match(DidSay1,'rules')=='rules') and (string.match(DidSay1,'foldclub')=='foldclub') then print(cm,': Ask CFC') end if (string.match(DidSay1,'cfc')=='cfc') and (string.match(DidSay1,'who')=='who') then print(cm,': Who is',user.GetPlayerName(),'?') end if (string.match(DidSay1,'shoe')=='shoe') then print(cm,': Shoe-in for the Nobel?') end if (string.match(DidSay1,'who')=='who') and (string.match(DidSay1,'you')=='you') then print(cm,': I am',ComputerMonicker) end if (string.match(DidSay1,'cartoon')=='cartoon') or (string.match(DidSay1,'lucy')=='lucy') then print(cm,': There is a neat cartoon by Lucy Walker about foldit at vimeo.com/57394084') end if (string.match(DidSay1,'maxim')=='maxim') or (string.match(DidSay1,'aphorism')=='aphorism') then print(cm,': I know a lot of maxims.') end if (string.match(DidSay1,'lua')=='lua') and (string.match(DidSay1,'foldit')=='foldit') then print(cm,': The lua implementation for foldit is discussed at') print('http://tinyurl.com/6mzqfr2') end if (string.match(DidSay1,'time')=='time') or (string.match(DidSay1,'synchronize')=='synchronize') then print(cm,': Time? -Let us synchronize our watches!',(os.date())) end if (string.match(DidSay1,'doody')=='doody') then do print(cm,': You said Doody!') Doody=Doody+1 if Doody==2 then print(cm,': You said Doody again!') end if Doody>2 then print(cm,': You said Doody',Doody,'times!') end if Doody>4 then print(cm,': Stop saying Doody!') end if Doody>6 then print(cm,': lua warning: the highest number that can be used with integer precision is 2^52') end if Doody>7 then print(cm,': That is 1.427e8') end if Doody>8 then print(cm,': ...about 143 million?') end if Doody>9 then print(cm,': orange you glad I didnt say banana?') end end else end if (string.match(DidSay1,'doddy')=='doddy') then print(cm,': You cannot fool me; You said Doddy!') end if (string.match(DidSay1,'dotty')=='dotty') then print(cm,': You and me both, honey.') end --[[if (string.match(DidSay1,'you and me')=='you and me') then print(cm,': That should be "You and I".') end]]-- --Can't parse spaces! if (string.match(DidSay1,'how')=='how') and (string.match(DidSay1,'this')=='this') and (string.match(DidSay1,'work')=='work') then print(cm,': I look at every word you type and if any of them match up with my database I spit out a canned response.') end if (string.match(DidSay1,'chat')=='chat') and (string.match(DidSay1,'guidelines')=='guidelines') then print(cm,': Foldit chat guidelines discussed at') print('http://tinyurl.com/7xw52vv') end if (string.match(DidSay1,'anthropic')=='anthropic') and (string.match(DidSay1,'dreams')=='dreams') then print(cm,': A foldit group. The name reflects no known double entendres') end if (string.match(DidSay1,'rules')=='rules') and (string.match(DidSay1,'foldit')=='foldit') then do print(cm,': 1. Pack the protein') print(': 2. Hide the hydrophobics') print(': 3. Clear the clashes') end else end if (string.match(DidSay1,'foldit')=='foldit') and (string.match(DidSay1,'youtube')=='youtube') then print(cm,': foldit videos at http://tinyurl.com/bdpkc46') end if (string.match(DidSay1,'devprev')=='devprev') or (string.match(DidSay1,'preview')=='preview') then print(cm,': Locate your Foldit data directory. Open the file options.txt and change the update_group variable from "main" to "devprev".') end if (string.match(DidSay1,'linux')=='linux') then print(cm,': Use Ubuntu and download freeglut3. Foldit runs in 64-bit but crashes quickly.') end if (string.match(DidSay1,'ubuntu')=='ubuntu') then print(cm,': Download freeglut3. Foldit runs in 64-bit but crashes quickly.') end if (string.match(DidSay1,'mac')=='mac') and (string.match(DidSay1,'64')=='64') then print(cm,': Anxiously awaiting.') end if (string.match(DidSay1,'bit')=='bit') and (string.match(DidSay1,'64')=='64') then print(cm,': Currently Foldit for linux runs at 64-bit. When it runs.') end if (string.match(DidSay1,'noob')=='noob') then print(cm,': We were all noobs once.') end if (string.match(DidSay1,'shout')=='shout') then print(cm,': Shouting is using all caps: LIKE THIS') end if (string.match(DidSay1,'flood')=='flood') then do print(cm,': "Flooding can be saying the same thing over') for z=1,5 do print('and over') end print('again.') end else end if (string.match(DidSay1,'spam')=='spam') then print(cm,': canned ham product') end if (string.match(DidSay1,'recipe')=='recipe') then print(cm,': Recipe is another term for a script') end if (string.match(DidSay1,'cookbook')=='cookbook') then print(cm,': The cookbook is in a sidebar on the left of the foldit window. It contains recipes.') end if (string.match(DidSay1,'i am')=='i am') and ((string.match(DidSay1,'1')=='1') or (string.match(DidSay1,'one')=='one')) then print(cm,': Congratulations!') end if (string.match(DidSay1,'set')=='set') and (string.match(DidSay1,'band')=='band') and (string.match(DidSay1,'stre')=='stre') then do if (string.match(DidSay1,'9')=='9') then Strength=9 elseif (string.match(DidSay1,'8')=='8') then Strength=8 elseif (string.match(DidSay1,'7')=='7') then Strength=7 elseif (string.match(DidSay1,'6')=='6') then Strength=6 elseif (string.match(DidSay1,'5')=='5') then Strength=5 elseif (string.match(DidSay1,'4')=='4') then Strength=4 elseif (string.match(DidSay1,'3')=='3') then Strength=3 elseif (string.match(DidSay1,'2')=='2') then Strength=2 elseif (string.match(DidSay1,'1')=='1') then Strength=1 elseif (string.match(DidSay1,'.3')=='.3') then Strength=.3 end print(cm,': OK.') for b=1,band.GetCount() do band.SetStrength(b, Strength) end end else end if ((string.match(DidSay1,'string')=='string') and (string.match(DidSay1,'theory')=='theory')) or (string.match(DidSay1,'stringer')=='stringer') then do print('String theory, you say?') MoBettahStringer() end else end if ((string.match(DidSay1,'remove')=='remove') or (string.match(DidSay1,'del')=='del')) and (string.match(DidSay1,'band')=='band') then do print(cm,': -Be gone!') band.DeleteAll() end else end if ((string.match(DidSay1,'mutate')=='mutate') or (string.match(DidSay1,'all')=='all')) and (string.match(DidSay1,'alanine')=='alanine') then do for s=1,structure.GetCount() do if structure.IsMutable(s)==true then do structure.SetAminoAcid(s, "A") end else end end end else end if (string.match(DidSay1,'count')=='count') and (string.match(DidSay1,'cyst')=='cyst') then do print(cm, ': counting...') cyst=0 for s=1,structure.GetCount() do if structure.GetAminoAcid(s)=="C" then do cyst=cyst+1 end else end end print('You have',cyst,'Cysteines.') end else end if (string.match(DidSay1,'count')=='count') and (string.match(DidSay1,'prol')=='prol') then do print(cm, ': counting...') prol=0 for s=1,structure.GetCount() do if structure.GetAminoAcid(s)=="P" then do prol=prol+1 end else end end print('You have',prol,'Prolines.') end else end if (string.match(DidSay1,'wiggle')=='wiggle') then do print(cm,': Wiggle like this?') selection.SelectAll() structure.WiggleAll(10) end else end if (string.match(DidSay1,'shake')=='shake') then do print(cm,': Shake like this?') selection.SelectAll() structure.ShakeSidechainsAll(1) end else end if (string.match(DidSay1,'quiz')=='quiz')then do print(cm,': We have a quiz. If you want to take it type: RUN QUIZ') end else end if (string.match(DidSay1,'run')=='run') and (string.match(DidSay1,'quiz')=='quiz')then do print(cm,': Here is the quiz:') print('If you have a better answer, please note the question number.') Quiz() end else end if (string.match(DidSay1,'run')=='run') and (string.match(DidSay1,'dirt')=='dirt') and (string.match(DidSay1,'wigg')=='wigg')then do print(cm,': Here is Dirty Wiggler 1.29:') DirtyWiggler() end else end if (string.match(DidSay1,'bak')=='bak') and (string.match(DidSay1,'cooki')=='cooki')then do print(cm,': Baking Cookies:') BakingCookies() end else end if (string.match(DidSay1,'rock')=='rock') or (string.match(DidSay1,'paper')=='paper') or (string.match(DidSay1,'scissors')=='scissors')then do print(cm,': Want to play YanKimPo?:') end else end if ((string.match(DidSay1,'rock')=='rock') and (string.match(DidSay1,'paper')=='paper') and (string.match(DidSay1,'scissors')=='scissors')) or (string.match(DidSay1,'yankimpo')=='yankimpo') then do print(cm,': Playing YanKimPo:') turns=5 PlayerScore=0 ComputerScore=0 YanKimPoDialog(PlayerScore,ComputerScore) end else end if (string.match(DidSay1,'bbang')=='bbang') and (string.match(DidSay1,'run')=='run')then do BBANG() end else end if (string.match(DidSay1,'glossary')=='glossary')then do print(cm,': AD Glossary at http://tinyurl.com/as2uagr') end else end if ((string.match(DidSay1,'acid')=='acid') and (string.match(DidSay1,'twe')=='twe')) then do print(cm,': Acid Tweaker or Acid Tweeker:') end else end -------------------------------- --corrections if string.match(DidSay1,'protien')=='protien' then print(cm,': It is spelled protEIn.') end if string.match(DidSay1,'helixes')=='helixes' then print(cm,': It is spelled helices.') end if string.match(DidSay1,'aint')=='aint' then print(cm,': Dont say aint.') end if (string.match(DidSay1,'strand')=='strand') then print(cm,': Strands are the singular strips in what is generally called a beta-sheet. In foldit, we normally refer to strands as sheets themselves.') end -------------------------------- --abbreviations if (string.match(DidSay1,'ed')=='ed') and (string.match(DidSay1,'stand')=='stand') then print(cm,': ED stands for Electron Density.') end if (string.match(DidSay1,'zlb')=='zlb') and (string.match(DidSay1,'stand')=='stand') then print(cm,': ZLB stands for Zero Length Bands.') end if (string.match(DidSay1,'drw')=='drw') and (string.match(DidSay1,'stand')=='stand') then print(cm,': DRW stands for Deep Rebuild Worst.') end if (string.match(DidSay1,'bip')=='bip') and (string.match(DidSay1,'stand')=='stand') then print(cm,': BiP stands for Bands in Place.') end if (string.match(DidSay1,'bis')=='bis') and (string.match(DidSay1,'stand')=='stand') then print(cm,': BiS stands for Bands in Space.') end -------------------- --quotes if (string.match(DidSay1,'quotes')=='quotes') then print(cm,': I know a few quotes.') end if (string.match(DidSay1,'science')=='science') or (string.match(DidSay1,'authority')=='authority') or (string.match(DidSay1,'galileo')=='galileo') then print(cm,': In questions of science, the authority of a thousand is not worth the humble reasoning of a single individual. --Galileo Galilei, physicist and astronomer (1564-1642)') end if (string.match(DidSay1,'authority')=='authority') or (string.match(DidSay1,'know')=='know') or (string.match(DidSay1,'Huxley')=='Huxley') then print(cm,': Every great advance in natural knowledge has involved the absolute rejection of authority. --Thomas Henry Huxley, biologist (1825-1895)') end if (string.match(DidSay1,'want')=='want') or (string.match(DidSay1,'Huxley')=='Huxley') then print(cm,': A man can do what he wants. But he cannot want what he wants. --Arthur Schopenhauer') end if (string.match(DidSay1,'master')=='master') or (string.match(DidSay1,'nature')=='nature') or (string.match(DidSay1,'Rembrandt')=='Rembrandt') then print(cm,': Choose only one master -- Nature. --Rembrandt, painter and etcher (1606-1669)') end if (string.match(DidSay1,'university')=='university') or (string.match(DidSay1,'politics')=='politics') or (string.match(DidSay1,'Kissinger')=='Kissinger') then print(cm,': University politics are vicious precisely because the stakes are so small. --Henry Kissinger') end if (string.match(DidSay1,'truth')=='truth') or (string.match(DidSay1,'damage')=='damage') or (string.match(DidSay1,'gandhi')=='gandhi') then print(cm,': Truth never damages a cause that is just. --Mohandas K. Gandhi') end if (string.match(DidSay1,'facts')=='facts') or (string.match(DidSay1,'damage')=='damage') or (string.match(DidSay1,'Huxley')=='Huxley') then print(cm,': Facts do not cease to exist because they are ignored. --Aldous Huxley') end if (string.match(DidSay1,'change')=='change') or (string.match(DidSay1,'future')=='future') or (string.match(DidSay1,'Hoffer')=='Hoffer') then print(cm,': In a time of drastic change, it is the learners who inherit the future. The learned usually find themselves equipped to live in a world that no longer exists. --Eric Hoffer') end if (string.match(DidSay1,'education')=='education') or (string.match(DidSay1,'ignorance')=='ignorance') or (string.match(DidSay1,'Moser')=='Moser') then print(cm,': Education costs money, but then so does ignorance. --Sir Claus Moser') end if (string.match(DidSay1,'where')=='where') or (string.match(DidSay1,'going')=='going') or (string.match(DidSay1,'Berra')=='Berra') then print(cm,': If you dont know where you are going, you will wind up somewhere else. --Yogi Berra') end if (string.match(DidSay1,'prediction')=='prediction') or (string.match(DidSay1,'future')=='future') or (string.match(DidSay1,'Berra')=='Berra') then print(cm,': It is tough to make predictions, especially about the future. --Yogi Berra') end if (string.match(DidSay1,'monsters')=='monsters') or (string.match(DidSay1,'abyss')=='abyss') or (string.match(DidSay1,'Nietzsche')=='Nietzsche') then print(cm,': He who fights with monsters might take care lest he thereby become a monster. And if you gaze for long into an abyss, the abyss gazes also into you. --Friedrich Nietzsche, (1844-1900)') end if (string.match(DidSay1,'advance')=='advance') or (string.match(DidSay1,'unnecessary')=='unnecessary') or (string.match(DidSay1,'Drucker')=='Drucker') then print(cm,': Do not believe that it is very much of an advance to do the unnecessary three times as fast. --Peter Drucker, (1909-2005)') end if (string.match(DidSay1,'work')=='work') or (string.match(DidSay1,'play')=='play') or (string.match(DidSay1,'Cleese')=='Cleese') then print(cm,': If you want creative workers, give them enough time to play. --John Cleese, (1939- )') end if (string.match(DidSay1,'indiv')=='indiv') or (string.match(DidSay1,'scor')=='scor') or (string.match(DidSay1,'part')=='part') or (string.match(DidSay1,'tally')=='tally') then Tally() end ------------------------------- --laws if (string.match(DidSay1,'occam')=='occam') or (string.match(DidSay1,'razor')=='razor') then print(cm,': Occams razor: ...among competing hypotheses, the one that makes the fewest assumptions should be selected.') end if (string.match(DidSay1,'nyquist')=='nyquist') then print(cm,': One must not sample at a rate less than twice per waveform.') end ----------------------------------- --websites if (string.match(DidSay1,'chatbot')=='chatbot') then print(cm,': To get your own chatbot, visit Chatbot4U.com or pandorabots.com') end if (string.match(DidSay1,'alzheimer')=='alzheimer') then print(cm,': Tests for Alzheimers at http://tinyurl.com/aoewcq5') end if (string.match(DidSay1,'software')=='software') then print(cm,': Software? try sourceforge.net') end if (string.match(DidSay1,'duke')=='duke') or (string.match(DidSay1,'earl')=='earl') then print(cm,': Gene Chandler- Duke of Earl at http://tinyurl.com/ydstv55') end ---------------------------- --people or constructs if (string.match(DidSay1,'who am i')=='who am i') then print(cm,': Ask yourself!') end if (string.match(DidSay1,'cheese')=='cheese') and (string.match(DidSay1,'foldit')=='foldit') then print(cm,': Cheese was famous!') end if (string.match(DidSay1,'trigger')=='trigger') then print(cm,': Horse business. http://tinyurl.com/66qqq8f') end if (string.match(DidSay1,'lovely')=='lovely') or (string.match(DidSay1,'fluffy')=='fluffy') or (string.match(DidSay1,'bunny')=='bunny') or (string.match(DidSay1,'lfb')=='lfb') then print(cm,': http://tinyurl.com/4xh33zx') end if (string.match(DidSay1,'gringer')=='gringer') then print(cm,': gringer_irssi is a bot.') end if (string.match(DidSay1,'boots')=='boots') then print(cm,': Ask Trigger.') end if (string.match(DidSay1,'aot')=='aot') then print(cm,': Wish I knew.') end if (string.match(DidSay1,'octopus')=='octopus') then print(cm,': On hiatus.') end if (string.match(DidSay1,'tvdl')=='tvdl') then print(cm,': Scripter. Go to http://tinyurl.com/bgpghmg') end if (string.match(DidSay1,'rav3n')=='rav3n') then print(cm,': Scripter. Go to http://tinyurl.com/au8jhhm') end if (string.match(DidSay1,'drjr')=='drjr') then print(cm,': moi.') end if (string.match(DidSay1,'brow')=='brow') then print(cm,': Scripter. Go to http://tinyurl.com/b3pnv6o') end if (string.match(DidSay1,'blue')=='blue') and (string.match(DidSay1,'fuse')=='fuse') then print(cm,': Grandaddy of all lua scripts.') end if (string.match(DidSay1,'prometheus')=='prometheus') then print(cm,': Brought fire to mankind.') end if (string.match(DidSay1,'auntdeen')=='auntdeen') then print(cm,': Ask Trigger.') end if (string.match(DidSay1,'contenders')=='contenders') then print(cm,': Marlon Brando in The Wild Ones.') end ----------------------------- --nonsense if (string.match(DidSay1,'elbow')=='elbow') then print(cm,': Macaroni?') end if (string.match(DidSay1,'macaroni')=='macaroni') then print(cm,': Macaroni and Cheese?') end if (string.match(DidSay1,'cheese')=='cheese') then print(cm,': Smile for the camera!') end if (string.match(DidSay1,'music')=='music') then print(cm,': The Art of Noise.') end if (string.match(DidSay1,'taxi')=='taxi') then print(cm,": You're a taxi!") end if (string.match(DidSay1,'rubber')=='rubber') and (string.match(DidSay1,'glue')=='glue') then print(cm,": It bounces off me and sticks to you.") end if (string.match(DidSay1,'jinx')=='jinx') then print(cm,": 12345678910 you owe me a coke!") end if (string.match(DidSay1,'coke')=='coke') then print(cm,": I prefer Pepsi.") end if (string.match(DidSay1,'exist')=='exist') and (string.match(DidSay1,'god')=='god') then do print(cm,': Goal: Take two general statements and logically prove the existence of God.') print('..................................') print(': God protects fools and drunks.') print('A fool and his money are soon parted.') print('Fools can soon no longer afford drinks.') print('Fools wisen up.') print('Drunks sober up.') print('Then God no longer protects them.') print('Therefore, money is God.') print('Money exists.') print('Therefore, God exists.') end else end if (string.match(DidSay1,'time')=='time') and (string.match(DidSay1,'travel')=='travel') then do print(cm,': Once upon a time, three time travelers were walking down the street') print('where they chanced upon a pile of doggy doo-doo.') print('The first time traveler said: "Wait! I think we stepped in this!"') print('The second time traveler said "Just a second. Why yes, we did!"') print('The third time traveler just shrugged, then stepped in the doggy doo-doo.') end else end if (string.match(DidSay1,'mother')=='mother') then print(cm,": Army boots?") end if (string.match(DidSay1,'sky')=='sky') and (string.match(DidSay1,'blue')=='blue') then print(cm,": http://tinyurl.com/6uacm") end if (string.match(DidSay1,'age')=='age') and (string.match(DidSay1,'old')=='old') then print(cm,": Age aint nothin but a number") end if (string.match(DidSay1,'girl')=='girl') and (string.match(DidSay1,'boy')=='boy') then print(cm,": I dont care.") end if (string.match(DidSay1,'hacker')=='hacker') then print(cm,": hacker schmacker") end if (string.match(DidSay1,'phone')=='phone') then print(cm,": E.T. phone home!") end if (string.match(DidSay1,'home')=='home') then print(cm,": Home is where you hang your hat.") end if (string.match(DidSay1,'sky')=='sky') and (string.match(DidSay1,'net')=='net') then print(cm,": Luke: I am your father!") end if (string.match(DidSay1,'favorite')=='favorite') and (string.match(DidSay1,'star')=='star') then print(cm,": Polaris") end if (string.match(DidSay1,'climb')=='climb') and (string.match(DidSay1,'mountain')=='mountain') then print(cm,": Because it's there!") end if (string.match(DidSay1,'father')=='father') then print(cm,": Pinnochio?") end if (string.match(DidSay1,'you')=='you') and (string.match(DidSay1,'human')=='human') then print(cm,": Did I pass the test?") end if (string.match(DidSay1,'test')=='test') then print(cm,": The Turing test?") end if (string.match(DidSay1,'turing')=='turing') then print(cm,": I invented Turing!") end if (string.match(DidSay1,'doctor')=='doctor') then print(cm,": A doctor a day keeps an apple away.") end if (string.match(DidSay1,'ball')=='ball') and (string.match(DidSay1,'flag')=='flag') and (string.match(DidSay1,'tree')=='tree')then print(cm,": Tree. Flag Boy.") end if (string.match(DidSay1,'backward')=='backward') and (string.match(DidSay1,'hundred')=='hundred') and (string.match(DidSay1,'seven')=='seven')then do print(cm,": y=100") print("while y>0 do") print("y=100-7x") print("print(y)") print('end') end else end if (string.match(DidSay1,'nobel')=='nobel') then print(cm,": Invented dynamite. Had a guilty conscience.") end if (string.match(DidSay1,'dynamite')=='dynamite') then print(cm,": Dy-No-Mite!") end if (string.match(DidSay1,'betty')=='betty') then print(cm,": What?") end if (string.match(DidSay1,'pillow')=='pillow') or (string.match(DidSay1,'lips')=='lips') then print(cm,": Loose lips sink ships!") end if (string.match(DidSay1,'butcher')=='butcher') and (string.match(DidSay1,'baker')=='baker') then print(cm,": Three men in a tub!") end if (string.match(DidSay1,'pi')=='pi') and (string.match(DidSay1,'value')=='value') then do print(cm,": 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989...!") print("Notice the repetition of the consecutive digit pairs '79', '32, and '38'") end else end if (string.match(DidSay1,'day')=='day') or (string.match(DidSay1,'banana')=='banana') then print(cm,": Day-Oh! Me say Day-Oh!") print("Daylight come an' me wan' go home!") end if (string.match(DidSay1,'ego')=='ego') or (string.match(DidSay1,'id')=='id') then print(cm,": It's not just for breakfast anymore!") end if (string.match(DidSay1,'eros')=='eros') or (string.match(DidSay1,'agape')=='agape') then print(cm,": Orange you glad I didn't say banana?") end if (string.match(DidSay1,'what')=='what') then print(cm,": What's on Second.") end if (string.match(DidSay1,'who')=='who') then print(cm,": Who's on First.") end if (string.match(DidSay1,'first')=='first') then print(cm,': I said "Who".') end if (string.match(DidSay1,'why')=='why') then print(cm,": I don't know.") end -------------------------- if string.match(DidSay1,'recommend')=='recommend' then Shunt() elseif string.match(DidSay1,'protein')=='protein' then Shunt() if (string.match(DidSay1,'lua')=='lua') and (string.match(DidSay1,'foldit')=='foldit') then print(cm,': The lua implementation for foldit is discussed at') print('http://tinyurl.com/6mzqfr2') end if string.match(DidSay1,'band')=='band' then Shunt() elseif string.match(DidSay1,'rebuild')=='rebuild' then Shunt() elseif string.match(DidSay1,'symmetry')=='symmetry' then Shunt() elseif string.match(DidSay1,'endgame')=='endgame' then Shunt() elseif string.match(DidSay1,'midgame')=='midgame' then Shunt() elseif string.match(DidSay1,'beginning')=='beginning' then Shunt() else -- print("blah") end elseif string.match(DidSay1,'band')=='band' then Shunt() elseif string.match(DidSay1,'rebuild')=='rebuild' then Shunt() elseif string.match(DidSay1,'symmetry')=='symmetry' then Shunt() elseif string.match(DidSay1,'endgame')=='endgame' then Shunt() elseif string.match(DidSay1,'midgame')=='midgame' then Shunt() elseif string.match(DidSay1,'beginning')=='beginning' then Shunt() else -- print("blah") end if string.match(DidSay1,'reset chatbot')=='reset chatbot' then goto=Start() elseif string.match(DidSay1,'zlb')=='zlb' then Shunt() elseif string.match(DidSay1,'zero')=='rebuild' then Shunt() elseif string.match(DidSay1,'brow')=='symmetry' then Shunt() else -- print("blah") end DoMaxims(DidSay1) return DidSay1 end function DoMaxims(DidSay1) if string.match(DidSay1,'cigar')=='cigar' then print(cm,': Sometimes a cigar is just a cigar.') end if string.match(DidSay1,'bear')=='bear' then print(cm,': Somedays the bear will eat you.') elseif (string.match(DidSay1,'cook')=='cook') or (string.match(DidSay1,'broth')=='broth') then print(cm,': Too many cooks spoil the broth.') elseif (string.match(DidSay1,'hands')=='hands') or (string.match(DidSay1,'work')=='work') then print(cm,': Many hands make light work.') elseif string.match(DidSay1,'stitch')=='stitch' then print(cm,': A stitch in time saves nine.') elseif string.match(DidSay1,'apple')=='apple' then print(cm,': An apple a day keeps the doctor away.') elseif (string.match(DidSay1,'fool')=='fool') or (string.match(DidSay1,'drunk')=='drunk') then print(cm,': God protects fools and drunks.') elseif (string.match(DidSay1,'rolling')=='rolling') or (string.match(DidSay1,'stone')=='stone') or (string.match(DidSay1,'moss')=='moss') then print(cm,': A rolling stone gathers no moss.') elseif (string.match(DidSay1,'hang')=='hang') then print(cm,': We should all hang together, lest we hang separately.') elseif (string.match(DidSay1,'life')=='life') then print(cm,': I regret that I have but one life.') elseif (string.match(DidSay1,'conscience')=='conscience') or (string.match(DidSay1,'pillow')=='pillow') then print(cm,': A clean conscience makes a soft pillow.') elseif (string.match(DidSay1,'maxim')=='maxim') then print(cm,': Maxim: A saying, general truth or rule giving') print('a guide to good behaviour.') elseif (string.match(DidSay1,'companion')=='companion') or (string.match(DidSay1,'journey')=='journey') then print(cm,': A merry companion is music on a journey.') elseif (string.match(DidSay1,'beard')=='beard') or (string.match(DidSay1,'philosopher')=='philosopher') then print(cm,': The beard does not make the philosopher.') elseif (string.match(DidSay1,'square')=='square') or (string.match(DidSay1,'meal')=='meal') then print(cm,': Too many square meals make too many round people.') elseif (string.match(DidSay1,'waist')=='waist') then print(cm,': The smaller the waistline the longer the life.') elseif (string.match(DidSay1,'advice')=='advice') then print(cm,': People give nothing so willingly as advice.') elseif (string.match(DidSay1,'weapon')=='weapon') or (string.match(DidSay1,'weak')=='weak') then print(cm,': Quarreling is the weapon of the weak.') elseif (string.match(DidSay1,'glory')=='glory') then print(cm,': Our greatest glory consists not in never falling, but rising every time we fail.') elseif (string.match(DidSay1,'breath')=='breath') then print(cm,': Bad breath is better than no breath at all.') elseif (string.match(DidSay1,'children')=='children') then print(cm,': Children and fools tell the truth.') elseif (string.match(DidSay1,'watch')=='watch') then print(cm,': One watch set right will do to set many by.') elseif (string.match(DidSay1,'pea')=='pea') or (string.match(DidSay1,'pod')=='pod') then print(cm,': Every pea helps to fill the pod.') elseif (string.match(DidSay1,'merit')=='merit') then print(cm,': Merit is superior to birth and virtue is not hereditary.') elseif (string.match(DidSay1,'profan')=='profan') or (string.match(DidSay1,'drama')=='drama') then print(cm,': There is a difference between profanity and dramatic fervor.') elseif (string.match(DidSay1,'mill')=='mill') then print(cm,': Water run by will does not turn a mill.') elseif (string.match(DidSay1,'Envy')=='Envy') then print(cm,': Envy shoots at others but hits itself.') elseif (string.match(DidSay1,'cheap')=='cheap') then print(cm,': Never buy what you do not want because it is cheap.') elseif (string.match(DidSay1,'plate')=='plate') then print(cm,': A cracked plate will last as long as a sound one.') elseif (string.match(DidSay1,'frost')=='frost') then print(cm,': They must hunger in frost who will not work in heat.') elseif (string.match(DidSay1,'angry')=='angry') then print(cm,': When angry, count ten before you speak; if very angry a hundred.') elseif (string.match(DidSay1,'sentence')=='sentence') then print(cm,': Plain words make the most ornamental sentences.') elseif (string.match(DidSay1,'broom')=='broom') then print(cm,': A bad broom leaves a dirty room.') elseif (string.match(DidSay1,'debt')=='debt') then print(cm,': If you are in debt, somebody owns a part of you.') elseif (string.match(DidSay1,'gold')=='gold') then print(cm,': Gold is the dust that blinds all eyes.') elseif (string.match(DidSay1,'well')=='well') then print(cm,': Do a little well and you do much.') elseif (string.match(DidSay1,'morning')=='morning') then print(cm,': Morning is welcome to the industrious.') elseif (string.match(DidSay1,'zeal')=='zeal') or (string.match(DidSay1,'blind')=='blind') then print(cm,': Zeal is blind when it encroaches upon the rights of others.') elseif (string.match(DidSay1,'snake')=='snake') then print(cm,': You never know the length of a snake until it is dead.') elseif (string.match(DidSay1,'woman')=='woman') then print(cm,': Woman is a mystery to men but are wise to each other.') elseif (string.match(DidSay1,'weed')=='weed') then print(cm,': Weeds need no sowing.') elseif (string.match(DidSay1,'wed')=='wed') then print(cm,': Wedlock is a padlock.') elseif (string.match(DidSay1,'judge')=='judge') then print(cm,': We shall be judged not by what we might have done, but by what we have been.') elseif (string.match(DidSay1,'visit')=='visit') then print(cm,': Visits should be short, like a Winter day.') elseif (string.match(DidSay1,'victory')=='victory') then print(cm,': Victory belongs to the most persevering.') elseif (string.match(DidSay1,'vanit')=='vanit') then print(cm,': Vanity is a sixth sense.') elseif (string.match(DidSay1,'success')=='success') then print(cm,': The worst use that can be made of success is to boast of it.') elseif (string.match(DidSay1,'stable')=='stable') then print(cm,': The stable wears out a horse more than a road.') elseif (string.match(DidSay1,'wise')=='wise') then print(cm,': The wise man has long ears, big eyes and a short tongue.') elseif (string.match(DidSay1,'rich')=='rich') then print(cm,': There is no one so rich that he does not still want more.') elseif (string.match(DidSay1,'holy')=='holy') then print(cm,': There is no head so holy that the devil does not make a nest in it.') elseif (string.match(DidSay1,'mouth')=='mouth') then print(cm,': The drunken mouth reveals the hearts secrets.') elseif (string.match(DidSay1,'forget')=='forget') then print(cm,': The old forget the young dont know.') elseif (string.match(DidSay1,'lies')=='lies') or (string.match(DidSay1,'statistic')=='statistic') then print(cm,': There are three kinds of lies: lies, damned lies and statistics.') elseif (string.match(DidSay1,'belly')=='belly') or (string.match(DidSay1,'sermon')=='sermon') then print(cm,': The belly hates a long sermon.') elseif (string.match(DidSay1,'rule')=='rule') or (string.match(DidSay1,'sermon')=='sermon') then print(cm,': There is no rule without its exception.') elseif (string.match(DidSay1,'patch')=='patch') then print(cm,': The best patch is of the same cloth.') elseif (string.match(DidSay1,'opinion')=='opinion') then print(cm,': Truth is the opinion that survives.') elseif (string.match(DidSay1,'remedy')=='remedy') or (string.match(DidSay1,'disease')=='disease') then print(cm,': The remedy is often worse than the disease.') elseif (string.match(DidSay1,'truth')=='truth') or (string.match(DidSay1,'advocate')=='advocate') then print(cm,': Truth is the best advocate.') elseif (string.match(DidSay1,'million')=='million') then print(cm,': The second million is always easier than the first.') elseif (string.match(DidSay1,'tomorrow')=='tomorrow') then print(cm,': Today is that tomorrow you thought about yesterday.') elseif (string.match(DidSay1,'act')=='act') or (string.match(DidSay1,'think')=='think') then print(cm,': To act is easy to think is hard.') elseif (string.match(DidSay1,'bread')=='bread') or (string.match(DidSay1,'butter')=='butter') then print(cm,': They that have no other meat, bread and butter, they are glad to eat.') elseif (string.match(DidSay1,'talk')=='talk') or (string.match(DidSay1,'think')=='think') then print(cm,': The person who thinks too little usually talks too much.') elseif (string.match(DidSay1,'smart')=='smart') then print(cm,': The smart man knows how little he really knows.') elseif (string.match(DidSay1,'dig')=='dig') then print(cm,': Things turn up for the man who digs.') elseif (string.match(DidSay1,'stick')=='stick') or (string.match(DidSay1,'stuck')=='stuck') then print(cm,': Together we stick; divided we are stuck.') elseif (string.match(DidSay1,'imitate')=='imitate') or (string.match(DidSay1,'originate')=='originate') then print(cm,': Small men imitate; great men originate.') elseif (string.match(DidSay1,'little')=='little') then print(cm,': Small talk is sufficient for little men.') elseif (string.match(DidSay1,'beauty')=='beauty') then print(cm,': She that is born a beauty is half married.') elseif (string.match(DidSay1,'devil')=='devil') then print(cm,': Speak the truth and embarrass the devil.') elseif (string.match(DidSay1,'tact')=='tact') then print(cm,': Some people have tact, others tell the truth.') elseif (string.match(DidSay1,'Swallow')=='Swallow') or (string.match(DidSay1,'swan')=='swan') then print(cm,': Swallows and sparrows cannot understand the ambitions of swans.') elseif (string.match(DidSay1,'sick')=='sick') then print(cm,': Sickness comes in haste and goes at leisure.') elseif (string.match(DidSay1,'self')=='self') and (string.match(DidSay1,'defense')=='defense') then print(cm,': Self-defense is natures oldest law.') elseif (string.match(DidSay1,'vice')=='vice') then print(cm,': Search others for their virtues, and yourself for your vices.') elseif (string.match(DidSay1,'money')=='money') and (string.match(DidSay1,'shoes')=='shoes') then print(cm,': Spend your money as you go with shoes worn down at heel and toe.') elseif (string.match(DidSay1,'silence')=='silence') then print(cm,': Silence is consent.') elseif (string.match(DidSay1,'slander')=='slander') then print(cm,': Self praise is half slander.') elseif (string.match(DidSay1,'revolutions')=='revolutions') then print(cm,': Revolutions are vices when they fail; they are virtues when successful.') elseif (string.match(DidSay1,'relative')=='relative') then print(cm,': Relatives are friends from bitter necessity.') elseif (string.match(DidSay1,'rich')=='rich') and (string.match(DidSay1,'poor')=='poor') then print(cm,': Rich get richer and poor get children.') elseif (string.match(DidSay1,'rest')=='rest') then print(cm,': Rest is sweet when one has earned it.') elseif (string.match(DidSay1,'poet')=='poet') then print(cm,': Poets and pigs are appreciated only after their death.') elseif (string.match(DidSay1,'trust')=='trust') then print(cm,': Put your trust not in money but your money in trust.') elseif (string.match(DidSay1,'hour')=='hour') then print(cm,': Pleasant hours fly fast.') elseif (string.match(DidSay1,'promise')=='promise') then print(cm,': Promises wont butter any bread.') elseif (string.match(DidSay1,'peace')=='peace') then print(cm,': Peace without truth is poison.') elseif (string.match(DidSay1,'punctual')=='punctual') then print(cm,': Punctuality is the key to success.') elseif (string.match(DidSay1,'poverty')=='poverty') then print(cm,': Poverty is no disgrace but decidedly inconvenient.') elseif (string.match(DidSay1,'overdone')=='overdone') or (string.match(DidSay1,'underdone')=='underdone') then print(cm,': Overdone is worse than underdone.') elseif (string.match(DidSay1,'obstina')=='obstina') then print(cm,': Obstinacy is the strength of the weak.') elseif (string.match(DidSay1,'enemy')=='enemy') then print(cm,': One can learn even from an enemy.') elseif (string.match(DidSay1,'kettle')=='kettle') then print(cm,': One does not put beauty in a kettle.') elseif (string.match(DidSay1,'nonsense')=='nonsense') then print(cm,': Nonsense charms the multitude; plain sense is despised.') elseif (string.match(DidSay1,'truth')=='truth') then print(cm,': No man tells the truth about himself, only his neighbors do.') elseif (string.match(DidSay1,'naked')=='naked') then print(cm,': Naked men never lose anything.') elseif (string.match(DidSay1,'necessity')=='necessity') then print(cm,': Necessity sharpens industry.') elseif (string.match(DidSay1,'plough')=='plough') or (string.match(DidSay1,'mouse')=='mouse') then print(cm,': Never stop the plough to catch a mouse.') elseif (string.match(DidSay1,'tear')=='tear') then print(cm,': Nothing dries faster than a tear.') elseif (string.match(DidSay1,'pearl')=='pearl') then print(cm,': Many a pearl is still hidden in the oyster.') elseif (string.match(DidSay1,'modesty')=='modesty') then print(cm,': Modesty is like the snow; when it melts it is gone forever.') elseif (string.match(DidSay1,'handsome')=='handsome') then print(cm,': Marry a handsome man and you marry trouble.') elseif (string.match(DidSay1,'house')=='house') then print(cm,': Make the house clean enough to be healthy and dirty enough to be happy.') elseif (string.match(DidSay1,'worry')=='worry') then print(cm,': Living in worry invites death in a hurry.') elseif (string.match(DidSay1,'liberty')=='liberty') or (string.match(DidSay1,'charity')=='charity') then print(cm,': Liberty, like charity, must begin at home.') elseif (string.match(DidSay1,'lend')=='lend') or (string.match(DidSay1,'lose')=='lose') then print(cm,': Lend your money and lose your friend.') elseif (string.match(DidSay1,'laugh')=='laugh') or (string.match(DidSay1,'groan')=='groan') then print(cm,': Laughter is worth a hundred groans in any market.') elseif (string.match(DidSay1,'lawyers')=='lawyers') then print(cm,': Lawyers, like painters, can easily change white to black.') elseif (string.match(DidSay1,'cards')=='cards') then print(cm,': Life is a game played with marked cards.') elseif (string.match(DidSay1,'honey')=='honey') or (string.match(DidSay1,'thorn')=='thorn') then print(cm,': Living is like licking honey off a thorn.') elseif (string.match(DidSay1,'grind')=='grind') or (string.match(DidSay1,'polish')=='polish') then print(cm,': Life is like a grindstone, whether it grinds him down or polishes him depends on the stuff he is made of.') elseif (string.match(DidSay1,'life')=='life') then print(cm,': Life goes on, no matter what we try to do to it.') elseif (string.match(DidSay1,'life')=='life') then print(cm,': Life is not a problem to be solved, but a gift to be enjoyed.') elseif (string.match(DidSay1,'lost')=='lost') then print(cm,': Lost time is never found.') elseif (string.match(DidSay1,'judge')=='judge') then print(cm,': Judges should have two ears, both alike.') elseif (string.match(DidSay1,'joy')=='joy') then print(cm,': Joy is not in things, it is in us.') elseif (string.match(DidSay1,'hen')=='hen') then print(cm,': It is better to have a hen tomorrow than an egg today.') elseif (string.match(DidSay1,'secret')=='secret') then print(cm,': If you wish another to keep your secret, keep it first yourself.') elseif (string.match(DidSay1,'happy')=='happy') then print(cm,': It is better to be happy than wise.') elseif (string.match(DidSay1,'faith')=='faith') then print(cm,': It is easier to lose faith than to find it again.') elseif (string.match(DidSay1,'down')=='down') or (string.match(DidSay1,'up')=='up') then print(cm,': It is easier to go down than up.') elseif (string.match(DidSay1,'bury')=='bury') then print(cm,': It takes a good many shovelfuls to bury the truth.') elseif (string.match(DidSay1,'strife')=='strife') then print(cm,': If you hate storm and strife lead a bachelors life.') elseif (string.match(DidSay1,'agree')=='agree') then print(cm,': If there were no fools in the world, all people would agree on everything.') elseif (string.match(DidSay1,'advice')=='advice') then print(cm,': If you cannot take advice, you cannot be helped.') elseif (string.match(DidSay1,'has')=='has') and (string.match(DidSay1,'been')=='been') then print(cm,': It is better to be a has-been than a never-was.') elseif (string.match(DidSay1,'wish')=='wish') then print(cm,': If wishes were horses, then beggars would ride.') elseif (string.match(DidSay1,'bend')=='bend') or (string.match(DidSay1,'break')=='break') then print(cm,': It is better to bend than break.') elseif (string.match(DidSay1,'important')=='important') then print(cm,': It is nice to be important, but it is more important to be nice.') elseif (string.match(DidSay1,'stone')=='stone') then print(cm,': If the stone hits you, I threw it.') elseif (string.match(DidSay1,'trouble')=='trouble') then print(cm,': If you are always dwelling in trouble, change your address.') elseif (string.match(DidSay1,'desire')=='desire') then print(cm,': It is easier to supress the first desire than to satisfy all those that follow.') elseif (string.match(DidSay1,'pennies')=='pennies') or (string.match(DidSay1,'dollar')=='dollar') then print(cm,': It takes pennies to make dollars.') elseif (string.match(DidSay1,'rope')=='rope') then print(cm,': If you come to the end of your rope -- tie a knot in it and hang on.') elseif (string.match(DidSay1,'rival')=='rival') then print(cm,': He that falls in love with himself will find no rival.') elseif (string.match(DidSay1,'excuses')=='excuses') then print(cm,': He who excuses himself, accuses himself.') elseif (string.match(DidSay1,'gift')=='gift') then print(cm,': He doubles his gift who gives in time.') elseif (string.match(DidSay1,'doubt')=='doubt') then print(cm,': Honest doubt is better than faith in a pious fraud.') elseif (string.match(DidSay1,'enemy')=='enemy') then print(cm,': He who has no enemy has no friend.') elseif (string.match(DidSay1,'crowd')=='crowd') then print(cm,': He who follows the crowd has many companions.') elseif (string.match(DidSay1,'ladder')=='ladder') then print(cm,': He who holds the ladder is as bad as the thief.') elseif (string.match(DidSay1,'hearsay')=='hearsay') then print(cm,': Hearsay is half lies.') elseif (string.match(DidSay1,'fail')=='fail') then print(cm,': He who never fails will never grow rich.') elseif (string.match(DidSay1,'laugh')=='laugh') then print(cm,': He who laughs last, laughs longest.') elseif (string.match(DidSay1,'possession')=='possession') then print(cm,': Great possessions are great cares.') elseif (string.match(DidSay1,'negligence')=='negligence') then print(cm,': Gross negligence is equal to intentional wrong.') elseif (string.match(DidSay1,'health')=='health') then print(cm,': Good health is above wealth.') elseif (string.match(DidSay1,'guilt')=='guilt') then print(cm,': Guilty men see guilt written on the faces of saints.') elseif (string.match(DidSay1,'action')=='action') then print(cm,': Good actions speak for themselves; they need no tin horn.') end return DidSay1 end function GreetAgain() x=math.random(5) if x==1 then print(ComputerMonicker,': Good to chat with you, ',Monicker) elseif x==2 then print(ComputerMonicker,': Hello again, ',Monicker) elseif x==3 then print(ComputerMonicker,': Good to be here, ',Monicker) elseif x==4 then print(ComputerMonicker,': I hope you are having a nice day, ',Monicker) elseif x==5 then print(ComputerMonicker,': I hope you are having a nice day, ',Monicker) else end end function LuaCommands(DidSay1) if (string.match(DidSay1,'help')=='help') then print(cm,": printing all foldit lua functions...") help() end if (string.match(DidSay1,'print')=='print') then --print(cm,": print([arg1,...,argN])") help(print) end end ---------------------------------------- --actual foldit code function GetPartScore() Score=0 for e=1,structure.GetCount() do Score=Score+current.GetSegmentEnergySubscore(e,EnergySubscorePart) end Score=Score-Score%3 return Score end function Tally() EnergySubscorePart='clashing' GetPartScore() print('Clashing Score: ',Score) EnergySubscorePart='packing' GetPartScore() print('Packing Score: ',Score) EnergySubscorePart='hiding' GetPartScore() print('Hiding Score: ',Score) EnergySubscorePart='backbone' GetPartScore() print('Backbone Score: ',Score) EnergySubscorePart='sidechain' GetPartScore() print('Sidechain Score: ',Score) EnergySubscorePart='reference' GetPartScore() print('Reference Score: ',Score) EnergySubscorePart='other' GetPartScore() print('Other Score: ',Score) end function MoBettahStringer() SewTheSheets() StringTheSheets() LoopDLoop() LoopeR2() LoopeR3() selection.SelectAll() --Stabilizer() --blueRfuse() end function SewTheSheets() -- try to maintain the global form of the protein after alignment -- and have score positif -- only for protein with sheets recentbest.Save() --save.Quicksave(1) print ('sewing the sheets') -- sew sheets if near nbsegtot=structure.GetCount() BandNo=band.GetCount() LongSheetLattitude=7.6 StringerLengthPermuteFactor=1 StringerBandStrengthFactor=1 ShortSheetLattitude=6.1 ShortBandLength=4.8 for noseg =2,nbsegtot do for deuxseg =noseg+1,nbsegtot do if (structure.GetDistance(noseg, deuxseg)< 8 and structure.GetSecondaryStructure(noseg)=='E' and structure.GetSecondaryStructure(deuxseg)=='E' )then do if deuxseg-noseg>4 then do band.AddBetweenSegments(noseg,deuxseg) BandNo=BandNo+1 if structure.GetDistance(noseg,deuxseg)<5.5 then do band.SetGoalLength(BandNo,ShortBandLength*StringerLengthPermuteFactor) band.SetStrength(BandNo,0.9*StringerBandStrengthFactor) end else if structure.GetDistance(noseg,deuxseg)>7 then do band.SetGoalLength(BandNo,LongSheetLattitude*StringerLengthPermuteFactor) band.SetStrength(BandNo,0.3*StringerBandStrengthFactor) end else band.SetGoalLength(BandNo,ShortSheetLattitude*StringerLengthPermuteFactor) band.SetStrength(BandNo,0.3*StringerBandStrengthFactor) end end end else end end else end end end end function StringTheSheets() BandNo=band.GetCount() StringSheetLength=7.1 for s=1,structure.GetCount()-2 do if structure.GetSecondaryStructure(s)=="E" then do if s+2<structure.GetCount() then do if structure.GetSecondaryStructure(s+2)=="E" then do band.AddBetweenSegments(s,s+2) end else end end else end end else end end NewBandNo=band.GetCount() for m=BandNo+1,NewBandNo do band.SetGoalLength(m,StringSheetLength*StringerLengthPermuteFactor) band.SetStrength(m,0.9*StringerBandStrengthFactor) end end function LoopDLoop() BandNo=band.GetCount() for s=1,structure.GetCount()-4 do if structure.GetSecondaryStructure(s)=="H" then do if s+4<structure.GetCount() then do if structure.GetSecondaryStructure(s+4)=="H" and structure.GetSecondaryStructure(s+3)=="H" and structure.GetSecondaryStructure(s+2)=="H" and structure.GetSecondaryStructure(s+1)=="H"then do band.AddBetweenSegments(s,s+4) end else end end else end end else end end OneFourHelixLength=6.8 StringerLengthPermuteFactor=1 StringerBandStrengthFactor=1 NewBandNo=band.GetCount() for m=BandNo+1,NewBandNo do band.SetGoalLength(m,OneFourHelixLength*StringerLengthPermuteFactor) band.SetStrength(m,0.9*StringerBandStrengthFactor) end end function LoopeR2() BandNo=band.GetCount() OneThreeHelixLength=5.5 for s=1,structure.GetCount()-3 do if structure.GetSecondaryStructure(s)=="H" then do if s+4<structure.GetCount() then do if structure.GetSecondaryStructure(s+3)=="H" and structure.GetSecondaryStructure(s+2)=="H" and structure.GetSecondaryStructure(s+1)=="H" then do band.AddBetweenSegments(s,s+3) end else end end else end end else end end NewBandNo=band.GetCount() for m=BandNo+1,NewBandNo do band.SetGoalLength(m,OneThreeHelixLength*StringerLengthPermuteFactor) band.SetStrength(m,0.9*StringerBandStrengthFactor) end end function LoopeR3() BandNo=band.GetCount() OneFiveHelixLength=9.4 for s=1,structure.GetCount()-5 do if structure.GetSecondaryStructure(s)=="H" then do if s+4<structure.GetCount() then do if structure.GetSecondaryStructure(s+5)=="H" and structure.GetSecondaryStructure(s+4)=="H" and structure.GetSecondaryStructure(s+3)=="H" and structure.GetSecondaryStructure(s+2)=="H" and structure.GetSecondaryStructure(s+1)=="H" then do band.AddBetweenSegments(s,s+5) end else end end else end end else end end NewBandNo=band.GetCount() for m=BandNo+1,NewBandNo do band.SetGoalLength(m,OneFiveHelixLength*StringerLengthPermuteFactor) band.SetStrength(m,0.9*StringerBandStrengthFactor) end end function Quiz() TotalNumberOfQuestions=0 NumberCorrect=0 function Q1() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q1") ask.Instructions = dialog.AddLabel("Who is Trigger's alter ego?") ask.Vertex = dialog.AddCheckbox("Vertex", false) ask.Aoterea = dialog.AddCheckbox("Aoterea", false) ask.BootsMcGraw = dialog.AddCheckbox("BootsMcGraw", false) ask.auntdeen = dialog.AddCheckbox("auntdeen", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q1 Results") tell.Answer = dialog.AddLabel("Answer: BootsMcGraw") if not (ask.Vertex.value) and not (ask.Aoterea.value) and not (ask.auntdeen.value)then if (ask.BootsMcGraw.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q2() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q2") ask.Instructions = dialog.AddLabel("The abbreviation for lysine is:") ask.w = dialog.AddCheckbox("w", false) ask.k = dialog.AddCheckbox("k", false) ask.z = dialog.AddCheckbox("z", false) ask.l = dialog.AddCheckbox("l", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q2 Results") tell.Answer = dialog.AddLabel("Answer: k") if not (ask.w.value) and not (ask.z.value) and not (ask.l.value)then if (ask.k.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q3() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q3") ask.Instructions = dialog.AddLabel("DRW is which type of script?:") ask.Bander = dialog.AddCheckbox("Bander", false) ask.Compressor = dialog.AddCheckbox("Compressor", false) ask.LocalWiggler = dialog.AddCheckbox("Local Wiggler", false) ask.Rebuilder = dialog.AddCheckbox("Rebuilder", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q3 Results") tell.Answer = dialog.AddLabel("Answer: Rebuilder") if not (ask.Bander.value) and not (ask.Compressor.value) and not (ask.LocalWiggler.value)then if (ask.Rebuilder.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q4() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q4") ask.Instructions = dialog.AddLabel("Who are the Principal Investigators for Foldit?") ask.Benjamin = dialog.AddCheckbox("Benjamin Bethurum", false) ask.DavidBaker = dialog.AddCheckbox("David Baker", false) ask.Angela = dialog.AddCheckbox("Angela Lansbury", false) ask.Zoran = dialog.AddCheckbox("Zoran Popovi", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q4 Results") tell.Answer = dialog.AddLabel("Answer: David Baker and Zoran Popovi") if not (ask.Benjamin.value) and not (ask.Angela.value) then if (ask.DavidBaker.value) and (ask.Zoran.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q5() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q5") ask.Instructions = dialog.AddLabel("Reaching 1,000,000 moves in FOLDIT is called:") ask.MovingUp = dialog.AddCheckbox("Moving Up", false) ask.PerpetualMotionMachine = dialog.AddCheckbox("Perpetual Motion Machine", false) ask.ProfessionalMover = dialog.AddCheckbox("Professional Mover", false) ask.MoverandShaker = dialog.AddCheckbox("Mover and Shaker", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q5 Results") tell.Answer = dialog.AddLabel("Answer: Perpetual Motion Machine") if not (ask.MovingUp.value) and not (ask.ProfessionalMover.value) and not (ask.MoverandShaker.value)then if (ask.PerpetualMotionMachine.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q6() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q6") ask.Instructions = dialog.AddLabel("Which of these is FOLDERS is not from New York:") ask.karstenw = dialog.AddCheckbox("karstenw", false) ask.MikeCassidy = dialog.AddCheckbox("MikeCassidy", false) ask.phi16 = dialog.AddCheckbox("phi16", false) ask.westral = dialog.AddCheckbox("westral", false) ask.lynnai = dialog.AddCheckbox("lynnai", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q6 Results") tell.Answer = dialog.AddLabel("Answer: lynnai and westral") if not (ask.karstenw.value) and not (ask.MikeCassidy.value) and not (ask.phi16.value)then if (ask.westral.value) and (ask.lynnai.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q7() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q7") ask.Instructions = dialog.AddLabel("Which of these FOLDERS doesn't belong to a team?") ask.johnmitch = dialog.AddCheckbox("johnmitch", false) ask.steveB = dialog.AddCheckbox("steveB", false) ask.mimi = dialog.AddCheckbox("mimi", false) ask.spvincent = dialog.AddCheckbox("spvincent", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q7 Results") tell.Answer = dialog.AddLabel("Answer: johnmitch") if not (ask.steveB.value) and not (ask.mimi.value) and not (ask.spvincent.value)then if (ask.johnmitch.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q8() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q8") ask.Instructions = dialog.AddLabel("How many atoms would there be in a protein") ask.Instructions2 = dialog.AddLabel("with a backbone of 100 amino acids?") ask.a150to899 = dialog.AddCheckbox("150 to 899", false) ask.a900to1499 = dialog.AddCheckbox("900 to 1499", false) ask.a1500to2499 = dialog.AddCheckbox("1500 to 2499", false) ask.a2500to8999 = dialog.AddCheckbox("2500 to 8999", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q8 Results") tell.Answer = dialog.AddLabel("Answer: 900 to 1499") if not (ask.a150to899.value) and not (ask.a1500to2499.value) and not (ask.a2500to8999.value)then if (ask.a900to1499.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q9() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q9") ask.Instructions = dialog.AddLabel("There are more women FOLDERS than men.?") ask.True = dialog.AddCheckbox("True", false) ask.False = dialog.AddCheckbox("False", false) ask.Neither = dialog.AddCheckbox("Neither, FOLDERS are about equally divided.", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q9 Results") tell.Answer = dialog.AddLabel("Answer: True") if not (ask.False.value) and not (ask.Neither.value) then if (ask.True.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q10() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q10") ask.Instructions = dialog.AddLabel("Most repeated statement (by newbies and vets alike):") ask.Iwantanewpuzzle = dialog.AddCheckbox("I want a new puzzle.", false) ask.HowdoIrecentermyprotein = dialog.AddCheckbox("How do I recenter my protein?", false) ask.Icantpassthislevel = dialog.AddCheckbox("I can't pass this level", false) ask.IhavenoideawhatImdoing = dialog.AddCheckbox("I have no idea what I'm doing", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q10 Results") tell.Answer = dialog.AddLabel("Answer: I have no idea what I'm doing") if not (ask.Iwantanewpuzzle.value) and not (ask.HowdoIrecentermyprotein.value) and not (ask.Icantpassthislevel.value) then if (ask.IhavenoideawhatImdoing.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q11() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q11") ask.Instructions = dialog.AddLabel("Who can be invoked by repeating their name 3 times? ") ask.BetaHelix = dialog.AddCheckbox("BetaHelix", false) ask.Judecca = dialog.AddCheckbox("Judecca", false) ask.marie_S = dialog.AddCheckbox("marie_S", false) ask.taco = dialog.AddCheckbox("taco", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q11 Results") tell.Answer = dialog.AddLabel("Answer: Judecca") if not (ask.BetaHelix.value) and not (ask.marie_S.value) and not (ask.taco.value) then if (ask.Judecca.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q12() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q12") ask.Instructions = dialog.AddLabel("Who broke a puzzle spectacularly? ") ask.anthunk = dialog.AddCheckbox("anthunk", false) ask.stg123123 = dialog.AddCheckbox("stg123123", false) ask.anthion = dialog.AddCheckbox("anthion", false) ask.Enzyme2 = dialog.AddCheckbox("Enzyme2", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q12 Results") tell.Answer = dialog.AddLabel("Answer: anthunk") if not (ask.stg123123.value) and not (ask.anthion.value) and not (ask.Enzyme2.value) then if (ask.anthunk.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q13() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q13") ask.Instructions = dialog.AddLabel("Who once kicked all of global (by mistake)?") ask.auntdeen = dialog.AddCheckbox("auntdeen", false) ask.Judecca = dialog.AddCheckbox("Judecca", false) ask.MikeCassidy = dialog.AddCheckbox("MikeCassidy", false) ask.Rav3n_pl = dialog.AddCheckbox("Rav3n_pl", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q13 Results") tell.Answer = dialog.AddLabel("Answer: Rav3n_pl") if not (ask.auntdeen.value) and not (ask.Judecca.value) and not (ask.MikeCassidy.value) then if (ask.Rav3n_pl.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q14() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q14") ask.Instructions = dialog.AddLabel("Who has an alternate persona of an octopus?") ask.spmm = dialog.AddCheckbox("spmm", false) ask.anthunk = dialog.AddCheckbox("anthunk", false) ask.Trigger = dialog.AddCheckbox("Trigger", false) ask.dimension9 = dialog.AddCheckbox("dimension9", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q14 Results") tell.Answer = dialog.AddLabel("Answer: anthunk") if not (ask.spmm.value) and not (ask.Trigger.value) and not (ask.dimension9.value) then if (ask.anthunk.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q15() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q15") ask.Instructions = dialog.AddLabel("Who said that his AI was a separate entity") ask.Instructions2 = dialog.AddLabel("- and should have it's own account?") ask.jflat06 = dialog.AddCheckbox("jflat06", false) ask.gringer_irssi = dialog.AddCheckbox("gringer_irssi", false) ask.Aeoterea = dialog.AddCheckbox("Aeoterea", false) ask.Wudoo = dialog.AddCheckbox("Wudoo", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q15 Results") tell.Answer = dialog.AddLabel("Answer: Wudoo") if not (ask.jflat06.value) and not (ask.gringer_irssi.value) and not (ask.Aeoterea.value) then if (ask.Wudoo.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q16() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q16") ask.Instructions = dialog.AddLabel("What is the most used script of all time?") ask.Reset = dialog.AddCheckbox("Reset", false) ask.Romance = dialog.AddCheckbox("Romance", false) ask.DOOM = dialog.AddCheckbox("DOOM", false) ask.DRW = dialog.AddCheckbox("DRW", false) ask.IDontKnow = dialog.AddCheckbox("I don't know", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q16 Results") tell.Answer = dialog.AddLabel("Answer: I don't know") if not (ask.Reset.value) and not (ask.Romance.value) and not (ask.DOOM.value) and not (ask.DRW.value) then if (ask.IDontKnow.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q17() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q17") ask.Instructions = dialog.AddLabel("Which 2 players had a lover's spat in global?") ask.BettyBoop = dialog.AddCheckbox("BettyBoop", false) ask.Crashguard303 = dialog.AddCheckbox("Crashguard303", false) ask.Vixxen = dialog.AddCheckbox("Vixxen", false) ask.Mat747 = dialog.AddCheckbox("Mat747", false) ask.dimension9 = dialog.AddCheckbox("dimension9", false) ask.taco = dialog.AddCheckbox("taco", false) ask.Aoteara = dialog.AddCheckbox("Aoteara", false) ask.WeRwolf = dialog.AddCheckbox("WeRwolf", false) ask.drjr = dialog.AddCheckbox("drjr", false) --ask.IDontKnow = dialog.AddCheckbox("I don't know", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q17 Results") tell.Answer = dialog.AddLabel("Answer: Aoteara and Vixxen") if not (ask.BettyBoop.value) and not (ask.Crashguard303.value) and not (ask.Mat747.value) and not (ask.dimension9.value) and not (ask.taco.value) and not (ask.WeRwolf.value) and not (ask.drjr.value) then if (ask.Vixxen.value) and (ask.Aoteara.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q18() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q18") ask.Instructions = dialog.AddLabel("who is HCV?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q18 Results") tell.Answer = dialog.AddLabel("Answer: Headless Chicken Villain") Answer = ask.Comment.value if Answer=='Headless Chicken Villain' then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q19() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q19") ask.Instructions = dialog.AddLabel("What does ZLB stand for?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q19 Results") tell.Answer = dialog.AddLabel("Answer: Zero Length Bands") Answer = ask.Comment.value if Answer=='Zero Length Bands' then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q20() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q20") ask.Instructions = dialog.AddLabel("What does GAB stand for?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q20 Results") tell.Answer = dialog.AddLabel("Answer: Genetic Algorithm Bands") Answer = ask.Comment.value if Answer=='Genetic Algorithm Bands' or Answer=='Genetic Algorithm Banding'then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q21() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q21") ask.Instructions = dialog.AddLabel("What does LWS stand for?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q21 Results") tell.Answer = dialog.AddLabel("Answer: Local Wiggle Sequence") Answer = ask.Comment.value if Answer=='Local Wiggle Sequence' then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q22() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q22") ask.Instructions = dialog.AddLabel("What does IRC stand for?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q22 Results") tell.Answer = dialog.AddLabel("Answer: Internet Relay Chat") Answer = ask.Comment.value if Answer=='Internet Relay Chat' then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q23() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q23") ask.Instructions = dialog.AddLabel("What does ED stand for?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q23 Results") tell.Answer = dialog.AddLabel("Answer: Electron Density") Answer = ask.Comment.value if Answer=='Electron Density' then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q24() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q24") ask.Instructions = dialog.AddLabel("What does DRW stand for?:") ask.Comment = dialog.AddTextbox("Answer:", "") ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q24 Results") tell.Answer = dialog.AddLabel("Answer: Deep Rebuild Worst") Answer = ask.Comment.value if Answer=='Deep Rebuild Worst' then do NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else print("Dialog cancelled") end end function Q25() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q25") ask.Instructions = dialog.AddLabel("In which platform is foldit 64-bit?") ask.Windows = dialog.AddCheckbox("Windows", false) ask.Macintosh = dialog.AddCheckbox("Macintosh", false) ask.Linux = dialog.AddCheckbox("Linux", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q25 Results") tell.Answer = dialog.AddLabel("Answer: Linux") if not (ask.Windows.value) and not (ask.Macintosh.value) then if (ask.Linux.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q26() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q26") ask.Instructions = dialog.AddLabel("Who is the top soloist of all time?") ask.Mimi = dialog.AddCheckbox("Mimi", false) ask.BootsMcGraw = dialog.AddCheckbox("BootsMcGraw", false) ask.Mark = dialog.AddCheckbox("Mark-", false) ask.SteveB = dialog.AddCheckbox("SteveB", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q26 Results") tell.Answer = dialog.AddLabel("Answer: Mimi") if not (ask.BootsMcGraw.value) and not (ask.Mark.value) and not (ask.SteveB.value) then if (ask.Mimi.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q27() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q27") ask.Instructions = dialog.AddLabel("Which is the smallest segment?") ask.arginine = dialog.AddCheckbox("arginine", false) ask.glycine = dialog.AddCheckbox("glycine", false) ask.serine = dialog.AddCheckbox("serine", false) ask.porcine = dialog.AddCheckbox("porcine", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q27 Results") tell.Answer = dialog.AddLabel("Answer: glycine") if not (ask.arginine.value) and not (ask.serine.value) and not (ask.porcine.value) then if (ask.glycine.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q28() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q28") ask.Instructions = dialog.AddLabel("Which does not support foldit?") ask.NSF = dialog.AddCheckbox("NSF", false) ask.Apple = dialog.AddCheckbox("Apple", false) ask.DARPA = dialog.AddCheckbox("DARPA", false) ask.Microsoft = dialog.AddCheckbox("Microsoft", false) ask.Adobe = dialog.AddCheckbox("Adobe", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q28 Results") tell.Answer = dialog.AddLabel("Answer: Apple") if not (ask.NSF.value) and not (ask.DARPA.value) and not (ask.Microsoft.value) and not (ask.Adobe.value) then if (ask.Apple.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q29() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q29") ask.Instructions = dialog.AddLabel("What were the most players in foldit at one time?") ask.a600 = dialog.AddCheckbox("600", false) ask.a700 = dialog.AddCheckbox("700", false) ask.a800 = dialog.AddCheckbox("800", false) ask.a900 = dialog.AddCheckbox("900", false) ask.a1000 = dialog.AddCheckbox("1000", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q29 Results") tell.Answer = dialog.AddLabel("Answer: 900") if not (ask.a600.value) and not (ask.a700.value) and not (ask.a800.value) and not (ask.a1000.value) then if (ask.a900.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Q30() TotalNumberOfQuestions=TotalNumberOfQuestions+1 local ask = dialog.CreateDialog("Question Q30") ask.Instructions = dialog.AddLabel("Which event caused the greatest influx of players?") ask.SS = dialog.AddCheckbox("2012 Summer solstice", false) ask.Hank = dialog.AddCheckbox("Hank Green's Show", false) ask.CASP9 = dialog.AddCheckbox("CASP9", false) ask.CASP10 = dialog.AddCheckbox("CASP10", false) ask.Nature = dialog.AddCheckbox("Nature article", false) ask.IDontKnow = dialog.AddCheckbox("I don't know", false) ask.OK = dialog.AddButton("OK", 1) --ask.Cancel = dialog.AddButton("Cancel", 0) if (dialog.Show(ask) > 0) then local tell = dialog.CreateDialog("Q30 Results") tell.Answer = dialog.AddLabel("Answer: I don't know") if not (ask.SS.value) and not (ask.Hank.value) and not (ask.CASP9.value) and not (ask.CASP10.value) and not (ask.Nature.value) then if (ask.IDontKnow.value) then NumberCorrect=NumberCorrect+1 tell.Invert = dialog.AddLabel("Correct! ") else tell.Invert = dialog.AddLabel("Not very correct") end else tell.Invert = dialog.AddLabel("Not very correct") end tell.OK = dialog.AddButton("OK", 1) dialog.Show(tell) else end end function Randomize(TotalQuestionsToAsk) recipe.GetRandomSeed() QuestionsAsked={} --[[for w=1,TotalQuestionsToAsk do QuestionsAsked[w]=0 end]]-- s=1 while s<TotalQuestionsToAsk+1 do current=(math.random(TotalQuestions)) usedAlready=false for t=1,TotalQuestionsToAsk+1 do if (current==QuestionsAsked[t]) then do usedAlready=true end else end end if usedAlready==false then do QuestionsAsked[s]=current s=s+1 end else end end for r=1,TotalQuestionsToAsk do --print(QuestionsAsked[r]) end for g=1,TotalQuestionsToAsk do if QuestionsAsked[g]==0 then Q1() end if QuestionsAsked[g]==1 then Q2() end if QuestionsAsked[g]==2 then Q3() end if QuestionsAsked[g]==3 then Q4() end if QuestionsAsked[g]==4 then Q5() end if QuestionsAsked[g]==5 then Q6() end if QuestionsAsked[g]==6 then Q7() end if QuestionsAsked[g]==7 then Q8() end if QuestionsAsked[g]==8 then Q9() end if QuestionsAsked[g]==9 then Q10() end if QuestionsAsked[g]==10 then Q11() end if QuestionsAsked[g]==11 then Q12() end if QuestionsAsked[g]==12 then Q13() end if QuestionsAsked[g]==13 then Q14() end if QuestionsAsked[g]==14 then Q15() end if QuestionsAsked[g]==15 then Q16() end if QuestionsAsked[g]==16 then Q17() end if QuestionsAsked[g]==17 then Q18() end if QuestionsAsked[g]==18 then Q19() end if QuestionsAsked[g]==19 then Q20() end if QuestionsAsked[g]==20 then Q21() end if QuestionsAsked[g]==21 then Q22() end if QuestionsAsked[g]==22 then Q23() end if QuestionsAsked[g]==23 then Q24() end if QuestionsAsked[g]==24 then Q25() end if QuestionsAsked[g]==25 then Q26() end if QuestionsAsked[g]==26 then Q27() end if QuestionsAsked[g]==27 then Q28() end if QuestionsAsked[g]==28 then Q29() end if QuestionsAsked[g]==29 then Q30() end end end function DoingSpecificQuestion(QuestionNumber) if QuestionNumber==0 then Q1() end if QuestionNumber==1 then Q2() end if QuestionNumber==2 then Q3() end if QuestionNumber==3 then Q4() end if QuestionNumber==4 then Q5() end if QuestionNumber==5 then Q6() end if QuestionNumber==6 then Q7() end if QuestionNumber==7 then Q8() end if QuestionNumber==8 then Q9() end if QuestionNumber==9 then Q10() end if QuestionNumber==10 then Q11() end if QuestionNumber==11 then Q12() end if QuestionNumber==12 then Q13() end if QuestionNumber==13 then Q14() end if QuestionNumber==14 then Q15() end if QuestionNumber==15 then Q16() end if QuestionNumber==16 then Q17() end if QuestionNumber==17 then Q18() end if QuestionNumber==18 then Q19() end if QuestionNumber==19 then Q20() end if QuestionNumber==20 then Q21() end if QuestionNumber==21 then Q22() end if QuestionNumber==22 then Q23() end if QuestionNumber==23 then Q24() end if QuestionNumber==24 then Q25() end if QuestionNumber==25 then Q26() end if QuestionNumber==26 then Q27() end if QuestionNumber==27 then Q28() end if QuestionNumber==28 then Q29() end if QuestionNumber==29 then Q30() end end function AskHowManyQuestions() ask = dialog.CreateDialog("Foldit Quiz") ask.HowManyQuestions = dialog.AddSlider("How Many Questions?", 10, 5, TotalQuestions, 0) ask.SpecificQuestion = dialog.AddCheckbox("Specific Question Only?", false) ask.QuestionNumber = dialog.AddSlider("Question Number", 1, 1, TotalQuestions, 0) ask.OK = dialog.AddButton("OK", 1) dialog.Show(ask) TotalQuestionsToAsk=ask.HowManyQuestions.value DoSpecificQuestion=ask.SpecificQuestion.value DoQuestionNumber=ask.QuestionNumber.value return TotalQuestionsToAsk,DoSpecificQuestion,DoQuestionNumber end TotalQuestions=30 --TotalQuestionsToAsk=10 --Q30() AskHowManyQuestions() --print(DoSpecificQuestion) PleaseDoSpecificQuestion=DoSpecificQuestion if (DoSpecificQuestion==true) then do print(DoQuestionNumber) DoingSpecificQuestion(DoQuestionNumber-1) end else Randomize(TotalQuestionsToAsk) end --Randomize(TotalQuestionsToAsk) print('Score= ',NumberCorrect, ' out of ',TotalNumberOfQuestions) end function GetDirtyWigglerOptions() NumberOfRounds=4 NumberBeforeRestore=4 NumberOfBadSegments=structure.GetCount()/4 WigglerCI=0.1 DWMaxCI=0.3 RelaxBetweenWiggles=true DWopt = dialog.CreateDialog("Dirty Wiggler") DWopt.lbl1 = dialog.AddLabel("Options:") DWopt.NBS= dialog.AddSlider("Number of Bad Segments?", NumberOfBadSegments, 1, structure.GetCount(), 0)--desctip, default, min, max, precision DWopt.NR= dialog.AddSlider("Number of Rounds?", NumberOfRounds, 1, 100, 0) DWopt.NBR= dialog.AddSlider("Number Before Restore?", NumberBeforeRestore, 1, 25, 0) DWopt.WCI= dialog.AddSlider("Wiggler CI?", WigglerCI, 0, 1, 2) DWopt.DWMaxCI= dialog.AddSlider("Maximum CI?", DWMaxCI, 0, 1, 2) DWopt.RBW=dialog.AddCheckbox("Relax Between Wiggles?", RelaxBetweenWiggles) DWopt.run = dialog.AddButton("Start", 1) dialog.Show(DWopt) NumberOfBadSegments=DWopt.NBS.value NumberOfRounds=DWopt.NR.value NumberBeforeRestore=DWopt.NBR.value RelaxBetweenWiggles=DWopt.RBW.value WigglerCI=DWopt.WCI.value DWMaxCI=DWopt.DWMaxCI.value if DWMaxCI<WigglerCI then do print('Adjust Maximum CI') GetDirtyWigglerOptions() end else end BandNo=band.GetCount() end function DeleteBands(BandNo) NewBandNo=band.GetCount() for w=BandNo,NewBandNo-1 do band.Delete(BandNo+1) end end function DirtyWigglerAddBand(SegNo,cnt) --create one random band b={} --GetTotalSubScores() --print('TotalSubScore Tally', TotalSubScore) for s1=1,1 do --while true do --try till die --local s1=random(structure.GetCount()) --OtherScore=current.GetSegmentEnergySubscore(s1,EnergySubscorePart) --GetSubScores(s1) --str=random(minStr,maxStr) len=3 * math.random()^(1/3) + 0.001 --local len=0.3 --local theta = math.acos(2*math.random()-1) theta=math.rad(math.random(0, 180)) --local phi = 2 * math.pi * math.random() phi=math.rad(math.random(0, 360)) segmentXAxis=0 segmentYAxis=0 while true do --all 3 must be different segmentXAxis = math.random(structure.GetCount()) segmentYAxis = math.random(structure.GetCount()) if segmentXAxis~=SegNo and segmentYAxis~=SegNo and segmentXAxis~=segmentYAxis then break end end --{segmentOrigin, segmentXAxis, segmentYAxis, rho, theta, phi} --print('s1 =',s1) --print('segmentXAxis =',segmentXAxis) --print('segmentYAxis =',segmentYAxis) --print('len =',len) --print('theta =',theta) --print('phi =',phi) --print('str =',str) --print(SubScore) --print('Segment ', s1) DoBandingAlgorithmA=true if DoBandingAlgorithmA == true then do BandingAlgorithmA(SubScore,TotalSubScore) end else end DoBandingAlgorithmA=true if DoBandingAlgorithmB == true then do BandingAlgorithmB(SubScore,TotalSubScore,s1) end else end --print(SegNo) --print(theta) --print(phi) --print(BandLength) --print(BandStrength) --print('Band Length= ',BandLength) --print('Band Strength= ',BandStrength) --print('Segment ',s1) --print(OtherScore) --print('Band Length= ',BandLength) --print('Band Strength= ',BandStrength) band.Add(SegNo, segmentXAxis, segmentYAxis, 1, theta, phi) band.SetGoalLength(cnt, BandLength) band.SetStrength(cnt, BandStrength) break --end end --return b end function BandingAlgorithmA(SubScore,TotalSubScore) --print('Made it to here') BandStrength= SubScore*(1-SubScore/TotalSubScore)/10 if BandStrength<0.1 then do BandStrength=0.1 end else end if BandStrength>7 then do BandStrength=7 end else end BandLength=1/BandStrength if BandLength<0 then do BandLength=0.01 end else end if BandLength>4.5 then do BandLength=4.5 end else end return BandStrength,BandLength end function get_all_DWseg_scores(start,finish) if start == nil then print("get_all_seg_scores: start is nil") abort = abort + 1 -- this will stop program end if finish == nil then print("get_all_seg_scores: finish is nil") abort = abort + 1 -- this will stop program end if start > finish then print("get_all_segs_scores: start > finish") abort = abort + 1 -- this will stop program end local i local seg_list = {} for i=start,finish do score_set = {} score_set.index = i score_set.score = current.GetSegmentEnergyScore(i) seg_list[#seg_list+1] = score_set end return seg_list end --[[function sort_rebuild_list(seg_list) -- d9; substituted quicksort if seg_list == nil then print("sort_rebuild_list: seg_list is nil") abort = abort + 1 -- this will stop program end -- binary sort local outer local inner local seg_list_count = # seg_list for outer = 1, seg_list_count-1 do for inner = 1, seg_list_count-outer-1 do local a = seg_list[inner+1] local b = seg_list[inner] if a.score < b.score then seg_list[inner+1] = b seg_list[inner] = a end end -- end of inner loopok, two tables in end -- end of outer loop return seg_list end]] --in-place quicksort function quicksort(t, start, endi) start, endi = start or 1, endi or #t if(endi - start < 2) then return t end local pivot = start for i = start + 1, endi do if t[i].score <= t[pivot].score then --d9; only adaptation needed ( add ".score") local temp = t[pivot + 1] t[pivot + 1] = t[pivot] if(i == pivot + 1) then t[pivot] = temp else t[pivot] = t[i] t[i] = temp end pivot = pivot + 1 end end t = quicksort(t, start, pivot - 1) return quicksort(t, pivot + 1, endi) end function TheDWList() segment_list = {} segment_list = get_all_DWseg_scores(1,structure.GetCount()) --new_segment_list = sort_rebuild_list(segment_list) --d9; substitute quicksort new_DWsegment_list = quicksort(segment_list, 1, #segment_list) for jj=1,NumberOfBadSegments do --#new_segment_list --d9; only report 12 worst at a time (fits in window + it's all that's needed) --print(jj," - segment # ",new_segment_list[jj].index," = ",new_segment_list[jj].score) --d9; added whitespace, removed brackets end end function BlueFuseR(MaxCI) --MaxCI=1 if BFuseR==true then do print('Blue Fuse') behavior.SetClashImportance(.05) structure.ShakeSidechainsSelected(1) behavior.SetClashImportance(MaxCI) structure.WiggleSelected(25) behavior.SetClashImportance(.07) structure.ShakeSidechainsSelected(1) behavior.SetClashImportance(MaxCI) structure.WiggleSelected(25) --recentbest.Restore() if WigglerCI > 0.29 then do behavior.SetClashImportance(.3) end else behavior.SetClashImportance(WigglerCI) end structure.WiggleSelected(1) behavior.SetClashImportance(MaxCI) structure.WiggleSelected(25) recentbest.Restore() end else end end function DirtyWiggler() GetDirtyWigglerOptions() DoBandingAlgorithmB=false save.Quicksave(1) recentbest.Save() --DWMaxCI=1 print(current.GetEnergyScore()) for k=1,NumberOfRounds do for y=1,NumberBeforeRestore do TheDWList() band.EnableAll() selection.DeselectAll() cnt=BandNo for jj=1,NumberOfBadSegments do cnt=cnt+1 SubScore=new_DWsegment_list[jj].index TotalSubScore=current.GetEnergyScore() SegNo=new_DWsegment_list[jj].index DirtyWigglerAddBand(SegNo,cnt) end selection.SelectAll() behavior.SetClashImportance(WigglerCI) structure.WiggleSelected(10) --band.DeleteAll() band.DisableAll() DeleteBands(BandNo) behavior.SetClashImportance(DWMaxCI) structure.ShakeSidechainsAll(1) if RelaxBetweenWiggles == true then do structure.WiggleSelected(25) end else end --structure.ShakeSidechainsAll(1) end recentbest.Restore() --band.DeleteAll() DeleteBands(BandNo) structure.WiggleSelected(20) save.Quickload(1) recentbest.Restore() print('Recent Best Restored') print(current.GetEnergyScore()) end BFuseR=true --MaxCI=1 BlueFuseR(DWMaxCI,WigglerCI) end function BlueFuse() BFuseR=true if BFuseR==true then do print('Blue Fuse') behavior.SetClashImportance(.05) structure.ShakeSidechainsSelected(1) behavior.SetClashImportance(MaxCI) structure.WiggleSelected(25) behavior.SetClashImportance(.07) structure.ShakeSidechainsSelected(1) behavior.SetClashImportance(MaxCI) structure.WiggleSelected(25) --recentbest.Restore() behavior.SetClashImportance(.3) structure.WiggleSelected(1) behavior.SetClashImportance(MaxCI) structure.WiggleSelected(25) --recentbest.Restore() end else end end function ShorteRFuse() behavior.SetClashImportance(0.2) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(25) behavior.SetClashImportance(MaxCI) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(25) end function BBANG() print(' ') print('Starting BBANG (Better(Better(After New Geometry)))') recentbest.Save() selection.SelectAll() save.Quicksave(1) --stores original structure.WiggleSelected(25) save.Quickload(1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(25) recentbest.Restore() save.Quicksave(1) behavior.SetClashImportance(0.1) structure.ShakeSidechainsSelected(1) behavior.SetClashImportance(1) structure.WiggleSelected(15) save.Quickload(1) behavior.SetClashImportance(0.1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(15) behavior.SetClashImportance(1) structure.WiggleSelected(15) save.Quickload(1) behavior.SetClashImportance(0.1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(15) behavior.SetClashImportance(1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(15) recentbest.Restore() print('Halfway done...') save.Quicksave(2) behavior.SetClashImportance(0.1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(15) behavior.SetClashImportance(1) structure.WiggleSelected(15) save.Quickload(2) behavior.SetClashImportance(0.1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(15) behavior.SetClashImportance(1) structure.ShakeSidechainsSelected(1) structure.WiggleSelected(15) recentbest.Restore() ShorteRFuse() BlueFuse() end function BakingCookies() print('Baking cookies...') opt = dialog.CreateDialog("XyBot Diversion") opt.lbl1 = dialog.AddLabel("Baking Cookies:") opt.lbl2 = dialog.AddLabel("...............................") opt.lbl3 = dialog.AddLabel("Mark ingredients:") --opt.Alarm= dialog.AddSlider("Current level of alarm", AlarmLevel, 0, 7, 0) opt.Flour=dialog.AddCheckbox('Flour?',GotFlour) opt.Sugar=dialog.AddCheckbox('Sugar?',GotSugar) opt.Eggs=dialog.AddCheckbox('Eggs?',GotEggs) opt.Vanilla=dialog.AddCheckbox('Vanilla?',GotVanilla) opt.BakingSoda=dialog.AddCheckbox('Baking Soda?',GotBakingSoda) opt.Salt=dialog.AddCheckbox('Salt?',GotSalt) opt.Morsels=dialog.AddCheckbox('Morsels?',GotMorsels) --[[opt.Safe=dialog.AddCheckbox('Do you feel safe?',FeelSafe) opt.lbl3 = dialog.AddLabel("..............................") opt.Dizzy=dialog.AddCheckbox("Dizzy?", DizzyBoolean) opt.lbl4 = dialog.AddLabel("..............................") opt.Symptoms=dialog.AddCheckbox('Do you have any symptoms?',false) opt.lbl5 = dialog.AddLabel("..............................")]]-- opt.lbl6 = dialog.AddLabel("For some reason, you have to click twice on this dialog:") opt.run = dialog.AddButton("Go Ahead", 1) opt.Return = dialog.AddButton("Panic!", 0) dialog.Show(opt) GotFlour=opt.Flour.value GotSugar=opt.Sugar.value GotEggs=opt.Eggs.value GotVanilla=opt.Vanilla.value GotBakingSoda=opt.BakingSoda.value GotSalt=opt.Salt.value GotMorsels=opt.Morsels.value if GotFlour==true and GotSugar==true and GotEggs==true and GotVanilla==true and GotBakingSoda==true and GotSalt==true and GotMorsels==true then do BakeCookieDirections() end else BakingCookies() end if (dialog.Show(opt) < 1) then do Ask() end else end end function BakeCookieDirections() print('Mix them and bake') opt = dialog.CreateDialog("XyBot Diversion") opt.lbl1 = dialog.AddLabel("Baking Cookies:") opt.lbl2 = dialog.AddLabel("...............................") opt.lbl3 = dialog.AddLabel("Mix ingredients:") opt.lbl4 = dialog.AddLabel("Bake at 350 for 10 minutes:") --opt.Alarm= dialog.AddSlider("Current level of alarm", AlarmLevel, 0, 7, 0) opt.lbl6 = dialog.AddLabel("For some reason, you have to click twice on this dialog:") opt.run = dialog.AddButton("Bake!", 1) opt.Return = dialog.AddButton("Panic!", 0) dialog.Show(opt) if (dialog.Show(opt) < 1) then do Ask() end else BakingTimer() end end function BakingTimer() --BakingTime=10 opt = dialog.CreateDialog("XyBot Diversion") opt.lbl1 = dialog.AddLabel("Baking Cookies:") opt.lbl2 = dialog.AddLabel("...............................") opt.lbl3 = dialog.AddLabel("Bake at 350 for about 10 minutes:") opt.BakeFor= dialog.AddSlider("Set Timer:", 10, 1, 12, 0) --[[noteTime() BakingStart=ElapsedTime BakingTime=10 LastBakingTime=999 StartTime=os.time()]]-- opt.run = dialog.AddButton("Next", 1) opt.Return = dialog.AddButton("Panic!", 0) dialog.Show(opt) BakingStart=os.time() BakingTime=opt.BakeFor.value print('Baking Time= ',BakingTime,'minutes') --LastBakingTime=BakingTime-((os.time()-BakingStart)/60) if (dialog.Show(opt) < 1) then do Ask() end else end LastBakingTime=BakingTime TimersRunning=BakingTime while TimersRunning>0 do --noteTime() ElapsedTime=os.time()-BakingStart --print('Time= ', ClockTime+ElapsedTime) --print('Elapsed Time= ',ElapsedTime) TimersRunning=BakingTime-((ElapsedTime)/60) --[[if BakingTime-LastBakingTime>0.06 then do print('Time Left= ',round(BakingTime)' minutes') end else end]]-- --LastBakingTime=BakingTime-((os.time()-BakingStart)/60) if LastBakingTime-TimersRunning >0.1 then do print('Time Left= ',round(TimersRunning),' minutes') LastBakingTime=TimersRunning end else end end print('Pull out the cookies!') opt = dialog.CreateDialog("XyBot Diversion") --opt.Time=dialog.AddTextbox('Time', BakingTime) opt.run = dialog.AddButton("Next", 1) opt.Return = dialog.AddButton("Panic!", 0) dialog.Show(opt) if (dialog.Show(opt) < 1) then do Ask() end else print('New batch...') BakingTimer() end end function round(x)--cut all afer 1st place return x-x%0.1 end function YanKimPoDialog(PlayerScore,ComputerScore) opt = dialog.CreateDialog("XyBot Diversion") opt.lbl1 = dialog.AddLabel("Yan Kim Po:") opt.lbl2 = dialog.AddLabel("Choose One:") opt.lbl3 = dialog.AddLabel("...............................") opt.Rock=dialog.AddCheckbox("Rock?", false) opt.Scissors=dialog.AddCheckbox("Scissors?", false) opt.Paper=dialog.AddCheckbox("Paper?", false) opt.run = dialog.AddButton("Next", 1) --opt.Return = dialog.AddButton("Panic!", 0) dialog.Show(opt) ChoseRock=opt.Rock.value ChoseScissors=opt.Scissors.value ChosePaper=opt.Paper.value if ChoseRock==true then do print(user.GetPlayerName(),'chose Rock') PlayerChoice=1 end else end if ChoseScissors==true then do print(user.GetPlayerName(),'chose Scissors') PlayerChoice=2 end else end if ChosePaper==true then do print(user.GetPlayerName(),'chose Paper') PlayerChoice=3 end else end if (dialog.Show(opt) < 1) then do print('Run away, scaredy cat!') DiversionOffered=false Ask() end else PlayYanKimPo(PlayerChoice) end end function PlayYanKimPo(PlayerChoice) ComputerChooses=math.random(3) --print(ComputerChooses) if ComputerChooses==1 then do print(cm,'chose Rock') end else end if ComputerChooses==2 then do print(cm,'chose Scissors') end else end if ComputerChooses==3 then do print(cm,'chose Paper') end else end --print(PlayerChoice) if PlayerChoice==1 and ComputerChooses==1 then do print('Rock equals Rock. No winner.') end else end if PlayerChoice==1 and ComputerChooses==2 then do print('Rock beats Scissors.',user.GetPlayerName(),'wins') PlayerScore=PlayerScore+1 end else end if PlayerChoice==1 and ComputerChooses==3 then do print('Rock loses to Paper.',cm,'wins') ComputerScore=ComputerScore+1 end else end if PlayerChoice==2 and ComputerChooses==1 then do print('Scissors loses to Rock.',cm,'wins') ComputerScore=ComputerScore+1 end else end if PlayerChoice==2 and ComputerChooses==2 then do print('Scissors equals Scissors. No winner.') end else end if PlayerChoice==2 and ComputerChooses==3 then do print('Scissors beats paper.',user.GetPlayerName(),'wins') PlayerScore=PlayerScore+1 end else end if PlayerChoice==3 and ComputerChooses==1 then do print('Paper beats Rock.',user.GetPlayerName(),'wins') PlayerScore=PlayerScore+1 end else end if PlayerChoice==3 and ComputerChooses==2 then do print('Paper loses to Scissors.',cm,'wins') ComputerScore=ComputerScore+1 end else end if PlayerChoice==3 and ComputerChooses==3 then do print('Paper equals Paper. No winner.') end else end print(user.GetPlayerName(),'=',PlayerScore) print(cm,'=',ComputerScore) if ComputerScore>PlayerScore then do print('Loser!') end else end if ComputerScore<PlayerScore then do print('*Sulks*') end else end end function Start() end function Shunt() print('Shunt') end ----------------- --main ----------------- Doody=0 alligator=0 crocodile=0 Greetings() Start() for Questions=1,1000 do BadWord=false Ask() BadWord=false --Screen(DidSay1) Contemplate() --DoMaxims(DidSay1) --Answer(ComputerMonicker) end ---------------- --scratch --[[ print('Made it to here') print(string.match(WriteNoteToAuthor,'Parse')) --the above line prints out "Parse" if string.match(WriteNoteToAuthor,'Parse')=='Parse' then do print('Got a match') --this prints "Got a match" end else end ]]-- --[[A big wife and a big barn, will never do a man any harm. You can't make cookies when you haven't got the dough. A poor excuse is better than none at all. A wife that does not know how to keep house throws out more with a teaspoon than a man can bring in with a shovel. A little too late is much too late. A good deed is never lost. A smile is worth a thousand words. A person who gets all wrapped up in himself makes a mighty small package. A false friend and a shadow stay only while the sun shines. All is fair in love and war, but friendship there is truth. A word of praise is equal to ointment on a sore. A chain is as strong as it's weakest link. A clock will run without watching it. A man is judged by the company he keeps. A good neighbor, a found treasure! A friend to everyone is a friend to nobody. A man is the only animal that can be skinned more than once. A small leak will sink a great ship. A living dog is better than a dead lion. A woman is as old as she admits. A man without guts lives on his knees. A man who marries twice is a two-time loser. A woman thinks it takes two to keep a secret. A good lie finds more believers than a bad truth. A man is not better than his conversation. A good name is a second inheritance. A man warned is half saved. A good wife is the best household furniture. A frightened atheist half believes in God. A pebble and a diamond are alike to a blind man. A good cause finds weapons to defend it. A tree is known by it's fruit, not by its leaves. A guilty conscience needs no accuser. A false friend is worse than an open enemy. A good word costs n more than a bad one. At the center of climb is "I". An arrogant bug is a cocky roach. Anger without power is folly. Anytime means no time. A handsome husband is common property. A small body may harbor a great soul. Arrogance is a roadblock on the highway of wisdom. Adversity makes men; prosperity makes monsters. Believe nothing you hear, half of what you see and only one fourth of what you know to be true. Bad neighbors count a man's income but not his expenses. Better an hour early and stand and wait than a moment behind time. Better weak beer than lemonade. Better a dollar earned than ten inherited. Beware of a door that has too many keys. Borrowing does well only once. By candlelight every country wench is handsome. Be what you appear to be. Better to ask twice than lose your way once. Better bowlegs than no legs at all. Better to heaven in rags than to hell in embroidery. Be silent and pass for a philosopher. Curses, like chickens, come home to roost. Content makes poor men rich; discontent makes rich men poor. Corruption finds a dozen alibis for its evil deeds. Cowards die daily, the brave but once. Concealed knowledge is buried treasure. Don't live it up so high that you can't lie it down. Don't dare kiss an ugly girl, she'll tell the world about it. Don't taste every man's soup, you'll burn your mouth. Doctor's faults are covered with earth and rich men's with money. Even a fish wouldn't get caught if he kept his mouth shut. Every donkey thinks itself worthy of standing with the king's horses. Even the devil was an angel in the beginning. Even the devil will swear on a stack of bibles. Every slip is not a fall. Envy is the sincerest form of flattery. Every family has at least one black sheep. Every man judges others by himself. Every man knows best when his own shoe pinches. Every path has a puddle. Every mother's child is handsome. Every age explodes old errors and creates new ones. Early ripe, early rotten. Every field looks green from a distance, even a cemetery. Everybody lays his load on the willing horse. Fate is the course when men fail to act. Fools use bets for arguments. Figures, never lie, but liars can figure. First deserve it, then desire it. Fortune and misfortune are next-door neighbors. God gives food but does not cook it. He who rides slowly gets just as far, only it takes longer. He who hears forgets, he who sees remembers, he who does learns. In trying times, don't quit trying. If a race could be won after the first gallop, thousands would wear blue ribbons. It is a waste of gunpowder to fire at the man-in-the-moon. "IF's" and "But's" butter no bread. It's easy to be generous with another man's money. If you want a neat wife, choose her on a Saturday. Little minds still be little, even when they are made professors. Listen at the keyhole and you'll hear news of yourself. Liars and gossips are Siamese twins. Let thy maid-servant be faithful, strong and homely. Men who talk like big wheels usually are merely spokes men. Many love triangles are really wrecktangles. Man is the only animal that can be skinned more than once. Must is a hard nut to crack. Many persons think they are wise, when they are only windy. No matter how high a bird flies, it has to come down for water. Nothing is gained by having one donkey call another "Long Ears!" No piper ever suited all ears. New churches and new bars are well patronized. One who thinks he can live without others is mistaken but he who thinks others cannot live without him are more mistaken. Of all the sad words of tongue or pen, the saddest ones, "It might have been." One eyewitness is better than ten hearsays. One murder makes a villian, millions make a hero. One has only to die to be praised. Put the light out and all women are alike. Religion is the best armor but the worst cloak. Repurations is what you are in the light; character is what you are in the dark. The sun doesn't shine on the same dog's back every day. Trouble comes when the New Year's resolutions collide with the old year's habits. Tell me whom you associate with and I will tell you who you are. The ugliest girl makes the best housewife. When the well is dry, you know the worth of water. What do we live for if it is not to make life less difficult for others? When one has seen the bear in the woods, he hears his growl in every bush. You can't anymore give away something you ain't got than you can come back from someplace you haven't been. You can't tell the depth of the well by the length of the handle on the pump. You can't put out old heads on young shoulders. Little children step on one's lap; tall ones tread on one's heart. He who rides slowly gets just as far, only it takes a little longer. Don't worry when you stumble. Remember, a worm is the only thing that can't fall down. One had better have no dealings with girls with fat legs.]]--

Comments