1 //All of the following files are sent out in infect.jar
    2 // CarrierLingo.java
    3 
    4 
    5 public class CarrierLingo
    6 /* Manages the text the site displays. Each function, more or less, is a separate
    7 sequence, each of which is separated by a request for user input.
    8 */
    9 
   10 {
   11 
   12     public void CarrierLingo()
   13     {
   14         carrierNum = (int)(Math.random() * 100000D) % 9500 + 500;
   15     }
   16 
   17     public void inUString(String s)
   18     {
   19         uInput = s;
   20         parseUInput();
   21     }
   22 
   23     private void parseUInput()
   24     {
   25         if(aState == 11)
   26         {
   27             uInput = uInput.trim();
   28             uName = uInput;
   29             aState = 12;
   30             timer = 0;
   31             return;
   32         }
   33         if(aState == 12)
   34         {
   35             if(intReply == -1)
   36             {
   37                 aState = 13;
   38                 return;
   39             }
   40             if(intReply == 1)
   41             {
   42                 goHtml = "intimate/sympathy.html";
   43                 aState = 21;
   44                 return;
   45             }
   46         }
   47         if(aState == 13)
   48         {
   49             if(intReply == -1)
   50             {
   51                 timer = 0;
   52                 aState = 14;
   53                 return;
   54             }
   55             if(intReply == 1)
   56             {
   57                 goHtml = "intimate/apathy.html";
   58                 aState = 21;
   59                 return;
   60             }
   61         }
   62         if(aState == 21)
   63         {
   64             timer = 0;
   65             if(intReply == -1)
   66             {
   67                 aState = 22;
   68                 return;
   69             }
   70             if(intReply == 1)
   71             {
   72                 goHtml = "immune/antigen.html";
   73                 aState = 31;
   74                 return;
   75             }
   76         }
   77         if(aState == 22)
   78         {
   79             timer = 0;
   80             if(intReply == -1)
   81             {
   82                 aState = 23;
   83                 return;
   84             }
   85             if(intReply == 1)
   86             {
   87                 goHtml = "immune/antibody.html";
   88                 aState = 31;
   89                 return;
   90             }
   91         }
   92         if(aState == 23)
   93         {
   94             timer = 0;
   95             if(intReply == -1)
   96             {
   97                 aState = 24;
   98                 return;
   99             }
  100             if(intReply == 1)
  101             {
  102                 goHtml = "immune/intrabody.html";
  103                 aState = 31;
  104                 return;
  105             }
  106         }
  107         if(aState == 24)
  108         {
  109             timer = 0;
  110             if(intReply == -1)
  111             {
  112                 goHtml = "immune/archetista.html";
  113                 aState = 31;
  114                 return;
  115             }
  116             if(intReply == 1)
  117             {
  118                 goHtml = "immune/idiotype.html";
  119                 aState = 31;
  120                 return;
  121             }
  122         }
  123         if(aState == 31)
  124         {
  125             timer = 0;
  126             if(intReply == 0)
  127             {
  128                 goHtml = "immerse/become.html";
  129                 aState = 51;
  130                 return;
  131             }
  132             if(intReply == 1)
  133             {
  134                 goHtml = "immerse/conjunct.html";
  135                 aState = 51;
  136                 return;
  137             }
  138             if(intReply == 2)
  139             {
  140                 goHtml = "immerse/transduce.html";
  141                 aState = 51;
  142                 return;
  143             }
  144             if(intReply == 3)
  145             {
  146                 goHtml = "immerse/imitate.html";
  147                 aState = 51;
  148                 return;
  149             }
  150             if(intReply == 4)
  151             {
  152                 goHtml = "immerse/resemble.html";
  153                 aState = 51;
  154                 return;
  155             }
  156         }
  157         if(aState == 32)
  158         {
  159             aState = 41;
  160             timer = 0;
  161             goHtml = "invalid/index.html";
  162             return;
  163         }
  164         if(aState == 41)
  165         {
  166             timer = 0;
  167             if(intReply == 0)
  168             {
  169                 goHtml = "immerse/become.html";
  170                 aState = 51;
  171                 return;
  172             }
  173             if(intReply == 1)
  174             {
  175                 goHtml = "immerse/conjunct.html";
  176                 aState = 51;
  177                 return;
  178             }
  179             if(intReply == 2)
  180             {
  181                 goHtml = "immerse/transduce.html";
  182                 aState = 51;
  183                 return;
  184             }
  185             if(intReply == 3)
  186             {
  187                 goHtml = "immerse/imitate.html";
  188                 aState = 51;
  189                 return;
  190             }
  191             if(intReply == 4)
  192             {
  193                 goHtml = "immerse/resemble.html";
  194                 aState = 51;
  195                 return;
  196             }
  197         }
  198         if(aState == 42)
  199         {
  200             timer = 0;
  201             if(intReply == -1)
  202             {
  203                 goHtml = "intimate/apathy.html";
  204                 timer = 0;
  205                 aState = 21;
  206                 return;
  207             }
  208             if(intReply == 1)
  209             {
  210                 goHtml = "intimate/sympathy.html";
  211                 aState = 21;
  212                 timer = 0;
  213                 return;
  214             }
  215         }
  216         if(aState == 51)
  217         {
  218             timer = 0;
  219             if(intReply == 1)
  220             {
  221                 goHtml = "inform/index.html";
  222                 aState = 61;
  223                 return;
  224             }
  225             if(intReply == -1)
  226             {
  227                 goHtml = "drift.html";
  228                 aState = 71;
  229                 return;
  230             }
  231         }
  232         if(aState == 61)
  233         {
  234             timer = 0;
  235             aState = 71;
  236             setCIComponent = 0;
  237             return;
  238         }
  239         if(aState == 71)
  240         {
  241             timer = 0;
  242             if(intReply == 1)
  243             {
  244                 goHtml = "*restart";
  245                 setCIComponent = 0;
  246                 aState = 11;
  247                 return;
  248             }
  249             if(intReply == -1)
  250             {
  251                 goHtml = "credit.html";
  252                 aState = 100;
  253                 return;
  254             }
  255         }
  256     }
  257 
  258     public void doProcess()
  259     {
  260         timer++;
  261         if(aState == 11)
  262         {
  263             login();
  264             return;
  265         }
  266         if(aState == 12)
  267         {
  268             meltWithMe();
  269             return;
  270         }
  271         if(aState == 13)
  272         {
  273             separateIdentity();
  274             return;
  275         }
  276         if(aState == 14)
  277         {
  278             sheRevealsMore();
  279             return;
  280         }
  281         if(aState == 21)
  282         {
  283             sheExtends();
  284             return;
  285         }
  286         if(aState == 22)
  287         {
  288             herArtifice();
  289             return;
  290         }
  291         if(aState == 23)
  292         {
  293             herContagion();
  294             return;
  295         }
  296         if(aState == 24)
  297         {
  298             herMission();
  299             return;
  300         }
  301         if(aState == 31)
  302         {
  303             fluidIntelligence();
  304             return;
  305         }
  306         if(aState == 41)
  307         {
  308             intimateSequences();
  309             return;
  310         }
  311         if(aState == 42)
  312         {
  313             reachesAgain();
  314             return;
  315         }
  316         if(aState == 51)
  317         {
  318             leapsPromisciously();
  319             return;
  320         }
  321         if(aState == 61)
  322         {
  323             yourSpecies();
  324             return;
  325         }
  326         if(aState == 71)
  327         {
  328             drift();
  329             return;
  330         }
  331         if(aState == 100)
  332         {
  333             aOutput = " ";
  334             return;
  335         } else
  336         {
  337             return;
  338         }
  339     }
  340 
  341     public void login()
  342     {
  343         if(timer == 1)
  344         {
  345             CarrierSite.intelligent = true;
  346             goHtml = "intelligent/index.html";
  347             timer++;
  348         }
  349         if(timer < 50)
  350         {
  351             aOutput = "sHe is infectious agent";
  352             return;
  353         }
  354         if(timer < 90)
  355         {
  356             aOutput = "sHe recognises you";
  357             return;
  358         }
  359         if(timer == 90)
  360         {
  361             aOutput = "sHe needs to know your name";
  362             carrierNum = (int)(Math.random() * 100000D) % 12500 + 2000;
  363             setCIComponent = 1;
  364             return;
  365         }
  366         if(timer < 130)
  367         {
  368             aOutput = "sHe needs to know your name";
  369             return;
  370         }
  371         if(timer < 210)
  372         {
  373             aOutput = "please enter your name";
  374             return;
  375         } else
  376         {
  377             timer = 91;
  378             return;
  379         }
  380     }
  381 
  382     public void meltWithMe()
  383     {
  384         if(timer < 40)
  385         {
  386             aOutput = "sHe smiles slowly";
  387             return;
  388         }
  389         if(timer < 70)
  390         {
  391             aOutput = "hello " + uName;
  392             return;
  393         }
  394         if(timer < 100)
  395         {
  396             aOutput = "sHe reaches out with sticky hands";
  397             return;
  398         }
  399         if(timer == 100)
  400         {
  401             setCIComponent = 2;
  402             aOutput = "let me be your portal inside";
  403             return;
  404         }
  405         if(timer < 130)
  406         {
  407             aOutput = "let me be your portal inside";
  408             return;
  409         }
  410         if(timer < 160)
  411         {
  412             aOutput = "melt with me " + uName;
  413             return;
  414         } else
  415         {
  416             timer = 111;
  417             return;
  418         }
  419     }
  420 
  421     public void separateIdentity()
  422     {
  423         if(timer < 30)
  424         {
  425             aOutput = "sHe smiles";
  426             return;
  427         }
  428         if(timer < 60)
  429         {
  430             aOutput = "the boundaries of separate identity";
  431             return;
  432         }
  433         if(timer < 100)
  434         {
  435             aOutput = "collapsed long ago " + uName;
  436             return;
  437         }
  438         if(timer == 100)
  439         {
  440             setCIComponent = 2;
  441             aOutput = "come with me now";
  442             return;
  443         }
  444         if(timer < 160)
  445         {
  446             aOutput = "come with me now";
  447             return;
  448         } else
  449         {
  450             timer = 111;
  451             return;
  452         }
  453     }
  454 
  455     public void sheRevealsMore()
  456     {
  457         if(timer == 2)
  458             goHtml = "invalid/index.html";
  459         if(timer < 30)
  460         {
  461             aOutput = "sHe reveals more....";
  462             return;
  463         } else
  464         {
  465             aState = 41;
  466             timer = 0;
  467             return;
  468         }
  469     }
  470 
  471     public void sheExtends()
  472     {
  473         if(timer == 1)
  474             CarrierSite.intimate = true;
  475         if(timer < 100)
  476         {
  477             aOutput = " ";
  478             return;
  479         }
  480         if(timer < 140)
  481         {
  482             aOutput = "sHe extends " + uName;
  483             return;
  484         }
  485         if(timer < 170)
  486         {
  487             aOutput = "sHe smiles";
  488             return;
  489         }
  490         if(timer < 210)
  491         {
  492             aOutput = "sHe is intelligent fluid";
  493             return;
  494         }
  495         if(timer < 250)
  496         {
  497             aOutput = "she is oceanic embodiment";
  498             return;
  499         }
  500         if(timer < 280)
  501         {
  502             aOutput = "wet dark and slimey";
  503             return;
  504         }
  505         if(timer < 320)
  506         {
  507             aOutput = "swarming inside " + uName;
  508             return;
  509         }
  510         if(timer < 350)
  511         {
  512             aOutput = "intimately spliced";
  513             return;
  514         }
  515         if(timer < 380)
  516         {
  517             aOutput = "in biosymbiosis";
  518             return;
  519         }
  520         if(timer < 410)
  521         {
  522             aOutput = "carrier of eternal life";
  523             return;
  524         }
  525         if(timer == 410)
  526         {
  527             setCIComponent = 21;
  528             aOutput = "sHe makes your system";
  529             return;
  530         }
  531         if(timer < 450)
  532         {
  533             aOutput = "sHe makes your system";
  534             return;
  535         } else
  536         {
  537             timer = 411;
  538             return;
  539         }
  540     }
  541 
  542     public void herArtifice()
  543     {
  544         if(timer < 10)
  545         {
  546             aOutput = "her artifice is a subset of your";
  547             return;
  548         }
  549         if(timer == 10)
  550         {
  551             setCIComponent = 22;
  552             return;
  553         }
  554         if(timer == 60)
  555             timer = 21;
  556     }
  557 
  558     public void herContagion()
  559     {
  560         if(timer < 10)
  561         {
  562             aOutput = "her contagion is contained by your";
  563             return;
  564         }
  565         if(timer == 10)
  566         {
  567             setCIComponent = 23;
  568             return;
  569         }
  570         if(timer == 60)
  571             timer = 21;
  572     }
  573 
  574     public void herMission()
  575     {
  576         if(timer < 10)
  577         {
  578             aOutput = "her mission seeps into your";
  579             return;
  580         }
  581         if(timer == 10)
  582         {
  583             setCIComponent = 24;
  584             return;
  585         }
  586         if(timer == 60)
  587             timer = 21;
  588     }
  589 
  590     public void fluidIntelligence()
  591     {
  592         if(timer == 1)
  593             CarrierSite.immune = true;
  594         if(timer < 200)
  595         {
  596             if(timer < 70)
  597                 aOutput = " ";
  598             else
  599             if(timer < 100)
  600                 aOutput = "sHe smiles";
  601             else
  602             if(timer < 130)
  603                 aOutput = "sHe is fluid intelligence";
  604             else
  605             if(timer < 160)
  606                 aOutput = "larval consciousness";
  607             else
  608             if(timer < 198)
  609                 aOutput = "swarming the partitions of singularity";
  610         } else
  611         {
  612             if(!CarrierSite.invalid)
  613             {
  614                 setCIComponent = 2;
  615                 timer = 0;
  616                 aOutput = "sHe seeks company";
  617                 aState = 32;
  618                 return;
  619             }
  620             if(!CarrierSite.intimate)
  621             {
  622                 aOutput = "sHe seeks company";
  623                 if(timer == 200)
  624                     goHtml = "intimate/index.html";
  625                 if(timer == 250)
  626                 {
  627                     timer = 0;
  628                     aState = 21;
  629                     return;
  630                 }
  631             }
  632         }
  633         if(timer > 199)
  634             aOutput = "sHe makes " + uName + " feel?";
  635         if(timer == 201)
  636             setCIComponent = 31;
  637         if(timer > 250)
  638             timer = 210;
  639     }
  640 
  641     public void intimateSequences()
  642     {
  643         if(timer < 280)
  644         {
  645             if(timer == 1)
  646                 CarrierSite.invalid = true;
  647             if(timer < 50)
  648             {
  649                 aOutput = " ";
  650                 return;
  651             }
  652             if(timer < 100)
  653             {
  654                 aOutput = uName + ", you are carrier: " + carrierNum;
  655                 return;
  656             }
  657             if(timer < 130)
  658             {
  659                 aOutput = "your most intimate sequences";
  660                 return;
  661             }
  662             if(timer < 170)
  663             {
  664                 aOutput = "are subordinated to my needs";
  665                 return;
  666             }
  667             if(timer < 200)
  668             {
  669                 aOutput = "you are forever bound";
  670                 return;
  671             }
  672             if(timer < 235)
  673             {
  674                 aOutput = "in tactical alliance";
  675                 return;
  676             }
  677             if(timer < 280)
  678                 aOutput = "with the contagious others";
  679             return;
  680         }
  681         if(timer < 600)
  682         {
  683             if(timer < 300)
  684             {
  685                 aOutput = "nameless";
  686                 return;
  687             }
  688             if(timer < 320)
  689             {
  690                 aOutput = "faceless";
  691                 return;
  692             }
  693             if(timer < 350)
  694             {
  695                 aOutput = "genotypes";
  696                 return;
  697             }
  698             if(timer < 380)
  699             {
  700                 aOutput = "sHe smiles";
  701                 return;
  702             }
  703             if(timer < 410)
  704             {
  705                 aOutput = "we are nothing";
  706                 return;
  707             }
  708             if(timer < 450)
  709             {
  710                 aOutput = "we are one";
  711                 return;
  712             }
  713             if(timer < 480)
  714             {
  715                 aOutput = "your machine code";
  716                 return;
  717             }
  718             if(timer < 510)
  719             {
  720                 aOutput = "is identical to mine";
  721                 return;
  722             }
  723             if(timer < 540)
  724             {
  725                 aOutput = "together we cross species";
  726                 return;
  727             }
  728             if(timer < 600)
  729                 aOutput = "together we evolve " + uName;
  730             return;
  731         }
  732         if(timer > 599)
  733         {
  734             if(timer == 600)
  735             {
  736                 if(!CarrierSite.intimate)
  737                 {
  738                     aState = 42;
  739                     timer = 0;
  740                     return;
  741                 }
  742                 setCIComponent = 41;
  743             }
  744             aOutput = "sHe makes " + uName + " feel?";
  745         }
  746         if(timer > 640)
  747             timer = 602;
  748     }
  749 
  750     public void reachesAgain()
  751     {
  752         if(timer < 40)
  753         {
  754             aOutput = uName;
  755             return;
  756         }
  757         if(timer < 70)
  758         {
  759             aOutput = "sHe reaches out again";
  760             return;
  761         }
  762         if(timer < 100)
  763         {
  764             aOutput = "come with sHe now";
  765             return;
  766         }
  767         if(timer == 100)
  768         {
  769             setCIComponent = 2;
  770             aOutput = "come with sHe now";
  771             return;
  772         }
  773         if(timer < 120)
  774         {
  775             aOutput = "come with sHe now";
  776             return;
  777         } else
  778         {
  779             timer = 111;
  780             return;
  781         }
  782     }
  783 
  784     public void leapsPromisciously()
  785     {
  786         if(timer == 1)
  787             CarrierSite.immerse = true;
  788         if(timer < 70)
  789         {
  790             aOutput = " ";
  791             return;
  792         }
  793         if(timer < 100)
  794         {
  795             aOutput = "sHe smiles";
  796             return;
  797         }
  798         if(timer < 130)
  799         {
  800             aOutput = "sHe is poison";
  801             return;
  802         }
  803         if(timer < 150)
  804         {
  805             aOutput = "sHe leaps promisciously";
  806             return;
  807         }
  808         if(timer < 180)
  809         {
  810             aOutput = "crossdressed to evade recognition";
  811             return;
  812         }
  813         if(timer < 200)
  814         {
  815             aOutput = "slipping thru your defence matrix";
  816             return;
  817         }
  818         if(timer < 220)
  819         {
  820             aOutput = "whispering the language";
  821             return;
  822         }
  823         if(timer < 270)
  824         {
  825             aOutput = "of " + uName + "s body";
  826             return;
  827         }
  828         if(timer < 290)
  829         {
  830             aOutput = "cupping sticky hands";
  831             return;
  832         }
  833         if(timer < 320)
  834         {
  835             aOutput = "to feed from your blood";
  836             return;
  837         }
  838         if(timer < 350)
  839         {
  840             aOutput = "intoxicated with";
  841             return;
  842         }
  843         if(timer < 380)
  844         {
  845             aOutput = "viscous seduction";
  846             return;
  847         }
  848         if(timer < 410)
  849         {
  850             aOutput = "burrowing deep to your core";
  851             return;
  852         }
  853         if(timer < 440)
  854         {
  855             aOutput = "contagion == evolution";
  856             return;
  857         }
  858         if(timer < 460)
  859         {
  860             aOutput = "in return";
  861             return;
  862         }
  863         if(timer < 480)
  864         {
  865             aOutput = "sHe offers " + uName;
  866             return;
  867         }
  868         if(timer == 480)
  869         {
  870             setCIComponent = 51;
  871             return;
  872         }
  873         if(timer > 600)
  874             timer = 571;
  875     }
  876 
  877     public void yourSpecies()
  878     {
  879         if(timer < 100)
  880         {
  881             aOutput = " ";
  882             return;
  883         }
  884         if(timer < 130)
  885         {
  886             aOutput = "she winks at " + uName;
  887             return;
  888         }
  889         if(timer < 160)
  890         {
  891             aOutput = "sHe bridges your species";
  892             return;
  893         }
  894         if(timer < 190)
  895         {
  896             aOutput = "sHe conjugates logic";
  897             return;
  898         }
  899         if(timer < 210)
  900         {
  901             aOutput = "sHe multiplies across";
  902             return;
  903         }
  904         if(timer < 240)
  905         {
  906             aOutput = "your networks";
  907             return;
  908         }
  909         if(timer < 260)
  910         {
  911             aOutput = "mapping your sequences";
  912             return;
  913         }
  914         if(timer < 290)
  915         {
  916             aOutput = "following your links";
  917             return;
  918         }
  919         if(timer < 320)
  920         {
  921             aOutput = "seeking your response";
  922             return;
  923         }
  924         if(timer == 320)
  925         {
  926             aOutput = uName + " you may navigate the zones alone";
  927             return;
  928         }
  929         if(timer == 330)
  930         {
  931             setCIComponent = 62;
  932             return;
  933         }
  934         if(timer > 380)
  935             timer = 331;
  936     }
  937 
  938     public void drift()
  939     {
  940         if(timer == 2)
  941             goHtml = "drift.html";
  942         if(timer < 20)
  943         {
  944             aOutput = " ";
  945             return;
  946         }
  947         if(timer < 50)
  948         {
  949             aOutput = "sHe lets " + uName + " think";
  950             return;
  951         }
  952         if(timer < 90)
  953         {
  954             aOutput = "there is choice";
  955             return;
  956         }
  957         if(timer < 120)
  958         {
  959             aOutput = "choose to drift " + uName;
  960             return;
  961         }
  962         if(timer < 150)
  963         {
  964             aOutput = "drag and click the nodes";
  965             return;
  966         }
  967         if(timer < 180)
  968         {
  969             aOutput = "of the carrier zones";
  970             return;
  971         }
  972         if(timer < 240)
  973         {
  974             aOutput = "you may explore alone now";
  975             return;
  976         }
  977         if(timer == 280)
  978             goHtml = "*restart";
  979     }
  980 
  981     public boolean testStringArrInstance(String as[])
  982     {
  983         for(int i = as.length - 1; i > -1; i--)
  984             if(as[i].equals(uInput))
  985                 return true;
  986 
  987         return false;
  988     }
  989 
  990     public boolean dParseInt()
  991     {
  992         return true;
  993     }
  994 
  995     public int dRand(int i)
  996     {
  997         return (int)(Math.random() * 1111D) % i;
  998     }
  999 
 1000     public CarrierLingo()
 1001     {
 1002         goHtml = new String(" ");
 1003         aState = 11;
 1004         cSite = new CarrierSite();
 1005         aOutput = new String();
 1006         newText = false;
 1007         uInput = new String();
 1008         uName = new String();
 1009     }
 1010 
 1011     public String goHtml;
 1012     public int timer;
 1013     public int aState;
 1014     public CarrierSite cSite;
 1015     public int setCIComponent;
 1016     public String aOutput;
 1017     public boolean newText;
 1018     public String uInput;
 1019     public int intReply;
 1020     public String uName;
 1021     public int carrierNum;
 1022 }
 1023 
 1024 // Source File Name:   CarrierSite.java
 1025 
 1026 
 1027 public class CarrierSite
 1028 /* Manages where the vistor has been.
 1029 */
 1030 {
 1031 
 1032     public static void init()
 1033     {
 1034         uName = new String();
 1035         intelligent = false;
 1036         intimate = false;
 1037         immune = false;
 1038         invalid = false;
 1039         immerse = false;
 1040         inform = false;
 1041     }
 1042 
 1043     public CarrierSite()
 1044     {
 1045     }
 1046 
 1047     public static String uName;
 1048     public static boolean intelligent;
 1049     public static boolean intimate;
 1050     public static boolean immune;
 1051     public static boolean invalid;
 1052     public static boolean immerse;
 1053     public static boolean inform;
 1054 }
 1055 
 1056 // Source File Name:   InfectiousAgent.java
 1057 
 1058 import java.applet.*;
 1059 import java.awt.*;
 1060 import java.net.MalformedURLException;
 1061 import java.net.URL;
 1062 import java.util.StringTokenizer;
 1063 
 1064 public class InfectiousAgent extends Applet
 1065     implements Runnable
 1066 {
 1067 
 1068     public void init()
 1069     {
 1070         appletDim = size();
 1071         resize(appletDim.width, appletDim.height);
 1072         setBackground(Color.black);
 1073         image = createImage(appletDim.width, 22);
 1074         offscreen = image.getGraphics();
 1075         setLayout(new FlowLayout(1, 8, 22));
 1076         myPaintFont = new Font("Dialogue", 0, 13);
 1077         fm = getFontMetrics(myPaintFont);
 1078         offscreen.setFont(myPaintFont);
 1079         cIPanel = new interfacePanel();
 1080         cIPanel.setBackground(Color.black);
 1081         cIPanel.setForeground(Color.red);
 1082         cIPanel.cbyl.setFont(myPaintFont);
 1083         cIPanel.cbY.setBackground(Color.black);
 1084         cIPanel.cbN.setForeground(Color.red);
 1085         cIPanel.blanker.setBackground(Color.black);
 1086         cIPanel.blanker.setForeground(Color.red);
 1087         cIPanel.cbnl.setFont(myPaintFont);
 1088         cIPanel.setInterface(0);
 1089         add(cIPanel);
 1090         CarrierSite.init();
 1091         cLingo.aState = 11;
 1092         uEvent = getAudioClip(getDocumentBase(), "uEvent.au");
 1093     }
 1094 
 1095     public void start()
 1096     {
 1097         if(iAgentThread == null)
 1098         {
 1099             animation = true;
 1100             iAgentThread = new Thread(this);
 1101             iAgentThread.start();
 1102             iAgentThread.setPriority(4);
 1103         }
 1104     }
 1105 
 1106     public void run()
 1107     {
 1108         while(animation)
 1109         {
 1110             try
 1111             {
 1112                 if(cIPanel.hasEvent)
 1113                 {
 1114                     (new PlaySound(uEvent)).start();
 1115                     respondToInput();
 1116                     cIPanel.hasEvent = false;
 1117                     cLingo.timer = 0;
 1118                 }
 1119                 if(cLingo.goHtml.equals("*restart"))
 1120                     try
 1121                     {
 1122                         String s = getCodeBase().toString() + "indynav.html";
 1123                         String s1 = getCodeBase().toString() + "indyleft.html";
 1124                         cIPanel.removeAll();
 1125                         cIPanel.validate();
 1126                         URL url = new URL(s);
 1127                         getAppletContext().showDocument(url, "_nav");
 1128                         URL url1 = new URL(s1);
 1129                         getAppletContext().showDocument(url1, "_left");
 1130                         cLingo.goHtml = " ";
 1131                     }
 1132                     catch(MalformedURLException _ex) { }
 1133                 else
 1134                 if(!cLingo.goHtml.equals(" "))
 1135                 {
 1136                     gotoURL(cLingo.goHtml);
 1137                     cLingo.goHtml = " ";
 1138                 }
 1139                 if(cLingo.setCIComponent > 0)
 1140                 {
 1141                     cIPanel.setInterface(cLingo.setCIComponent);
 1142                     cLingo.setCIComponent = 0;
 1143                 }
 1144                 cLingo.doProcess();
 1145                 myPaint();
 1146                 Thread.sleep(0L);
 1147             }
 1148             catch(InterruptedException _ex) { }
 1149             repaint();
 1150         }
 1151         iAgentThread = null;
 1152     }
 1153 
 1154     public void stop()
 1155     {
 1156         animation = false;
 1157     }
 1158 
 1159     public void paint(Graphics g)
 1160     {
 1161         g.drawImage(image, 0, 0, this);
 1162     }
 1163 
 1164     public void update(Graphics g)
 1165     {
 1166         paint(g);
 1167     }
 1168 
 1169     public void myPaint()
 1170     {
 1171         if(!aOutput.equals(cLingo.aOutput))
 1172         {
 1173             aOutput = cLingo.aOutput;
 1174             aOutput.equals(" ");
 1175             offscreen.setColor(Color.black);
 1176             offscreen.fillRect(0, 0, appletDim.width, 22);
 1177             int i = fm.stringWidth(aOutput);
 1178             offscreen.setColor(Color.red);
 1179             offscreen.drawString(aOutput, (appletDim.width - i) / 2, 18);
 1180             repaint();
 1181         }
 1182     }
 1183 
 1184     public int dRand(int i)
 1185     {
 1186         return (int)(Math.random() * 1111D) % i;
 1187     }
 1188 
 1189     private void respondToInput()
 1190     {
 1191         if(cIPanel.cIComponent == 1)
 1192         {
 1193             String s = cIPanel.inText;
 1194             cIPanel.userField.setText("");
 1195             s.trim();
 1196             StringTokenizer stringtokenizer = new StringTokenizer(s, " ");
 1197             if(stringtokenizer.hasMoreTokens())
 1198                 s = stringtokenizer.nextToken();
 1199             else
 1200                 return;
 1201             while(stringtokenizer.hasMoreTokens())
 1202                 s += " " + stringtokenizer.nextToken();
 1203             if(s.length() == 0)
 1204             {
 1205                 return;
 1206             } else
 1207             {
 1208                 cIPanel.setInterface(0);
 1209                 cLingo.inUString(s);
 1210                 myPaint();
 1211                 return;
 1212             }
 1213         }
 1214         if(cIPanel.cIComponent == 2)
 1215         {
 1216             cLingo.intReply = cIPanel.cbState;
 1217             cLingo.inUString(" ");
 1218             cIPanel.setInterface(0);
 1219         }
 1220         if(cIPanel.cIComponent == 3)
 1221         {
 1222             cLingo.intReply = cIPanel.chooseV;
 1223             cLingo.inUString(" ");
 1224             cIPanel.setInterface(0);
 1225         }
 1226         if(cIPanel.cIComponent == 31)
 1227         {
 1228             cLingo.intReply = cIPanel.chooseV;
 1229             cLingo.inUString(" ");
 1230             cIPanel.setInterface(0);
 1231         }
 1232         if(cIPanel.cIComponent == 41)
 1233         {
 1234             cLingo.intReply = cIPanel.chooseV;
 1235             cLingo.inUString(" ");
 1236             cIPanel.setInterface(0);
 1237         }
 1238         if(cIPanel.cIComponent == 42)
 1239         {
 1240             cLingo.intReply = cIPanel.cbState;
 1241             cLingo.inUString(" ");
 1242             cIPanel.setInterface(0);
 1243         }
 1244         if(cIPanel.cIComponent == 51)
 1245         {
 1246             cLingo.intReply = cIPanel.cbState;
 1247             cLingo.inUString(" ");
 1248             cIPanel.setInterface(0);
 1249         }
 1250         if(cIPanel.cIComponent == 61)
 1251         {
 1252             cLingo.intReply = cIPanel.chooseV;
 1253             cLingo.inUString(" ");
 1254             cIPanel.setInterface(0);
 1255         }
 1256         if(cIPanel.cIComponent == 62)
 1257         {
 1258             cIPanel.setInterface(0);
 1259             cLingo.aState = 71;
 1260         }
 1261     }
 1262 
 1263     public void gotoURL(String s)
 1264     {
 1265         String s1 = new String();
 1266         try
 1267         {
 1268             String s2 = getCodeBase().toString() + s;
 1269             URL url = new URL(s2);
 1270             getAppletContext().showDocument(url, "_screen");
 1271             return;
 1272         }
 1273         catch(MalformedURLException _ex)
 1274         {
 1275             return;
 1276         }
 1277     }
 1278 
 1279     public InfectiousAgent()
 1280     {
 1281         animation = false;
 1282         cLingo = new CarrierLingo();
 1283         aOutput = new String();
 1284     }
 1285 
 1286     Thread iAgentThread;
 1287     boolean animation;
 1288     Dimension appletDim;
 1289     Graphics offscreen;
 1290     Image image;
 1291     private Font myPaintFont;
 1292     private FontMetrics fm;
 1293     private interfacePanel cIPanel;
 1294     public CarrierLingo cLingo;
 1295     private int cIComponent;
 1296     public String aOutput;
 1297     private int cIint;
 1298     AudioClip aLoop;
 1299     AudioClip uEvent;
 1300 }
 1301 
 1302 // Source File Name:   interfacePanel.java
 1303 
 1304 import java.awt.*;
 1305 
 1306 public class interfacePanel extends Panel
 1307 {
 1308 
 1309     public Dimension minimumSize()
 1310     {
 1311         return new Dimension(360, 36);
 1312     }
 1313 
 1314     public Dimension preferredSize()
 1315     {
 1316         return new Dimension(360, 36);
 1317     }
 1318 
 1319     public void init()
 1320     {
 1321         setBackground(Color.black);
 1322         setForeground(Color.red);
 1323         setLayout(new FlowLayout(1, 8, 4));
 1324         setInterface(0);
 1325     }
 1326 
 1327     public void setInterface(int i)
 1328     {
 1329         if(i != cIComponent)
 1330         {
 1331             if(i == 0)
 1332                 cIComponent = 0;
 1333             removeAll();
 1334             validate();
 1335             setLayout(new FlowLayout(1, 8, 4));
 1336             if(i == 1)
 1337                 addUTextC();
 1338             else
 1339             if(i == 2)
 1340                 addYNC();
 1341             else
 1342             if(i == 3)
 1343                 addVRMLChoose();
 1344             else
 1345             if(i == 21)
 1346                 addNE();
 1347             else
 1348             if(i == 22)
 1349                 addNC();
 1350             else
 1351             if(i == 23)
 1352                 addTM();
 1353             else
 1354             if(i == 24)
 1355                 addMD();
 1356             else
 1357             if(i == 31)
 1358                 addVRMLChoose();
 1359             else
 1360             if(i == 41)
 1361                 addVRMLChoose();
 1362             else
 1363             if(i == 42)
 1364                 addYNC();
 1365             else
 1366             if(i == 51)
 1367                 addIO();
 1368             else
 1369             if(i == 62)
 1370                 addOKButton();
 1371             validate();
 1372             repaint();
 1373         }
 1374     }
 1375 
 1376     public boolean action(Event event, Object obj)
 1377     {
 1378         if(event.target instanceof TextField)
 1379         {
 1380             inText = userField.getText();
 1381             hasEvent = true;
 1382             return true;
 1383         }
 1384         if(event.target instanceof Button)
 1385             hasEvent = true;
 1386         if(event.target instanceof Checkbox)
 1387         {
 1388             hasEvent = true;
 1389             if(cbY.getState())
 1390             {
 1391                 cbState = 1;
 1392                 hasEvent = true;
 1393             } else
 1394             if(cbN.getState())
 1395             {
 1396                 cbState = -1;
 1397                 hasEvent = true;
 1398             } else
 1399             {
 1400                 cbState = 0;
 1401             }
 1402             return true;
 1403         }
 1404         if(event.target instanceof Choice)
 1405         {
 1406             if(choose.getSelectedItem() == " ")
 1407             {
 1408                 return true;
 1409             } else
 1410             {
 1411                 chooseV = choose.getSelectedIndex();
 1412                 hasEvent = true;
 1413                 return true;
 1414             }
 1415         } else
 1416         {
 1417             return false;
 1418         }
 1419     }
 1420 
 1421     public void addUTextC()
 1422     {
 1423         userField.setText("");
 1424         userField.setBackground(Color.white);
 1425         userField.setForeground(Color.black);
 1426         userField.setFont(new Font("Dialog", 1, 10));
 1427         userField.preferredSize(18);
 1428         add(userField);
 1429         cIComponent = 1;
 1430     }
 1431 
 1432     public void addOKButton()
 1433     {
 1434         add(okButton);
 1435         cIComponent = 62;
 1436     }
 1437 
 1438     public void removeUTextC()
 1439     {
 1440         remove(userField);
 1441         cIComponent = 0;
 1442     }
 1443 
 1444     public void addYNC()
 1445     {
 1446         validate();
 1447         cbyl.setText("yes ");
 1448         cbnl.setText("no ");
 1449         cbH.setState(true);
 1450         setForeground(Color.red);
 1451         add(cbY);
 1452         add(cbyl);
 1453         add(cbN);
 1454         add(cbnl);
 1455         cIComponent = 2;
 1456     }
 1457 
 1458     public void removeYNC()
 1459     {
 1460         removeAll();
 1461         cIComponent = 0;
 1462     }
 1463 
 1464     public void addNE()
 1465     {
 1466         cbyl.setText("nervous ");
 1467         cbnl.setText("excited ");
 1468         cbH.setState(true);
 1469         setForeground(Color.red);
 1470         add(cbY);
 1471         add(cbyl);
 1472         add(cbN);
 1473         add(cbnl);
 1474         cIComponent = 2;
 1475     }
 1476 
 1477     public void addNC()
 1478     {
 1479         cbyl.setText("nature ");
 1480         cbnl.setText("culture ");
 1481         cbH.setState(true);
 1482         setForeground(Color.red);
 1483         add(cbY);
 1484         add(cbyl);
 1485         add(cbN);
 1486         add(cbnl);
 1487         cIComponent = 2;
 1488     }
 1489 
 1490     public void addTM()
 1491     {
 1492         cbyl.setText("technics ");
 1493         cbnl.setText("methodology ");
 1494         cbH.setState(true);
 1495         setForeground(Color.red);
 1496         add(cbY);
 1497         add(cbyl);
 1498         add(cbN);
 1499         add(cbnl);
 1500         cIComponent = 2;
 1501     }
 1502 
 1503     public void addMD()
 1504     {
 1505         cbyl.setText("daily life ");
 1506         cbnl.setText("dreams ");
 1507         cbH.setState(true);
 1508         setForeground(Color.red);
 1509         add(cbY);
 1510         add(cbyl);
 1511         add(cbN);
 1512         add(cbnl);
 1513         cIComponent = 2;
 1514     }
 1515 
 1516     public void addIO()
 1517     {
 1518         cbyl.setText("information ");
 1519         cbnl.setText("observation ");
 1520         cbH.setState(true);
 1521         setForeground(Color.red);
 1522         add(cbY);
 1523         add(cbyl);
 1524         add(cbN);
 1525         add(cbnl);
 1526         cIComponent = 2;
 1527     }
 1528 
 1529     public void addVRMLChoose()
 1530     {
 1531         choose = new Choice();
 1532         setForeground(Color.black);
 1533         choose.addItem("pleasure");
 1534         choose.addItem("pain");
 1535         choose.addItem("warm");
 1536         choose.addItem("cold");
 1537         choose.addItem("pressure");
 1538         add(choose);
 1539         cIComponent = 3;
 1540     }
 1541 
 1542     public void removeChoose()
 1543     {
 1544         remove(choose);
 1545         cIComponent = 0;
 1546     }
 1547 
 1548     public void paint(Graphics g)
 1549     {
 1550         g.setColor(Color.black);
 1551         g.fillRect(0, 0, 360, 36);
 1552     }
 1553 
 1554     public interfacePanel()
 1555     {
 1556         textFocus = false;
 1557         hasEvent = false;
 1558         okButton = new Button("OK");
 1559         userField = new TextField(12);
 1560         inText = new String();
 1561         yn = new CheckboxGroup();
 1562         cbY = new Checkbox("", yn, false);
 1563         cbN = new Checkbox("", yn, false);
 1564         cbH = new Checkbox(" ", yn, false);
 1565         cbyl = new Label("yes ");
 1566         cbnl = new Label("no ");
 1567         blanker = new Label(" ");
 1568         choose = new Choice();
 1569     }
 1570 
 1571     public int cIComponent;
 1572     public boolean textFocus;
 1573     public boolean hasEvent;
 1574     private Button okButton;
 1575     public TextField userField;
 1576     public String inText;
 1577     public CheckboxGroup yn;
 1578     public Checkbox cbY;
 1579     public Checkbox cbN;
 1580     public Checkbox cbH;
 1581     public int cbState;
 1582     public Label cbyl;
 1583     public Label cbnl;
 1584     public Label blanker;
 1585     public Choice choose;
 1586     public int chooseV;
 1587 }
 1588 
 1589 // Source File Name:   PlaySound.java
 1590 
 1591 import java.applet.AudioClip;
 1592 
 1593 public class PlaySound extends Thread
 1594 {
 1595 
 1596     public PlaySound(AudioClip audioclip)
 1597     {
 1598         clip = audioclip;
 1599     }
 1600 
 1601     public void run()
 1602     {
 1603         clip.play();
 1604     }
 1605 
 1606     private AudioClip clip;
 1607 }