home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / open / brainsc2.lzh / BRAINSC2.PAS < prev    next >
Pascal/Delphi Source File  |  1986-01-03  |  60KB  |  1,749 lines

  1. program Brainscape;
  2. {written by W. Jeffrey Wilson & lynne ostergren,
  3.             Department of Psychological Sciences,
  4.             Indiana University - Purdue University at Fort Wayne,
  5.             2101 Coliseum Boulevard East,
  6.             Fort Wayne, IN  46805.
  7. copyright, 1985 by Purdue Research Foundation, West Lafayette, Indiana 47907.
  8.                     All Rights Reserved.  Unmodified copies of this program
  9.                     may be freely distributed.  Each copy must contain this
  10.                     notice.}
  11.  
  12. {Version 1.2: created 1/23/86}
  13.  
  14. const
  15.    MoveList = ' GO RUN WAL CLI DOR D VEN V LAT L MED M ROS R CAU C ';
  16.    GetList  = ' GET PIC GRA TAK STE ';
  17.    ManipList= ' OPE CLO UNL LOC LIF STA SPR REA LOO EXA EAT SWA THR ';
  18.    EatList  = '{ EAT} DRI TAS CON ';
  19.    LookList = '  ';
  20.    PutList  = ' PUT DRO LEA ';
  21.    InvList  = ' INV I ';
  22.    ScoreList= ' SCO ';
  23.    SaveList = ' SAV ';
  24.    RestoreList = ' RES ';
  25.    HelpList = ' HEL ';
  26.    QuitList = ' QUI ';
  27.    ItemsToGet=
  28. ' ZIP DA  DOP NE  NOR NA  ACH ACE SER 5HT GAB VES PUR PYR PIL GOL STA VIA OLI BOT GRO HOR KEY PAP SCR ANT CEL GLA ALL ';
  29.    Adj = 'Adjoining Room to the ';
  30.  
  31. type
  32.    CommandTypes = (None, Move, Get, Put, Eat, Look, Manip, Inventory,
  33.                    ReportScore, Save, Restore, Help, Quit, HomuncPestered);
  34.    Directions = (D, V, L, M, R, C);
  35.    RoomTypes =
  36.     (LateralVentricle, ThirdVentricle, CerebralAqueduct, FourthVentricle,
  37.     Foramen, SubArachnoid, CaudateHead, CaudateTail, Putamen, Pallidum,
  38.     Nigra, InternalCapsule, CerebralPeduncle, NigroStriatalBundle,
  39.     Thalamus, Pons, Medulla, Raphe, LateralLemniscus, VentralNoradBundle,
  40.     InferiorColliculus, MedialGeniculate, TrapezoidBody, PeriAqueductalGray,
  41.     AuditoryCx, SuprachiasmNuc, Pituitary, Pyramids, CingulateGyrus,
  42.     OpticTract, OpticChiasm, LateralGeniculate, SuperiorColliculus,
  43.     OpticRadiation, VisualCx, Amygdala, Septum, MammillaryBody, Hippocampus,
  44.     Fornix, VMN, LHA, SensoryStrip, MotorStrip, FrontalLobe, Brocas,
  45.     Wernickes, AssocCx, Accumbens, Cerebellum, Assoc1, Assoc2, Assoc3,
  46.     Assoc4, Assoc5, NoWhere, NotYet, Question);
  47.    Ventricle = LateralVentricle..Foramen;
  48.    Objects = (Nothing, DA, NE, ACh, SER, GABA, VesDA, VesNE, VesACh, Ves5HT,
  49.               VesGABA, PurkinjeCell, PyramidalCell, Pill, GolgiStain, Oligodendrocyte,
  50.               GrowthHormone, Key, Scrap, Glass);
  51.    Dungeon = record
  52.               Name : string[40];
  53.               AdjRoom : array [Directions] of RoomTypes;
  54.               Item : array [DA..Glass] of Boolean;
  55.               Visited : Boolean;
  56.              end;
  57.    RoomArray = array[LateralVentricle..Assoc5] of Dungeon;
  58.    ObjDesc = array[Objects] of string[80];
  59.    GameSave = record
  60.                Map: RoomArray;
  61.                LocCurrent : RoomTypes;
  62.                Carrying: array[Objects] of Boolean;
  63.                CurrentScore : integer;
  64.                GhostStained : Boolean;
  65.                BoxLocked : Boolean;
  66.                StuffStolen : Boolean;
  67.                GolgiHere : Boolean;
  68.                ThiefTime : integer;
  69.                HomuncTime : integer;
  70.                HomuncStays : integer;
  71.                PillWork : integer;
  72.                GrowingBig : integer;
  73.                ObjectsCurrent : ObjDesc;
  74.                EscapeCurrent : string[4];
  75.               end;
  76.  
  77. const
  78.    TimeCommand : array[Ventricle] of string[3] =
  79.                  ('med','cau','cau','cau','cau');
  80.    ObjectDescription : ObjDesc =
  81.         ('nothing','dopamine','norepinephrine','acetylcholine','serotonin',
  82.          'GABA','a vesicle that once           contained dopamine','a noradrenergic vesicle',
  83.          'a vesicle with traces of      acetylcholine on it','a serotonergic vesicle',
  84.          'a vesicle for GABA','a Purkinje cell','a pyramidal cell',
  85.          'an anti-immune system pill','a delicate crystal vial with   a faded label',
  86.          'a large oligodendrocyte','a bottle labeled "Growth      Hormone: Promotes growth      and strength"',
  87.          'a rusty key','a scrap of paper','broken glass');
  88.    ThiefLair : RoomTypes = Accumbens;
  89.    ChestLoc : RoomTypes = Accumbens;
  90.    EscapeKey : string[3] = 'RL';
  91.    Escape : string[3] = '   ';
  92.    LoadLimit : integer = 5;
  93.    Load : 0..5 = 0;
  94.    LastObject : Objects = Glass;
  95.  
  96. var
  97.    Command : string[40];
  98.    Answer : string[40];
  99.    RightAnswers : string[40];
  100.    CommandDupe : string[25];
  101.    NounDupe : string[25];
  102.    Verb : string[5];
  103.    Noun : string[5];
  104.    Cmd : CommandTypes;
  105.    index : 0..24;
  106.    Loc, Loc1: RoomTypes;
  107.    DungeonFile : file of RoomArray;
  108.    GameFile : GameSave;
  109.    SaveFile : file of GameSave;
  110.    Dir : Directions;
  111.    Object : Objects;
  112.    ItemsGotten : array[Objects] of Boolean;
  113.    HaveSomething : Boolean;
  114.    TimeForThief : 0..maxint;
  115.    HomunculusTime : 0..maxint;
  116.    HomunculusStays : 0..maxint;
  117.    ItemsStolen : Boolean;
  118.    ThiefHere : Boolean;
  119.    TotalScore, RoomScore, ExtraScore : integer;
  120.    GolgiStained : Boolean;
  121.    ChestLocked : Boolean;
  122.    PillWorking : 0..10;
  123.    Growing : 0..9;
  124.    ContentsShown : Boolean;
  125.    WrongAnswer : Boolean;
  126.    CursorX : 1..80;
  127.    CursorY : 1..25;
  128.    inkey : char;
  129.  
  130. procedure ShowInventory; forward;
  131.  
  132. procedure CalculateScore; forward;
  133.  
  134. procedure PrintScore; forward;
  135.  
  136. procedure SaveCursor; forward;
  137.  
  138. procedure RestoreCursor; forward;
  139.  
  140. {$I MapFile.pas}
  141. {$I Frame}
  142.  
  143. procedure MemoryExam;
  144. var
  145.    value : integer;
  146.  
  147. begin
  148.    clrscr;
  149.    value := Mem[$F000 : $FFFE];
  150.    if value = 253 then
  151.       TextMode(C80);
  152.    value := Mem[$0000 : $0449];
  153.    if value <> 7 then
  154.       TextMode(BW80);
  155. end;
  156.  
  157. procedure Randomize;{Seeds random # generator}
  158. var
  159.    i,j : integer;
  160. begin
  161.    i := 0;
  162.    j := 0;
  163.    writeln;
  164.    TextColor(Yellow + 16);
  165.    writeln('                       --- Press "I" for Introduction ---');
  166.    write  ('                           --- Press "G" for Game ---');
  167.    while not keypressed do
  168.       begin
  169.          i := i + 13;
  170.          j := j + 17;
  171.          if i > 32000 then i := 0;
  172.          if j > 32000 then j := 0;
  173.       end;
  174.    MemW[DSeg:$0129]:= i;
  175.    MemW[DSeg:$012B]:= j;
  176.    Read(kbd,inkey);
  177.    inkey := UpCase(inkey);
  178.    clrscr;
  179. end;
  180.  
  181. procedure PressKey;
  182. begin
  183.    writeln;
  184.    write('                     --- Press space bar to continue. ---');
  185.    repeat
  186.       read(kbd,inkey);
  187.    until inkey <> '';
  188.    clrscr;
  189. end;
  190.  
  191. procedure ClearFrame;
  192. begin
  193.    window(1,1,80,25);
  194.    GotoXY(1,13);
  195.    write(chr(179));
  196.    GotoXY(80,13);
  197.    write(chr(179));
  198.    GotoXY(50,24);
  199.    write(chr(196));
  200.    window(2,2,79,23);
  201.    clrscr;
  202. end;
  203.  
  204. procedure TitleEnd;
  205. begin
  206.    delay(5000);
  207.    writeln;
  208.    Randomize;
  209.    TextBackground(Black);
  210.    TextColor(Yellow);
  211.    clrscr;
  212. end;
  213.  
  214. overlay procedure TitlePage;
  215. var
  216.    Title1,Title2,Title3,Title4,Title5,Title6,Title7 : string[80];
  217. begin
  218.    TextBackground(Black);
  219.    TextColor(Yellow);
  220.    clrscr;
  221.    GotoXY(1,2);
  222. Title1:='   ####### ####### ###### ##### #    # ###### ###### ###### ####### ######  ##';
  223. Title2:='    #    #  #    # #    #   #   ##   # #      #      #    #  #    # #       ##';
  224. Title3:='    #    #  #    # #    #   #   ###  # #      #      #    #  #    # #       ##';
  225. Title4:='    ######  ###### ######   #   # ## # ###### #      ######  ###### ####    ##';
  226. Title5:='    #    #  # #    #    #   #   #  ###      # #      #    #  #      #       ##';
  227. Title6:='    #    #  #  #   #    #   #   #   ##      # #      #    #  #      #       ';
  228. Title7:='   ####### ###  ## #    # ##### #    # ###### ###### #    # ###     ######  ##';
  229.       for CursorX := 1 to Length(Title1) do
  230.          if Title1[CursorX] = '#' then
  231.             write(chr(219))
  232.          else
  233.             write(' ');
  234.       writeln;
  235.       for CursorX := 1 to Length(Title2) do
  236.          if Title2[CursorX] = '#' then
  237.             write(chr(219))
  238.          else
  239.             write(' ');
  240.       writeln;
  241.       for CursorX := 1 to Length(Title3) do
  242.          if Title3[CursorX] = '#' then
  243.             write(chr(219))
  244.          else
  245.             write(' ');
  246.       writeln;
  247.       for CursorX := 1 to Length(Title4) do
  248.          if Title4[CursorX] = '#' then
  249.             write(chr(219))
  250.          else
  251.             write(' ');
  252.       writeln;
  253.       for CursorX := 1 to Length(Title5) do
  254.          if Title5[CursorX] = '#' then
  255.             write(chr(219))
  256.          else
  257.             write(' ');
  258.       writeln;
  259.       for CursorX := 1 to Length(Title6) do
  260.          if Title6[CursorX] = '#' then
  261.             write(chr(219))
  262.          else
  263.             write(' ');
  264.       writeln;
  265.       for CursorX := 1 to Length(Title7) do
  266.          if Title7[CursorX] = '#' then
  267.             write(chr(219))
  268.          else
  269.             write(' ');
  270.       writeln;
  271.    writeln;
  272.  
  273. writeln('                       --- An Adventure in Neuroanatomy ---');
  274. writeln;
  275. writeln('                                        by');
  276. writeln('                                W. Jeffrey Wilson');
  277. writeln('                                        &');
  278. writeln('                                 lynne ostergren');
  279.    writeln;
  280. writeln('                     Indiana University - Purdue University');
  281. writeln('                                  at Fort Wayne');
  282.    writeln;
  283. writeln('   Copyright 1985, Purdue Research Foundation. All Rights Reserved.  Unmodified');
  284. writeln('   copies of this program may be freely made and distributed.  This notice must');
  285. write  ('   appear on each copy.')
  286. end;
  287.  
  288. overlay procedure Introduction;
  289. begin
  290.    window(2,2,79,23);
  291.    clrscr;
  292.    writeln('   Having stayed up late last night studying for your upcoming Neuroanatomy');
  293.    writeln('exam, you slept fitfully, and awake none too refreshed.  At the foot of');
  294.    writeln('your bed you find a shrouded figure, wizened and gray, speaking to you with');
  295.    writeln('a distinct Old French accent.  "Bonjour.  Je m'+chr(39)+'appelle Rene Descartes.  O!');
  296.    writeln('Pardonez-moi!  Hello, Forgive me.  I am Rene Descartes," the figure says.');
  297.    writeln('"For years I have pondered the mysteries of the Mind-Brain problem, and I');
  298.    writeln('am now convinced that the only way to solve this philosophical impasse is to');
  299.    writeln('enter the brain itself and have a look around.  A mechanism by which this is');
  300.    writeln('possible has occurred to me, but I myself am too old and frail for such a');
  301.    writeln('trying journey.  You, however, a promising student of Neuroanatomy, and far');
  302.    writeln('younger than I, are ideal for the adventure."');
  303.    PressKey;
  304.    writeln('   Convinced that Descartes is nothing more than an aftereffect of the');
  305.    writeln('pepperoni pizza that saw you through your long hours of study last night,');
  306.    writeln('you head for the shower.  Descartes awaits you there, beckoning from the');
  307.    writeln('steamy stall, and you join him.');
  308.    writeln('   "LISTEN CLOSELY AND REMEMBER MY WORDS!" he booms through the hot spray');
  309.    writeln('of water.  "I am giving you two pills.  Take one now, and you will be safe');
  310.    writeln('from the phagocytes and white blood cells of the immune system during your');
  311.    writeln('journey through the blood supply to the brain.  Be sure to swallow the other');
  312.    writeln('one before leaving the brain to journey back to the heart, where I can');
  313.    writeln('rescue you.  REMEMBER... If you enter your bloodstream without having first');
  314.    writeln('taken the pill, you will surely not survive!"');
  315.    PressKey;
  316.    writeln('   Concerned now that a figment of your imagination is soaping your back,');
  317.    writeln('you turn to confront Descartes.  His gaze pierces you, and he continues.');
  318.    writeln('   "Once you reach the brain you will be safe from most physical harm, as');
  319.    writeln('long as you remain there.  You will undoubtedly be confronted with problems');
  320.    writeln('of many kinds.  In every case, your knowledge of Neuroanatomy and your');
  321.    writeln('uncommon good sense will provide a solution.  Persevere!  No problem is');
  322.    writeln('insurmountable."');
  323.    PressKey;
  324.    writeln('   You realize now that he is serious, and figment or not, you may well');
  325.    writeln('soon find yourself on your way to your own brain!  You begin to pay closer');
  326.    writeln('attention to what Descartes has to say.');
  327.    writeln('   "You can move in any of the six anatomical directions:');
  328.    writeln('                  Rostral: toward the head,');
  329.    writeln('                   Caudal: toward the tail,');
  330.    writeln('                   Medial: toward the midline,');
  331.    writeln('                  Lateral: toward the side,');
  332.    writeln('                   Dorsal: toward the top, or back,');
  333.    writeln('              and Ventral: toward the bottom, or stomach."');
  334.    PressKey;
  335.    writeln('   "Indicate your intentions with two-word phrases, such as '+chr(39)+'Go Rostral'+chr(39)+',');
  336.    writeln(chr(39)+'Get dendrite'+chr(39)+', or '+chr(39)+'Drop myelin'+chr(39)+'.  (Movement commands can be abbreviated');
  337.    writeln('by typing only the first letter of the direction in which you wish to move.)');
  338.    writeln('Several other commands might prove useful:');
  339.    writeln('         Inventory:  Show what you are carrying,');
  340.    writeln('             Score:  Indicate your current score,');
  341.    writeln('              Save:  Save the current game on disk,');
  342.    writeln('           Restore:  Restore the last saved game from disk,');
  343.    writeln('          and Quit:  Leave the current game."');
  344.    PressKey;
  345.    writeln('   Through a process that you could never hope to understand, Descartes has');
  346.    writeln('reduced you to a very small size, and is about to place you in your own');
  347.    writeln('carotid artery for the journey to the brain.');
  348.    writeln('   "To gain the most knowledge from this adventure, enter every area of the');
  349.    writeln('brain that you can.  Find the treasures of the brain, and bring them back');
  350.    writeln('to me.  Solve the problems that confront you.  And be absolutely certain');
  351.    writeln('that you bring back some growth hormone, for without it I am powerless to');
  352.    writeln('return you to your normal size, and you will remain miniscule forever."');
  353.    PressKey;
  354.    writeln('   "The anti-immune system pill has taken effect," Descartes assures you,');
  355.    writeln('as he injects you into your carotid artery, "so you wll be safe from the');
  356.    writeln('phagocytes.  Enjoy this journey, and learn much from it!"');
  357.    PressKey;
  358. end;
  359.  
  360. overlay procedure BloodToBrain;
  361. begin
  362.    window(2,2,79,23);
  363.    writeln('   Still reeling with excitement, you ponder your situation.  You are now in ');
  364.    writeln('your own carotid artery, coursing toward your brain!  You feel the surge of');
  365.    writeln('each heart beat as you are driven closer to your encounter with the very');
  366.    writeln('essence of yourself.');
  367.    PressKey;
  368.    writeln;
  369.    writeln('   Neuroanatomical terms occupy your thoughts during this, the most exciting');
  370.    writeln('journey of your life....');
  371.    writeln;
  372.    writeln('   Rostral, Caudal, Ventral, Dorsal, Lateral, Medial!');
  373.    writeln;
  374.    writeln('If only you had paid more attention during that Neuro lecture!');
  375.    PressKey;
  376.    writeln;
  377.    writeln('   The blood flows rapidly.  You pass through the circle of Willis and find');
  378.    writeln('yourself... Yes! in the choroid plexus of the lateral ventricle!');
  379.    PressKey;
  380.    writeln('   With some of the blood plasma, you leave the choroid plexus and enter');
  381.    writeln('the lateral ventricle itself.');
  382.    PressKey;
  383.    clrscr;
  384. end;
  385.  
  386. overlay procedure ReturnToHeart;
  387. begin
  388.    ClearFrame;
  389.    writeln('   From the Subarachnoid space you are swept through an arachnoid granulation');
  390.    writeln('and into the venous system through which blood leaves the brain.');
  391. if PillWorking > 0 then begin
  392.    ExtraScore := ExtraScore + 50;
  393.    writeln('White blood cells gather hungrily around you, but you are protected from');
  394.    writeln('them by the powerful medication provided by Descartes.');
  395.    PressKey;
  396.    writeln('   You find yourself in the jugular vein, leaving the head');
  397.    writeln('and coursing back toward the heart.  Fear grips you as you wonder whether or');
  398.    writeln('not you will be rescued by Descartes before the contractions of the heart ');
  399.    writeln('crush you.');
  400.    PressKey;
  401.    writeln('Descartes appears, just in time to save you.');
  402.    writeln('"What treasures of the brain have you brought me?," he asks.  You dutifully');
  403.    write('reveal that ');
  404.    ShowInventory;
  405.    if not ItemsGotten[GrowthHormone] and (Growing = 0) then begin
  406.       writeln('"Without growth hormone, you will remain tiny for the rest of your');
  407.       writeln('life," Descartes moans.  "There is nothing I can do!"');
  408.       end else begin
  409.       writeln('"Marvelous! You found the growth hormone! Now you can return to your');
  410.       writeln('normal size!" Descartes cries with relief.');
  411.       end;
  412.    CalculateScore;
  413.    Case TotalScore of
  414.    0..200: begin
  415.    writeln('"Your score is only ',TotalScore,'.  I expected so much from you, and I am');
  416.    writeln('sorely disappointed", he sighs.  "To have been so close to a full');
  417.    writeln('understanding of the brain, and to have failed!  I shall return to my');
  418.    writeln('studies, and hope that, in the future, someone else will succeed in');
  419.    writeln('uncovering the knowledge that lies in the brain.  This is my ultimate dream."');
  420.    end;
  421.    201..400: begin
  422.    writeln('"Your score is ',TotalScore,'.  You are only beginning to discover what ');
  423.    writeln('awaits you within your head.  You should try to learn more of the mysteries');
  424.    writeln('of the brain."');
  425.    end;
  426.    401..600: begin
  427.    writeln('"Good! A score of ',TotalScore,'!  You have made considerable progress toward');
  428.    writeln('furthering your knowledge of the brain.  However, you have much more to');
  429.    writeln('learn."');
  430.    end;
  431.    601..800: begin
  432.    writeln('"Very good!  You have scored ',TotalScore,'!  This score indicates that your');
  433.    writeln('knowledge of the brain has grown considerably, but there is still more');
  434.    writeln('to be learned.  Try again!  Explore further!"');
  435.    end;
  436.    801..1000: begin
  437.    writeln('"',TotalScore,' points! A remarkable achievement!  You are nearing a complete');
  438.    writeln('understanding of the brain!  Persevere!  There are still some aspects of');
  439.    writeln('the brain to be discovered.  I am quite certain that you are capable of');
  440.    writeln('a most complete exploration."');
  441.    end;
  442.    1001..1140: begin
  443.    writeln('"You are approaching perfection!  ',TotalScore,' points! You are so very close');
  444.    writeln('to a perfect score of 1150 points.  Try again. I know that this score is');
  445.    writeln('within your reach."');
  446.    end;
  447.    else begin
  448.    writeln('"A perfect score of ',TotalScore,'!  Never have I seen such an achievement!');
  449.    writeln('You have learned more about the brain than I knew in my day, and more than');
  450.    writeln('many people know today.  Congratulations on this most wonderous');
  451.    writeln('accomplishment!"');
  452.    end
  453.    end;
  454.    PressKey;
  455.    clrscr;
  456.    writeln('He is gone.');
  457.    delay(3000);
  458.    Verb := ' QUI ';
  459. end
  460. else begin
  461.    writeln('Unprotected by the anti-immune system pill, you are quickly engulfed by');
  462.    writeln('white blood cells.  Your final thought is of the knowledge you gained in');
  463.    writeln('this adventure, and of how foolish you were not to use it.');
  464.    CalculateScore;
  465.    writeln('Your score is ',TotalScore,'.');
  466.    PressKey;
  467.    Verb := ' QUI ';
  468. end;
  469. end;
  470.  
  471. overlay procedure WakeUp;
  472. begin
  473.    writeln;
  474.    writeln('     You awaken to the sound of the alarm clock, your head spinning with ');
  475.    writeln('neuroanatomical terminology.  Rather than feeling refreshed, you feel oddly');
  476.    writeln('as if the night had been spent in deep concentration.  No time to dwell on');
  477.    writeln('that now.  You',chr(39),'ve got to get ready for that neuroanatomy exam....');
  478.    writeln;
  479.    delay(5000);
  480.    PressKey;
  481.    window(1,1,80,25);
  482. end;
  483.  
  484. procedure ShowContents;
  485. begin
  486.    if not ContentsShown then
  487.       begin
  488.          SaveCursor;
  489.          window(51,14,79,23);
  490.          clrscr;
  491.          writeln('Items that you see:');
  492.          for Object := DA to LastObject do
  493.                if Room[Loc].Item[Object] then
  494.                   writeln(ObjectDescription[Object]);
  495.          ContentsShown := True;
  496.          RestoreCursor;
  497.       end;
  498. end;
  499.  
  500. procedure CalculateLoad;
  501. var
  502.    Object : DA..Glass;
  503. begin
  504.    Load := 0;
  505.    for Object := DA to LastObject do
  506.       if ItemsGotten[Object] then
  507.          Load := Load + 1;
  508. end;
  509.  
  510. {$I Rmdesc.pas}
  511.  
  512. procedure CorrectAnswer;
  513. var
  514.    index : integer;
  515. begin
  516.    index := 0;
  517.    WrongAnswer := False;
  518.    HomunculusStays := 0;
  519.    clrscr;
  520.    writeln('That is absolutely correct!  Because you');
  521.    writeln('knew the answer, you will be transported to...');
  522.    delay(3000);
  523.    repeat
  524.       index := index + 1;
  525.       Loc := RoomTypes(random(50));
  526.    until ((Loc > CaudateTail) and (Loc <> Accumbens) and (Loc <> Amygdala) and
  527.          (Loc <> Pyramids) and (Loc <> Pituitary) and (Loc <> VisualCx) and
  528.          (Loc <> TrapezoidBody) and (not Room[Loc].Visited)) or (index = 1200);
  529.    if index = 1200 then
  530.       repeat
  531.          Loc := RoomTypes(random(50));
  532.       until (Loc > CaudateTail) and (Loc <> Accumbens) and (Loc <> Amygdala) and
  533.             (Loc <> Pyramids) and (Loc <> Pituitary) and (Loc <> VisualCx) and
  534.             (Loc <> TrapezoidBody);
  535.    clrscr;
  536. end;
  537.  
  538. procedure IncorrectAnswer;
  539. begin
  540.    clrscr;
  541.    writeln('That is wrong!');
  542.    if WrongAnswer then begin
  543.       writeln('Descartes appears, quite disappointed.');
  544.       writeln('"Two wrong answers in a row.  You have clearly');
  545.       writeln('not yet mastered the material.  You are hereby');
  546.       writeln('banished to the pineal body - yes, the very');
  547.       writeln('seat of the soul - where you must forever');
  548.       writeln('contemplate the brain in all of its wonder.');
  549.       CalculateScore;
  550.       writeln('You have scored a total of ',TotalScore,' points."');
  551.       Verb := ' QUI ';
  552.       WrongAnswer := False;
  553.       write('    Press Space Bar to Continue.');
  554.       read(kbd,inkey);
  555.       Loc := Loc1
  556.    end else begin
  557.       WrongAnswer := True;
  558.       writeln('You will have one more chance to answer a');
  559.       writeln('question correctly, or face being banished to');
  560.       writeln('the pineal body by Descartes!');
  561.       end;
  562. end;
  563.  
  564. {$I Question.pas}
  565.  
  566. procedure RoomWindow;
  567. begin
  568.    window(2,2,79,12);
  569.    clrscr;
  570. end;
  571.  
  572. procedure CommentWindow;
  573. begin
  574.    window(2,14,49,23);
  575.    clrscr;
  576. end;
  577.  
  578. procedure SaveCursor;
  579. begin
  580.    window(2,14,49,23);
  581.    CursorX := WhereX;
  582.    CursorY := WhereY;
  583. end;
  584.  
  585. procedure RestoreCursor;
  586. begin
  587.    window(2,14,49,23);
  588.    GotoXY(CursorX,CursorY);
  589. end;
  590.  
  591. procedure RestoreCursorTwo;
  592. begin
  593.    window(2,14,49,23);
  594.    CursorX := 1;
  595.    CursorY := 3;
  596.    GotoXY(CursorX,CursorY);
  597. end;
  598.  
  599. procedure LongDescription;
  600. begin
  601.    RoomDescriptionsOne;
  602.    if Loc = ChestLoc then begin
  603. writeln('There is an old wooden chest attached to the wall here.  It has ornately');
  604. writeln('carved wooden doors, and a big, rusty padlock.');
  605.    end;
  606.    ContentsShown := False;
  607.    ShowContents;
  608. end;
  609.  
  610. procedure ThiefFound;
  611. begin
  612.    if ItemsStolen and (Loc = ThiefLair) then
  613.       ThiefHere := True
  614.    else
  615.       ThiefHere := False;
  616. end;
  617.  
  618. procedure DescribeRoom;
  619. begin
  620.    SaveCursor;
  621.    RoomWindow;
  622.    Write('You are in ');
  623.    if (Loc = Wernickes) or (Loc = Brocas) then
  624.       writeln(Room[Loc].Name,'.')
  625.    else
  626.       writeln('the ',Room[Loc].Name,'.');
  627.    LongDescription;
  628.    ThiefFound;
  629.    if ThiefHere then
  630.       begin
  631.          window(2,2,79,12);
  632.          GotoXY(1,7);
  633.          writeln;
  634.          writeln('You have found the lair of Golgi'+chr(39)+'s ghost!');
  635.          writeln('He is cowering in a corner, muttering about this invasion of his sanctuary!');
  636.       end;
  637.    if not Room[Loc].Visited then
  638.       begin
  639.          Room[Loc].Visited := True;
  640.          if Loc = SensoryStrip then begin
  641.             window(2,2,79,12);
  642.             GotoXY(1,7);
  643.             writeln;
  644.             writeln('There is a small, oddly shaped man here.  He has a huge mouth, gigantic');
  645.             writeln('hands, and a tiny torso.  He is eyeing you with interest.');
  646.             writeln('It is a Homunculus!');
  647.             HomunculusStays := 2 + Random(8);
  648.             HomunculusTime := 30 + Random(30);
  649.          end;
  650.       end;
  651.    ShowContents;
  652.    RestoreCursor;
  653. end;
  654.  
  655. procedure TimerCommand;
  656.  
  657. var
  658.    inkey : char;
  659.    timer : real;
  660.    timeout : real;
  661.  
  662. begin
  663.    timer := 0;
  664.    timeout := 30000;
  665.    command := '';
  666.    inkey := ' ';
  667.    write('What do you want to do? ');
  668.    repeat
  669.       timer := timer + 1.0;
  670.       if keypressed then begin
  671.             read(kbd,inkey);
  672.                case inkey of
  673.                   #8,#27:begin
  674.                      delete(command, length(command),1);
  675.                      GotoXY(WhereX-1,WhereY);
  676.                      write(' ');
  677.                      GotoXY(WhereX-1,WhereY);
  678.                      end;
  679.                   #13: inkey := #13;
  680.                   else begin
  681.                      write(inkey);
  682.                      command := command + inkey;
  683.                        end
  684.                end;
  685.          end;
  686.    until (timer >= timeout) or ((inkey = #13) and (length(command)>0) and (command[ord(command[0])]<>' '));
  687.    writeln;
  688.    if timer = timeout then
  689.       Command := TimeCommand[Loc]
  690. end;
  691.  
  692. procedure GetCommand;
  693. begin
  694.    window(2,14,49,23);
  695.    GotoXY(1,1);
  696.    clreol;
  697.    if Loc < SubArachnoid then
  698.       TimerCommand
  699.    else
  700.       repeat
  701.          write('What do you want to do? ');
  702.          readln(Command);
  703.       until (ord(Command[0]) <> 0) and (Command[ord(Command[0])] <> ' ');
  704.    while Command[1] = ' ' do
  705.       delete (Command, 1, 1);
  706.    for index := 1 to ord(Command[0]) do
  707.       Command[index] := UpCase(Command[index]);
  708.    CommandDupe := Command + ' ';
  709.    if pos(' ',CommandDupe) > 3 then
  710.          delete(CommandDupe, 4, 24)
  711.       else
  712.          delete(CommandDupe, pos(' ',CommandDupe), 24);
  713.    Verb := ' ' + CommandDupe + ' ';
  714.    CommandDupe := Command + ' ';
  715.    Noun := '';
  716.    while CommandDupe[1] <> ' ' do
  717.       delete (CommandDupe, 1, 1);
  718.    if length(CommandDupe) > 1 then
  719.       while CommandDupe[1] = ' ' do
  720.          delete (CommandDupe, 1, 1);
  721.    NounDupe := CommandDupe;
  722.    if pos(' ',CommandDupe) > 3 then
  723.          delete(CommandDupe, 4, 24)
  724.       else
  725.          delete(CommandDupe, pos(' ',CommandDupe), 24);
  726.    Noun := ' ' + CommandDupe + ' ';
  727. end;
  728.  
  729. procedure Interpret;
  730. begin
  731.    CommentWindow;
  732.    writeln;
  733.    writeln;
  734.    Cmd := None;
  735.    if pos(Verb, MoveList) > 0 then
  736.      begin
  737.       Cmd := Move;
  738.       if pos(Verb, MoveList) > 15 then
  739.          Noun := Verb;
  740.      end;
  741.    if pos(Verb, GetList) > 0 then
  742.       Cmd := Get;
  743.    if pos(Verb, PutList) > 0 then
  744.       Cmd := Put;
  745.    if pos(Verb, ManipList) > 0 then
  746.       Cmd := Manip;
  747.    if pos(Verb,EatList) > 0 then
  748.       Cmd := Eat;
  749.    if pos(Verb, LookList) > 0 then
  750.       Cmd := Look;
  751.    if pos(Verb, InvList) > 0 then
  752.       Cmd := Inventory;
  753.    if pos(Verb, ScoreList) > 0 then
  754.       Cmd := ReportScore;
  755.    if pos(Verb, SaveList) > 0 then
  756.       Cmd := Save;
  757.    if pos(Verb, RestoreList) > 0 then
  758.       Cmd := Restore;
  759.    if pos(Verb, HelpList) > 0 then
  760.       Cmd := Help;
  761.    if pos(Verb, QuitList) > 0 then
  762.       Cmd := Quit;
  763.    if Noun = ' HOM ' then
  764.       Cmd := HomuncPestered;
  765.    if not(Cmd in[Inventory, ReportScore, Save, Restore, Help, Quit]) then begin
  766.       if Cmd = None then
  767.          case random(5) of
  768.             0: writeln('I do not understand the verb "',Verb,'".');
  769.             1: writeln('That makes no sense at all!');
  770.             2: writeln('I do not know how to ',Command,'.');
  771.             3: writeln('What are you, Nuts?');
  772.             4: writeln('"',Command,'" is not in my vocabulary.')
  773.          end
  774.       else
  775.          if Noun = '  ' then begin
  776.             writeln('Indicate what you want to ',Command,'.');
  777.             Cmd := None;
  778.          end;
  779.    end;
  780. end;
  781.  
  782. procedure MovePlayer;
  783. begin
  784.    Loc1 := Loc;
  785.    if (Noun = ' D ') or (Noun = ' DOR ') then
  786.       Loc := Room[Loc].AdjRoom[D]
  787.    else
  788.    if (Noun = ' V ') or (Noun = ' VEN ') then
  789.       Loc := Room[Loc].AdjRoom[V]
  790.    else
  791.    if (Noun = ' L ') or (Noun = ' LAT ') then
  792.       Loc := Room[Loc].AdjRoom[L]
  793.    else
  794.    if (Noun = ' M ') or (Noun = ' MED ') then
  795.       Loc := Room[Loc].AdjRoom[M]
  796.    else
  797.    if (Noun = ' R ') or (Noun = ' ROS ') then
  798.       Loc := Room[Loc].AdjRoom[R]
  799.    else
  800.    if (Noun = ' C ') or (Noun = ' CAU ') then
  801.       Loc := Room[Loc].AdjRoom[C];
  802.    if Loc in [Assoc1..Assoc5] then
  803.       begin
  804.          Escape := Escape + Copy(Noun,2,1);
  805.          Delete(Escape,1,1);
  806.          if Escape = EscapeKey then
  807.             begin
  808.                Loc := FrontalLobe;
  809.                Escape := '   ';
  810.             end;
  811.       end;
  812.    if (Loc = Amygdala) and (Loc1 = CaudateTail) then begin
  813.       RoomWindow;
  814.       writeln('You have lost your footing, and are slipping down the long, twisting tail');
  815.       writeln('of the caudate nucleus....');
  816.       delay(5000);
  817.    end;
  818.    if Loc = NoWhere then
  819.       begin
  820.          writeln;
  821.          case random(5) of
  822.             0: writeln('You can not move that way!');
  823.             1: writeln('Moving',Noun,'from here is impossible.');
  824.             2: writeln('Should I make my own door?');
  825.             3: writeln('You try to move',Noun,',but you bruise your nose.');
  826.             4: writeln('You cannot move through solid matter.')
  827.          end;
  828.          Loc := Loc1;
  829.       end;
  830.    if Loc = NotYet then
  831.       case Loc1 of
  832.          NigrostriatalBundle: if ItemsGotten[DA] then
  833.                                 Loc := CaudateHead
  834.                               else begin
  835.                                 writeln;
  836.                                 writeln('You need dopamine to go that way.');
  837.                                 Loc := Loc1;
  838.                               end;
  839.          VentralNoradBundle : if ItemsGotten[NE] then
  840.                                 Loc := Thalamus
  841.                               else begin
  842.                                 writeln;
  843.                                 writeln('You need norepinephrine to go that way.');
  844.                                 Loc := Loc1;
  845.                               end;
  846.          Septum, Hippocampus: begin
  847.                                  writeln;
  848.                                  writeln('You cannot pass that way... Yet!');
  849.                                  Loc := Loc1;
  850.                               end;
  851.       end;
  852.    if Loc = Question then
  853.       PoseQuestion;
  854.    if (Loc = Foramen) and (HomunculusStays > 0) then
  855.       HomunculusStays := 1;
  856.    if Loc = SubArachnoid then
  857.       begin
  858.          DescribeRoom;
  859.          Delay(5000);
  860.          ReturnToHeart;
  861.          Loc := Loc1;
  862.       end;
  863.    if (Loc <> Loc1) and (TimeForThief < 2) and GolgiStained then
  864.       TimeForThief := 10 + random(30);
  865.    if Loc <> Loc1 then
  866.       begin
  867.          ContentsShown := False;
  868.          RoomWindow;
  869.          DescribeRoom;
  870.       end;
  871. end;
  872.  
  873. procedure IdentifyVesicle;
  874. var
  875.    VesiclePresent : boolean;
  876.    MoreThanOne : Boolean;
  877.    Response : char;
  878.  
  879. begin
  880.    VesiclePresent := False;
  881.    MoreThanOne := False;
  882.    Response := ' ';
  883. if Cmd = Get then begin
  884.    for Object := VesDA to VesGABA do
  885.       begin
  886.          if Room[Loc].Item[Object] then
  887.            begin
  888.             if VesiclePresent then
  889.                MoreThanOne := True
  890.             else
  891.                VesiclePresent := True;
  892.            end;
  893.       end;
  894.    if not VesiclePresent then
  895.       Object := VesDA
  896.    else
  897.       if MoreThanOne then
  898.         begin
  899.          Object := GABA;
  900.          repeat
  901.             Object := succ(Object);
  902.             if Object = PurkinjeCell then
  903.                Object := VesDA;
  904.             if Room[Loc].Item[Object] then
  905.                begin
  906.                   writeln('Do you mean ',ObjectDescription[Object],'? (y/n)');
  907.                   readln(Response);
  908.                end;
  909.          until (Response = 'y') or (Response = 'Y');
  910.         end
  911.       else
  912.         begin
  913.          Object := GABA;
  914.          repeat
  915.             Object := succ(Object);
  916.          until Room[Loc].Item[Object];
  917.         end;
  918.  end
  919. else
  920. if Cmd = Put then begin
  921.  for Object := VesDA to VesGABA do
  922.       begin
  923.          if ItemsGotten[Object] then
  924.            begin
  925.             if VesiclePresent then
  926.                MoreThanOne := True
  927.             else
  928.                VesiclePresent := True;
  929.            end;
  930.       end;
  931.    if not VesiclePresent then
  932.       Object := VesDA
  933.    else
  934.       if MoreThanOne then
  935.         begin
  936.          Object := GABA;
  937.          repeat
  938.             Object := succ(Object);
  939.             if Object = PurkinjeCell then
  940.                Object := VesDA;
  941.             if ItemsGotten[Object] then
  942.                begin
  943.                   writeln('Do you mean ',ObjectDescription[Object],'? (y/n)');
  944.                   readln(Response);
  945.                end;
  946.          until (Response = 'y') or (Response = 'Y');
  947.         end
  948.       else
  949.         begin
  950.          Object := GABA;
  951.          repeat
  952.             Object := succ(Object);
  953.          until ItemsGotten[Object];
  954.         end;
  955.  end;
  956. end;
  957.  
  958. procedure IdentifyCell;
  959. begin
  960.    if Cmd = Get then begin
  961.       if Room[Loc].Item[PyramidalCell] then
  962.          Object := PyramidalCell
  963.       else
  964.       if Room[Loc].Item[PurkinjeCell] then
  965.          Object := PurkinjeCell
  966.       else
  967.       if Room[Loc].Item[Oligodendrocyte] then
  968.          Object := Oligodendrocyte;
  969.    end;
  970.    if Cmd = Put then begin
  971.       if ItemsGotten[PyramidalCell] then
  972.          Object := PyramidalCell
  973.       else
  974.       if ItemsGotten[PurkinjeCell] then
  975.          Object := PurkinjeCell
  976.       else
  977.       if ItemsGotten[Oligodendrocyte] then
  978.          Object := Oligodendrocyte;
  979.    end;
  980. end;
  981.  
  982. procedure IdentifyObject;
  983. begin
  984.    Object := Nothing;
  985.    Index := pos(Noun,ItemsToGet);
  986.    case Index of
  987.       5,9:      Object := DA;
  988.       13,17,21: Object := NE;
  989.       25,29:    Object := ACh;
  990.       33,37:    Object := SER;
  991.       41:       Object := GABA;
  992.       45:       IdentifyVesicle;
  993.       49:       Object := PurkinjeCell;
  994.       53:       Object := PyramidalCell;
  995.       57, 101:  Object := Pill;
  996.       61,65,69: Object := GolgiStain;
  997.       73:       Object := Oligodendrocyte;
  998.       77,81,85: Object := GrowthHormone;
  999.       89:       Object := Key;
  1000.       93,97:    Object := Scrap;
  1001.       105:      IdentifyCell;
  1002.       109:      Object := Glass
  1003.    end;
  1004. end;
  1005.  
  1006. procedure GetDA;
  1007. begin
  1008.    if ItemsGotten[VesDA] or (ObjectDescription[VesDA] = '') then
  1009.       begin
  1010.          ItemsGotten[DA] := True;
  1011.          Room[Loc].Item[DA] := False;
  1012.          writeln('Dopamine taken.');
  1013.          ObjectDescription[DA] := 'dopamine in a vesicle';
  1014.          ObjectDescription[VesDA] := '';
  1015.          ItemsGotten[VesDA] := False;
  1016.       end
  1017.    else
  1018.       writeln('You have nothing to put it in.');
  1019. end;
  1020.  
  1021. procedure GetNE;
  1022. begin
  1023.    if ItemsGotten[VesNE] or (ObjectDescription[VesNE] = '') then
  1024.       begin
  1025.          ItemsGotten[NE] := True;
  1026.          Room[Loc].Item[NE] := False;
  1027.          writeln('Norepinephrine taken.');
  1028.          ObjectDescription[NE] := 'norepinephrine in a vesicle';
  1029.          ObjectDescription[VesNE] := '';
  1030.          ItemsGotten[VesNE] := False;
  1031.       end
  1032.    else
  1033.       writeln('You have nothing to put it in.');
  1034. end;
  1035.  
  1036. procedure GetACh;
  1037. begin
  1038.    if ItemsGotten[VesACh] or (ObjectDescription[VesACh] = '') then
  1039.       begin
  1040.          ItemsGotten[ACh] := True;
  1041.          Room[Loc].Item[ACh] := False;
  1042.          writeln('Acetylcholine taken.');
  1043.          ObjectDescription[ACh] := 'acetylcholine in a vesicle';
  1044.          ObjectDescription[VesACh] := '';
  1045.          ItemsGotten[VesACh] := False;
  1046.       end
  1047.    else
  1048.       writeln('You have nothing to put it in.');
  1049. end;
  1050.  
  1051. procedure GetSer;
  1052. begin
  1053.    if ItemsGotten[Ves5HT] or (ObjectDescription[Ves5HT] = '') then
  1054.       begin
  1055.          ItemsGotten[SER] := True;
  1056.          Room[Loc].Item[SER] := False;
  1057.          writeln('Serotonin taken.');
  1058.          ObjectDescription[SER] := 'serotonin in a vesicle';
  1059.          ObjectDescription[Ves5HT] := '';
  1060.          ItemsGotten[Ves5HT] := False;
  1061.       end
  1062.    else
  1063.       writeln('You have nothing to put it in.');
  1064. end;
  1065.  
  1066. procedure GetGABA;
  1067. begin
  1068.    if ItemsGotten[VesGABA] or (ObjectDescription[VesGABA] = '') then
  1069.       begin
  1070.          ItemsGotten[GABA] := True;
  1071.          Room[Loc].Item[GABA] := False;
  1072.          writeln('GABA taken.');
  1073.          ObjectDescription[GABA] := 'GABA in a vesicle';
  1074.          ObjectDescription[VesGABA] := '';
  1075.          ItemsGotten[VesGABA] := False;
  1076.       end
  1077.    else
  1078.       writeln('You have nothing to put it in.');
  1079. end;
  1080.  
  1081. procedure RenameVesicle;
  1082. begin
  1083.    case Object of
  1084.       VesDA : ObjectDescription[Object] := 'a dopaminergic vesicle';
  1085.       VesNE : ObjectDescription[Object] := 'a noradrenergic vesicle';
  1086.       Ves5HT: ObjectDescription[Object] := 'a serotonergic vesicle';
  1087.       VesAch: ObjectDescription[Object] := 'a cholinergic vesicle';
  1088.       VesGABA:ObjectDescription[Object] := 'a GABAergic vesicle';
  1089.       GrowthHormone:ObjectDescription[Object] := 'growth hormone';
  1090.       GolgiStain: if pos('o',ObjectDescription[Object])=0 then
  1091.                      ObjectDescription[Object] :=
  1092.                      'a fragile vial with an old label'
  1093.    end;
  1094. end;
  1095.  
  1096. procedure GetItem;
  1097. begin
  1098.    writeln;
  1099.    if pos(Noun,ItemsToGet) > 0 then
  1100.       begin
  1101.          if Noun = ' ALL ' then
  1102.             begin
  1103.                ContentsShown := False;
  1104.                RestoreCursorTwo;
  1105.                for Object :=DA to LastObject do
  1106.                   if Room[Loc].Item[Object] then
  1107.                      begin
  1108.                         if Load < LoadLimit then
  1109.                            begin
  1110.                               case Object of
  1111.                                  DA: GetDA;
  1112.                                  NE: GetNE;
  1113.                                 ACh: GetACh;
  1114.                                 SER: GetSer;
  1115.                                GABA: GetGABA
  1116.                               else
  1117.                                  begin
  1118.                                     ItemsGotten[Object] := True;
  1119.                                     Room[Loc].Item[Object] := False;
  1120.                                     RenameVesicle;
  1121.                                     writeln (ObjectDescription[Object],' taken.');
  1122.                                     CalculateLoad;
  1123.                                  end;
  1124.                               end;
  1125.                            end
  1126.                         else
  1127.                            begin
  1128.                               writeln('You cannot carry any more!');
  1129.                               Object := LastObject;
  1130.                            end;
  1131.                      end;
  1132.             end
  1133.          else
  1134.             begin
  1135.                IdentifyObject;
  1136.                if (Object in [DA, NE, ACh, SER, GABA])
  1137.                 and (length(NounDupe)>13)
  1138.                 and Room[Loc].Item[Objects(Ord(Object)+5)] then
  1139.                   Object := Objects(Ord(Object)+5);
  1140.                if not Room[Loc].Item[Object] then
  1141.                   writeln('I do not see a ', NounDupe,'here.')
  1142.                else
  1143.                   begin
  1144.                      if Load < LoadLimit then
  1145.                         begin
  1146.                            ContentsShown := False;
  1147.                            RestoreCursorTwo;
  1148.                            case Object of
  1149.                               DA: GetDA;
  1150.                               NE: GetNE;
  1151.                               ACh: GetACh;
  1152.                               SER: GetSer;
  1153.                               GABA: GetGABA
  1154.                               else
  1155.                                  begin
  1156.                                     ItemsGotten[Object] := True;
  1157.                                     Room[Loc].Item[Object] := False;
  1158.                                     RenameVesicle;
  1159.                                     writeln (NounDupe,' taken.');
  1160.                                     CalculateLoad;
  1161.                                  end;
  1162.                               end;
  1163.                         end
  1164.                      else
  1165.                         writeln('You cannot carry anything else!');
  1166.                   end;
  1167.             end;
  1168.       ShowContents;
  1169.       end
  1170.    else
  1171.       case random(5) of
  1172.          0: writeln('I do not know how to get a ',NounDupe,'.');
  1173.          1: writeln('What a novel idea!');
  1174.          2: writeln('You must be joking!');
  1175.          3: writeln(NounDupe,'! How can I get a ',NounDupe,'?');
  1176.          4: writeln('Get it yourself!')
  1177.       end;
  1178. end;
  1179.  
  1180. procedure PutItem;
  1181. begin
  1182.    writeln;
  1183.    if pos(Noun,ItemsToGet) > 0 then
  1184.     begin
  1185.      if Noun = ' ALL ' then
  1186.         begin
  1187.          ContentsShown := False;
  1188.          RestoreCursorTwo;
  1189.          for Object := DA to LastObject do
  1190.             if ItemsGotten[Object] then
  1191.                begin
  1192.                   writeln(ObjectDescription[Object],' dropped.');
  1193.                   Room[Loc].Item[Object] := True;
  1194.                   if (Object = GolgiStain) and (Loc > Foramen) then
  1195.                      begin
  1196.                         writeln('The crystal shatters as it hits the floor!');
  1197.                         Room[Loc].Item[Glass] := True;
  1198.                         Room[Loc].Item[GolgiStain] := False;
  1199.                   end;
  1200.                   ItemsGotten[Object] := False;
  1201.                   if Loc < Foramen then
  1202.                      begin
  1203.                         Room[Loc].Item[Object] := False;
  1204.                         Room[Foramen].Item[Object] := True;
  1205.                         writeln('...And carried away by the flow of the');
  1206.                         writeln('cerebrospinal fluid!');
  1207.                      end;
  1208.                end;
  1209.          end
  1210.      else
  1211.       begin
  1212.          IdentifyObject;
  1213.          if (Object in [DA, NE, ACh, SER, GABA])
  1214.                 and (length(NounDupe)>13)
  1215.                 and ItemsGotten[Objects(Ord(Object)+5)] then
  1216.                   Object := Objects(Ord(Object)+5);
  1217.          if not ItemsGotten[Object] then begin
  1218.             writeln('I cannot put down the ',NounDupe);
  1219.             writeln('if I do not have it!');
  1220.             end
  1221.          else
  1222.          begin
  1223.             ContentsShown := False;
  1224.             RestoreCursorTwo;
  1225.             ItemsGotten[Object] := False;
  1226.             Room[Loc].Item[Object] := True;
  1227.             writeln(NounDupe,' dropped.');
  1228.             if (Object = GolgiStain) and (Loc > Foramen) then begin
  1229.                writeln('The crystal shatters as it hits the floor!');
  1230.                Room[Loc].Item[GolgiStain] := False;
  1231.                Room[Loc].Item[Glass] := True;
  1232.             end;
  1233.             if Loc < Foramen then
  1234.                begin
  1235.                   Room[Loc].Item[Object] := False;
  1236.                   Room[Foramen].Item[Object] := True;
  1237.                   writeln('The flow of cerebrospinal fluid carries off the');
  1238.                   writeln(NounDupe);
  1239.                end;
  1240.          end;
  1241.       end;
  1242.      ShowContents;
  1243.      end
  1244.    else
  1245.       writeln('I cannot put down the ',NounDupe,'.');
  1246. end;
  1247.  
  1248. procedure HomuncLeavesSensStrip;
  1249. begin
  1250.    if Loc = SensoryStrip then
  1251.       begin
  1252.          window(2,7,79,12);
  1253.          clrscr;
  1254.          window(2,14,49,23);
  1255.          GotoXY(1,3);
  1256.       end;
  1257. end;
  1258.  
  1259. procedure ManipulateItem;
  1260. begin
  1261.    writeln;
  1262.    if (Verb = ' UNL ') and (Loc = ChestLoc) and (Noun = ' CHE ') then
  1263.     begin
  1264.       if ItemsGotten[Key] then begin
  1265.          writeln('The padlock opens readily!');
  1266.          ChestLocked := False;
  1267.          end
  1268.       else
  1269.          writeln('You do not have a key!');
  1270.     end
  1271.    else
  1272.    if (Verb = ' OPE ') and (Loc = ChestLoc) and (Noun = ' CHE ') then
  1273.     begin
  1274.       if ChestLocked then
  1275.          writeln('The chest is locked!')
  1276.       else begin
  1277.          writeln('Opening the chest reveals a vial.');
  1278.          writeln('The label is old and yellowed.');
  1279.          Room[Loc].Item[GolgiStain] := True;
  1280.          ContentsShown := False;
  1281.          ShowContents;
  1282.          RestoreCursorTwo;
  1283.       end;
  1284.     end
  1285.    else
  1286.    if (Verb = ' REA ') and ((Noun = ' LAB ') or (Noun = ' VIA '))
  1287.            and (ItemsGotten[Golgistain] or Room[Loc].Item[GolgiStain]) then
  1288.       begin
  1289.          writeln('You can barely make out the faded characters.');
  1290.          writeln('               "ACME Golgi Stain');
  1291.          writeln('        for silver impregnation of cells"');
  1292.          writeln('           (and cantankerous ghosts!)"');
  1293.          if pos('via',ObjectDescription[GolgiStain])>0 then
  1294.             ObjectDescription[GolgiStain] := 'a vial of Golgi Stain';
  1295.          ContentsShown := False;
  1296.          ShowContents;
  1297.       end
  1298.    else
  1299.    if ((Verb = ' REA ') or (Verb = ' LOO ') or (Verb = ' EXA '))
  1300.       and ((Noun = ' PAP ') or (Noun = ' SCR ')) and ItemsGotten[Scrap] then
  1301.       begin
  1302.          writeln('     "We hope you are enjoying BRAINSCAPE!');
  1303.          writeln('Please send comments, suggestions, or pleas');
  1304.          writeln('for help to:');
  1305.          writeln;
  1306.          writeln('   W. Jeffrey Wilson, Ph.D.');
  1307.          writeln('   Dept. of Psychological Sciences');
  1308.          writeln('   Indiana University-Purdue University');
  1309.          writeln('   Fort Wayne, IN  46805"');
  1310.       end
  1311.    else
  1312.    if (Verb = ' LOO ') or (Verb = ' EXA ') then
  1313.       writeln('I see nothing special about the ',NounDupe)
  1314.    else
  1315.    if ((Verb = ' STA ') or (Verb = ' SPR ') or (Verb = ' THR '))
  1316.          and ((Noun = ' GHO ') or (Noun = ' GOL ')or (Noun = ' STA ')
  1317.          or (Noun = ' VIA '))
  1318.          and ItemsGotten[GolgiStain]
  1319.          and (Loc = ThiefLair) and (ItemsStolen) then
  1320.       begin
  1321.        if (Verb = ' THR ') and (Noun = ' VIA ') then begin
  1322.           ItemsGotten[GolgiStain] := False;
  1323.           Room[Loc].Item[Glass] := True;
  1324.           ContentsShown := False;
  1325.           writeln('The crystal shatters against the ghost!');
  1326.           ShowContents;
  1327.        end;
  1328.        if not GolgiStained then begin
  1329.          writeln('Golgi'+chr(39)+'s Ghost shrieks in terror as he is doused');
  1330.          writeln('by the stain.  He begins to glow, and the eerie');
  1331.          writeln('silver light fills the air.');
  1332.          GolgiStained := True;
  1333.          ExtraScore := ExtraScore + 100;
  1334.        end else begin
  1335.          writeln('The wretched fellow has already been stained!');
  1336.        end;
  1337.       end
  1338.    else
  1339.    if ((Verb = ' EAT ') or (Verb = ' SWA ')) then
  1340.       if (Noun = ' PIL ') then
  1341.          if ItemsGotten[Pill] then
  1342.            begin
  1343.              ItemsGotten[Pill] := False;
  1344.              PillWorking := 10;
  1345.              writeln('Mmmm... Suddenly you feel very protected.');
  1346.            end
  1347.          else
  1348.             writeln('You do not have a pill.')
  1349.       else if (Noun = ' GRO ') or (Noun = ' HOR ') then
  1350.          if ItemsGotten[GrowthHormone] then
  1351.             begin
  1352.                ItemsGotten[GrowthHormone] := False;
  1353.                ExtraScore := ExtraScore + 100;
  1354.                Growing := 1;
  1355.                if HomunculusStays > 0 then
  1356.                   writeln('The Homunculus scurries off, startled!');
  1357.                HomuncLeavesSensStrip;
  1358.                HomunculusStays := 0;
  1359.                writeln('Mmmm... you suddenly feel quite a bit stronger.');
  1360.             end
  1361.          else
  1362.             writeln('You do not have any ',NounDupe,'.')
  1363.       else
  1364.          writeln('What a revolting idea!!')
  1365.    else
  1366.       writeln('You cannot do that... yet.');
  1367. end;
  1368.  
  1369. procedure Thief;
  1370. begin
  1371.    if (TimeForThief = 0) and (Loc <> ThiefLair) then
  1372.       begin
  1373.          GotoXY(1,5);
  1374.          writeln('===============================================');
  1375.          writeln('Golgi'+chr(39)+'s Ghost appears, seemingly from nowhere!');
  1376.          writeln('"If you want to live, give me your treasures!"');
  1377.          HaveSomething := False;
  1378.          for Object := DA to LastObject do
  1379.             begin
  1380.                Room[ThiefLair].Item[Object] :=
  1381.                           ItemsGotten[Object] or Room[ThiefLair].Item[Object];
  1382.                if ItemsGotten[Object] = True then
  1383.                   begin
  1384.                      HaveSomething := True;
  1385.                      ItemsStolen := True;
  1386.                   end;
  1387.                ItemsGotten[Object] := False;
  1388.             end;
  1389.          if not HaveSomething then
  1390.             write('"Nothing for me this time?  ');
  1391.          if HaveSomething then
  1392.             write('  "');
  1393.          writeln('I shall return!"');
  1394.          writeln('He is gone, as mysteriously as he appeared!');
  1395.          write('===============================================');
  1396.          TimeForThief := 40 + random(30);
  1397.       end
  1398.    else
  1399.    if (TimeForThief < 3) and GolgiStained and (Loc <> ThiefLair) then
  1400.       begin
  1401.          GotoXY(1,7);
  1402.          writeln('-----------------------------------------------');
  1403.          writeln('An eerie silver aura begins to fill the room.');
  1404.          writeln('Its source is unclear.');
  1405.          write('-----------------------------------------------');
  1406.          TimeForThief := TimeForThief -1;
  1407.       end
  1408.    else
  1409.    if Loc <> ThiefLair then
  1410.       TimeForThief := TimeForThief - 1;
  1411. end;
  1412.  
  1413. procedure PillWearsOff;
  1414. begin
  1415.    if PillWorking >0 then
  1416.       begin
  1417.          PillWorking := PillWorking - 1;
  1418.          if PillWorking = 0 then
  1419.             begin
  1420.                GotoXY(1,7);
  1421.                writeln(
  1422. '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
  1423.                writeln('You feel somehow less protected than you did a');
  1424.                writeln('moment ago.');
  1425.                write(
  1426. '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
  1427.             end;
  1428.       end;
  1429. end;
  1430.  
  1431. procedure Homunculus;
  1432. begin
  1433.    if (Room[SensoryStrip].Visited) and (TimeForThief <> 0)
  1434.    and (Growing = 0) and (Loc > SubArachnoid) then
  1435.       HomunculusTime := HomunculusTime - 1;
  1436.    if HomunculusStays > 0 then begin
  1437.       GotoXY(1,2);
  1438.       HomunculusStays := HomunculusStays - 1;
  1439.       if HomunculusStays > 0 then
  1440.          writeln('There is a Homunculus with you!')
  1441.       else begin
  1442.          GotoXY(1,8);
  1443.          writeln('Losing interest in you, the Homunculus wanders');
  1444.          writeln('away, scratching his small head with a very');
  1445.          write('large finger.');
  1446.          HomuncLeavesSensStrip;
  1447.          end;
  1448.    end else
  1449.    if (HomunculusTime = 0) then begin
  1450.       GotoXY(1,8);
  1451.       writeln('The Homunculus has returned.  He is grinning');
  1452.       writeln('widely, and seems very interested in what');
  1453.       write('you are doing.');
  1454.       HomunculusStays := 2 + Random(8);
  1455.       HomunculusTime := 30 + Random(30);
  1456.    end;
  1457. end;
  1458.  
  1459. procedure HomuncLeaves;
  1460. begin
  1461.    if HomunculusStays > 0 then begin
  1462.       HomunculusStays := 0;
  1463.       case Random(6) of
  1464.          0:begin
  1465.               writeln('Insulted by this action, the Homunculus sneers');
  1466.               writeln('at you and walks away!');
  1467.            end;
  1468.          1:begin
  1469.               writeln('The Homunculus shrieks with terror as you');
  1470.               writeln('attempt this, and runs away!');
  1471.            end;
  1472.          2:begin
  1473.               writeln('Before you can try it, the Homunculus scurries');
  1474.               writeln('out of reach, and disappears!');
  1475.            end;
  1476.          3:begin
  1477.               writeln('Only a fool tries that with a Homunculus!');
  1478.               writeln('Fortunately for you, the Homunculus chooses');
  1479.               writeln('this moment to wander off.');
  1480.            end;
  1481.          4:begin
  1482.               writeln('This amuses the Homunculus to no end!  His');
  1483.               writeln('laughter echoes loudly as he leaves you.');
  1484.            end;
  1485.          5:begin
  1486.               writeln('For some unknown reason, the Homunculus finds');
  1487.               writeln('this threatening, and heads for safety.');
  1488.            end
  1489.       end;
  1490.       HomuncLeavesSensStrip;
  1491.    end else
  1492.       writeln('The Homunculus is not here!');
  1493. end;
  1494.  
  1495. procedure GrowingBig;
  1496. begin
  1497.    if (Growing > 0) and (Verb <> ' QUI ') then
  1498.       begin
  1499.          GotoXY(1,7);
  1500.          Growing := Growing + 1;
  1501.          LoadLimit := LoadLimit + Growing;
  1502.          writeln('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
  1503.          case Growing of
  1504.             1..4:begin
  1505.                   writeln('Things are happening inside of you.  You are ');
  1506.                   writeln('feeling much stronger, and could carry more.');
  1507.                   write('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
  1508.                  end;
  1509.             5..8:begin
  1510.                   writeln('You are getting larger. Soon you will be too');
  1511.                   writeln('big to move, but your strength is incredible!');
  1512.                   write('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
  1513.                  end;
  1514.             9:begin
  1515.                  ClearFrame;
  1516. writeln('You can no longer move, as the growth hormone has taken effect.  You are');
  1517. writeln('crushing the surrounding tissue!');
  1518. delay(5000);
  1519. writeln;
  1520. writeln('You have now grown to fill the space within the skull, and find it quite');
  1521. writeln('difficult to breathe!');
  1522. delay(5000);
  1523. writeln;
  1524. writeln('Unable to breathe, you suffocate inside of your own skull!  Descartes arrives,');
  1525. writeln('too late to help, and simply shakes his head in despair.');
  1526. delay(5000);
  1527. CalculateScore;
  1528. writeln('As you die, Descartes informs you that your score is ',TotalScore,', and laments');
  1529. writeln('the fact that you would have learned more and scored higher if only you had');
  1530. writeln('lived.');
  1531. PressKey;
  1532. Verb := ' QUI ';
  1533.               end
  1534.          end;
  1535.       end;
  1536. end;
  1537.  
  1538. procedure ShowInventory;
  1539. begin
  1540.    Writeln;
  1541.    Writeln('You are carrying:');
  1542.    HaveSomething := False;
  1543.    for Object := DA to LastObject do
  1544.          if ItemsGotten[Object] then
  1545.             begin
  1546.                Writeln('        ',ObjectDescription[Object]);
  1547.                HaveSomething := True;
  1548.             end;
  1549.    if not HaveSomething then
  1550.       writeln('         NOTHING!');
  1551. end;
  1552.  
  1553. procedure SaveGame;
  1554. begin
  1555.    writeln;
  1556.    writeln('This will erase previously saved game!');
  1557.    write('Are you sure you want to do this? ');
  1558.    readln(Command);
  1559.    if pos(Command,'YES Yes yes')>0 then begin
  1560.       GameFile.Map := Room;
  1561.       GameFile.LocCurrent := Loc;
  1562.       GameFile.Carrying := ItemsGotten;
  1563.       GameFile.CurrentScore := ExtraScore;
  1564.       GameFile.GhostStained := GolgiStained;
  1565.       GameFile.BoxLocked := ChestLocked;
  1566.       GameFile.StuffStolen := ItemsStolen;
  1567.       GameFile.GolgiHere := ThiefHere;
  1568.       GameFile.ThiefTime := TimeForThief;
  1569.       GameFile.HomuncTime := HomunculusTime;
  1570.       GameFile.HomuncStays := HomunculusStays;
  1571.       GameFile.PillWork := PillWorking;
  1572.       GameFile.GrowingBig := Growing;
  1573.       GameFile.ObjectsCurrent := ObjectDescription;
  1574.       GameFile.EscapeCurrent := Escape;
  1575.       Assign(SaveFile,'SAVEGAME.DAT');
  1576.       Rewrite(SaveFile);
  1577.       Write(SaveFile,GameFile);
  1578.       Close(SaveFile);
  1579.       writeln('*** Game saved ***');
  1580.    end else
  1581.       writeln('*** Not saved ***');
  1582. end;
  1583.  
  1584. procedure RestoreGame;
  1585. begin
  1586.    writeln;
  1587.    writeln('This will destroy current game!');
  1588.    write('Are you sure you want to do this? ');
  1589.    readln(Command);
  1590.    if pos(Command,'YES Yes yes') > 0 then begin
  1591. {$I-} Assign(SaveFile,'SAVEGAME.DAT');
  1592.       Reset(SaveFile);
  1593.       if IOresult = 0 then begin
  1594. {$I+}    Read(SaveFile,GameFile);
  1595.          Close(SaveFile);
  1596.          Room := GameFile.Map;
  1597.          Loc := GameFile.LocCurrent;
  1598.          ItemsGotten := GameFile.Carrying;
  1599.          ExtraScore := GameFile.CurrentScore;
  1600.          GolgiStained := GameFile.GhostStained;
  1601.          ChestLocked := GameFile.BoxLocked;
  1602.          ItemsStolen := GameFile.StuffStolen;
  1603.          ThiefHere := GameFile.GolgiHere;
  1604.          TimeForThief := GameFile.ThiefTime;
  1605.          HomunculusTime := GameFile.HomuncTime;
  1606.          HomunculusStays := GameFile.HomuncStays;
  1607.          PillWorking := GameFile.PillWork;
  1608.          Growing := GameFile.GrowingBig;
  1609.          ObjectDescription := GameFile.ObjectsCurrent;
  1610.          Escape := GameFile.EscapeCurrent;
  1611.          writeln('*** GameRestored ***');
  1612.          ContentsShown := False;
  1613.          DescribeRoom;
  1614.       end else
  1615.          writeln('*** No Saved Game Available! ***');
  1616.    end else
  1617.       writeln('*** Not Restored ***');
  1618. end;
  1619.  
  1620. procedure PrintScore;
  1621. begin
  1622.    writeln;
  1623.    writeln('Score = ',TotalScore);
  1624. end;
  1625.  
  1626. procedure CalculateScore;
  1627. begin
  1628.    TotalScore := 0;
  1629.    RoomScore := 0;
  1630.    for Loc1 := LateralVentricle to Cerebellum do
  1631.       if Room[Loc1].Visited then RoomScore := RoomScore + 10;
  1632.    TotalScore := ExtraScore + RoomScore;
  1633.    for Object := DA to GABA do
  1634.       if ItemsGotten[Object] then
  1635.          TotalScore := TotalScore + 50;
  1636.    for Object := PurkinjeCell to PyramidalCell do
  1637.       if ItemsGotten[Object] then
  1638.          TotalScore := TotalScore + 50;
  1639.    for Object := Oligodendrocyte to GrowthHormone do
  1640.       if ItemsGotten[Object] then
  1641.          TotalScore := TotalScore + 50;
  1642. end;
  1643.  
  1644. procedure QuitProgram;
  1645. begin
  1646.    CalculateScore;
  1647.    GotoXY(1,3);
  1648.    writeln('Descartes appears, quite perturbed.');
  1649.    writeln('"Your score is ',TotalScore,'.');
  1650.    writeln('Are you sure you want to quit?"');
  1651.    GetCommand;
  1652.    if (Verb = ' YES ') or (Verb = ' Y ') then
  1653.       Verb := ' QUI '
  1654.    else clrscr;
  1655. end;
  1656.  
  1657. procedure OfferHelp;
  1658. begin
  1659.    GotoXY(1,3);
  1660.    case random(5) of
  1661.       0:writeln('You are beyond help!');
  1662.       1:writeln('You must be an optimist!');
  1663.       2:writeln('Solve this problem yourself!');
  1664.       3:writeln('I'+chr(39)+'m just a dumb computer.');
  1665.       4:writeln('Nice try! I wish I could help.')
  1666.    end;
  1667. end;
  1668.  
  1669. procedure Initialize;
  1670. begin
  1671.    for Object := Nothing to LastObject do
  1672.       ItemsGotten[Object] := False;
  1673.    ItemsGotten[Pill] := True;
  1674.    GolgiStained := False;
  1675.    ChestLocked := True;
  1676.    TimeForThief := 10 + random(30);
  1677.    HomunculusTime := 100;
  1678.    HomunculusStays := 0;
  1679.    RoomScore := 0;
  1680.    ExtraScore := 0;
  1681.    TotalScore := 0;
  1682.    PillWorking := 10;
  1683.    Growing := 0;
  1684.    ItemsStolen := False;
  1685.    ThiefHere := False;
  1686.    ContentsShown := False;
  1687.    WrongAnswer := False;
  1688.    Verb := ' ';
  1689. end;
  1690.  
  1691. begin
  1692.    TextColor(Yellow);
  1693.    NormVideo;
  1694.    MemoryExam;
  1695.    TitlePage;
  1696.    TitleEnd;
  1697.    clrscr;
  1698.    Initialize;
  1699.    Frame;
  1700.    if inkey = 'I' then
  1701.       begin
  1702.          Introduction;
  1703.          BloodToBrain;
  1704.       end;
  1705.    InFrame;
  1706.    Loc := LateralVentricle;
  1707.    DescribeRoom;
  1708.    while Verb <> ' QUI ' do begin
  1709.       Homunculus;
  1710.       Thief;
  1711.       PillWearsOff;
  1712.       CalculateLoad;
  1713.       GetCommand;
  1714.       Interpret;
  1715.       SaveCursor;
  1716.       case Cmd of
  1717.          Move: MovePlayer;
  1718.          Get : GetItem;
  1719.          Put : PutItem;
  1720.          Manip: ManipulateItem;
  1721.          Inventory : ShowInventory;
  1722.          Look: DescribeRoom;
  1723.          ReportScore : begin
  1724.                          CalculateScore;
  1725.                          PrintScore;
  1726.                        end;
  1727.          Save: SaveGame;
  1728.          Restore: RestoreGame;
  1729.          HomuncPestered: HomuncLeaves;
  1730.          Help: OfferHelp;
  1731.          Quit: QuitProgram
  1732.       end;
  1733.       if Verb <> ' QUI ' then
  1734.          begin
  1735.             RestoreCursorTwo;
  1736.             GrowingBig;
  1737.          end;
  1738.    end;
  1739.    ClearFrame;
  1740.    WakeUp;
  1741.    TitlePage;
  1742.    writeln;
  1743.    writeln;
  1744.    TextColor(Yellow + 16);
  1745. write('               Press Alt, Ctrl, & Del simultaneously to play again.');
  1746.    TextColor(Yellow);
  1747. end.
  1748.  
  1749.