home *** CD-ROM | disk | FTP | other *** search
/ The Complete Encyclopedia of Games 3 / GAMES1000V3_d2.iso / kids / mysto432 / mysto432.fr_ / mysto432.fr
Text File  |  1997-07-20  |  15KB  |  456 lines

  1. VERSION 5.00
  2. Object = "{EF85CC23-AFDF-101D-85F5-6EBA1EE93AF4}#1.1#0"; "WAVE32.OCX"
  3. Begin VB.Form frmMysto432 
  4.    Appearance      =   0  'Flat
  5.    BackColor       =   &H00C0C0C0&
  6.    BorderStyle     =   3  'Fixed Dialog
  7.    Caption         =   "       DR. MYSTO THE MINDREADER - A STUDY IN SEMI-ARTIFICIAL INTELLIGENCE V4.32  (7-16-97)"
  8.    ClientHeight    =   6855
  9.    ClientLeft      =   1065
  10.    ClientTop       =   1350
  11.    ClientWidth     =   9555
  12.    BeginProperty Font 
  13.       Name            =   "MS Sans Serif"
  14.       Size            =   8.25
  15.       Charset         =   0
  16.       Weight          =   700
  17.       Underline       =   0   'False
  18.       Italic          =   0   'False
  19.       Strikethrough   =   0   'False
  20.    EndProperty
  21.    ForeColor       =   &H80000008&
  22.    Icon            =   "mysto432.frx":0000
  23.    LinkTopic       =   "Form1"
  24.    PaletteMode     =   1  'UseZOrder
  25.    ScaleHeight     =   6855
  26.    ScaleMode       =   0  'User
  27.    ScaleWidth      =   1006.319
  28.    Visible         =   0   'False
  29.    Begin WaveLib.Wave Wave1 
  30.       Left            =   8160
  31.       Top             =   480
  32.       _Version        =   65537
  33.       _ExtentX        =   847
  34.       _ExtentY        =   847
  35.       _StockProps     =   64
  36.       Exclusive       =   0   'False
  37.       Filename        =   ""
  38.       FileLength      =   -1
  39.       Loop            =   0   'False
  40.       PlayEnd         =   -1
  41.       PlayStart       =   -1
  42.    End
  43.    Begin VB.FileListBox FileBox 
  44.       Appearance      =   0  'Flat
  45.       ForeColor       =   &H000000FF&
  46.       Height          =   1005
  47.       Left            =   2280
  48.       Pattern         =   "*.brn"
  49.       TabIndex        =   8
  50.       Top             =   5880
  51.       Width           =   1335
  52.    End
  53.    Begin VB.CommandButton cmdPlay 
  54.       Appearance      =   0  'Flat
  55.       Caption         =   "&Play"
  56.       Enabled         =   0   'False
  57.       Height          =   855
  58.       Left            =   1080
  59.       TabIndex        =   7
  60.       Top             =   5880
  61.       Width           =   855
  62.    End
  63.    Begin VB.Timer Delay 
  64.       Left            =   8160
  65.       Top             =   3840
  66.    End
  67.    Begin VB.Timer Animation 
  68.       Interval        =   100
  69.       Left            =   8160
  70.       Top             =   3120
  71.    End
  72.    Begin VB.TextBox txtBox2 
  73.       Alignment       =   2  'Center
  74.       Appearance      =   0  'Flat
  75.       BackColor       =   &H00C0C0C0&
  76.       BorderStyle     =   0  'None
  77.       Height          =   855
  78.       Left            =   600
  79.       Locked          =   -1  'True
  80.       MultiLine       =   -1  'True
  81.       TabIndex        =   0
  82.       TabStop         =   0   'False
  83.       Text            =   "mysto432.frx":030A
  84.       Top             =   2040
  85.       Width           =   2295
  86.    End
  87.    Begin VB.PictureBox Pix2 
  88.       Appearance      =   0  'Flat
  89.       AutoSize        =   -1  'True
  90.       BackColor       =   &H80000005&
  91.       BorderStyle     =   0  'None
  92.       ForeColor       =   &H80000008&
  93.       Height          =   5625
  94.       Left            =   3323
  95.       Picture         =   "mysto432.frx":0355
  96.       ScaleHeight     =   5625
  97.       ScaleMode       =   0  'User
  98.       ScaleWidth      =   3846.154
  99.       TabIndex        =   6
  100.       Top             =   0
  101.       Visible         =   0   'False
  102.       Width           =   3750
  103.    End
  104.    Begin VB.TextBox txtBox1 
  105.       Alignment       =   2  'Center
  106.       Appearance      =   0  'Flat
  107.       BackColor       =   &H00FFFFFF&
  108.       BorderStyle     =   0  'None
  109.       ForeColor       =   &H000000C0&
  110.       Height          =   195
  111.       Left            =   2520
  112.       MultiLine       =   -1  'True
  113.       TabIndex        =   5
  114.       Text            =   "mysto432.frx":178BB
  115.       Top             =   6210
  116.       Width           =   4575
  117.    End
  118.    Begin VB.PictureBox Pix1 
  119.       Appearance      =   0  'Flat
  120.       AutoSize        =   -1  'True
  121.       BackColor       =   &H80000005&
  122.       BorderStyle     =   0  'None
  123.       ForeColor       =   &H80000008&
  124.       Height          =   5625
  125.       Left            =   3323
  126.       Picture         =   "mysto432.frx":178D6
  127.       ScaleHeight     =   5625
  128.       ScaleMode       =   0  'User
  129.       ScaleWidth      =   3846.154
  130.       TabIndex        =   4
  131.       Top             =   0
  132.       Width           =   3750
  133.    End
  134.    Begin VB.CommandButton cmdQuit 
  135.       Appearance      =   0  'Flat
  136.       Caption         =   "&Quit"
  137.       Height          =   855
  138.       Left            =   120
  139.       TabIndex        =   3
  140.       Top             =   5880
  141.       Width           =   855
  142.    End
  143.    Begin VB.CommandButton cmdNo 
  144.       Appearance      =   0  'Flat
  145.       Caption         =   "&No"
  146.       Enabled         =   0   'False
  147.       Height          =   855
  148.       Left            =   8520
  149.       TabIndex        =   2
  150.       Top             =   5880
  151.       Width           =   855
  152.    End
  153.    Begin VB.CommandButton cmdYes 
  154.       Appearance      =   0  'Flat
  155.       Caption         =   "&Yes"
  156.       Enabled         =   0   'False
  157.       Height          =   855
  158.       Left            =   7560
  159.       TabIndex        =   1
  160.       Top             =   5880
  161.       Width           =   855
  162.    End
  163.    Begin VB.Image Clock 
  164.       Appearance      =   0  'Flat
  165.       Height          =   1455
  166.       Left            =   7800
  167.       Picture         =   "mysto432.frx":2EE3C
  168.       Stretch         =   -1  'True
  169.       Top             =   1320
  170.       Width           =   1335
  171.    End
  172.    Begin VB.Line Line2 
  173.       X1              =   303.317
  174.       X2              =   328.594
  175.       Y1              =   2640
  176.       Y2              =   3240
  177.    End
  178.    Begin VB.Line Line1 
  179.       X1              =   278.041
  180.       X2              =   328.594
  181.       Y1              =   2880
  182.       Y2              =   3240
  183.    End
  184.    Begin VB.Shape Balloon 
  185.       Height          =   2055
  186.       Left            =   120
  187.       Shape           =   2  'Oval
  188.       Top             =   1200
  189.       Width           =   2895
  190.    End
  191. End
  192. Attribute VB_Name = "frmMysto432"
  193. Attribute VB_GlobalNameSpace = False
  194. Attribute VB_Creatable = False
  195. Attribute VB_PredeclaredId = True
  196. Attribute VB_Exposed = False
  197. Option Explicit
  198. 'Define Variables and Strings
  199. Dim Question(10000) As String
  200. Dim n, nn, Frame, Flag, KeyIn, Mouth, l, Clip, Voice As Integer
  201. Dim Answer, Fraz, NewInfo, Hold As String
  202. Dim NewQuestion, TASK, S1, S2, BrainName As String
  203.  
  204.  
  205. Private Sub ADJUST()
  206.  
  207.     'Add BINARY 11 to n & assign it to the word in Hold. Switch these two answers
  208.     If Answer = "Y" Then Question(n * 2 + 1) = Hold: Question(n * 2) = Question(n)
  209.     'Add BINARY 10 to n & assign it to the word in Hold. Switch these two answers
  210.     If Answer = "N" Then Question(n * 2) = Hold: Question(n * 2 + 1) = Question(n)
  211.     Question(n) = NewInfo                   'Switch data position
  212.     If nn < n * 2 + 1 Then nn = n * 2 + 1   'Switch data #
  213.                   'Save BRAIN
  214.     Mouth = 10                          'Move mouth
  215.     Open BrainName For Output As #1     'Open Sequential file.
  216.         Print #1, nn               'Tell how many Questions
  217.             For n = 1 To nn        'Count until done
  218.             If Question(n) <> "" Then Print #1, n, Question(n)  'If not blank, save it
  219.             Next                   'Do until there is no more
  220.     Close #1                       'Turn off BRAIN
  221.     Yn_Off                         'Turn the Yes/No buttons off
  222.     txtBox2 = "Thank you - I will add that WORD to my VOCABULARY"                   'Print message
  223.     Wave1.filename = "Thank.wav"
  224.     Wave1.Action = Voice
  225.     Mouth = 10                   'Move mouth
  226.     txtBox1.Enabled = False
  227.     txtBox1 = S2                 'Print messages
  228.     n = 0
  229. End Sub
  230.  
  231. Private Sub Animation_Timer()
  232.      
  233.      If Mouth > 0 Then              'Speak if more than 0
  234.          Mouth = Mouth - 1          'Deincriment mouth by 1
  235.          If Frame = 1 Then
  236.             Pix2.Visible = True
  237.             Pix1.Visible = False    'Shut mouth
  238.          End If
  239.          If Frame = (-1) Then
  240.             Pix1.Visible = True
  241.             Pix2.Visible = False    'Open mouth
  242.          End If
  243.             Frame = Frame * (-1)    'Toggle Frame value
  244.      End If
  245.      
  246. End Sub
  247.  
  248. Private Sub Clock_Click()
  249.  txtBox2 = "This is Version 4. 32 bit Revision 1"
  250. End Sub
  251.  
  252. Private Sub cmdNo_Click()
  253.      
  254.     Answer = "N"                          'The answer is no
  255.     If TASK = "GUESS" Then WRONGO         'Go to WRONGO
  256.     If TASK = "MAIN" Then n = n * 2: Main 'Add a BINARY 10 to n & ask next question.
  257.     If TASK = "ADJUST" Then ADJUST        'Go to ADJUST
  258.  
  259. End Sub
  260.  
  261. Private Sub cmdPlay_Click()
  262.  
  263.     Cls                             'Clear screen
  264.     Yn_On                           'Turn on Yes/No buttons
  265.     Question(0) = "Think of a WORD and I will try to guess it, ready?"       'First question is READY?
  266.     Open BrainName For Input As #1
  267.     Input #1, nn
  268.         For n = 1 To nn
  269.             Input #1, n, Question(n)
  270.         Next
  271.     Close #1: txtBox1 = ""
  272.     n = 0                           'Set question to 0
  273.     Main                            'Start game
  274.  
  275. End Sub
  276.  
  277. Private Sub cmdQuit_Click()
  278.     End
  279. End Sub
  280.  
  281. Private Sub cmdYes_Click()
  282.     
  283.     Answer = "Y"                        'The answer is yes
  284.     If TASK = "GUESS" Then RIGHTO       'Go to RIGHTO
  285.     If TASK = "MAIN" Then n = n * 2 + 1: Main 'Add a BINARY 11 to n & ask next question.
  286.     If TASK = "ADJUST" Then ADJUST      'Go to ADJUST
  287.  
  288. End Sub
  289.  
  290. Private Sub Delay_Timer()
  291.         
  292.         txtBox2 = "......" + Question(n) + "...... "
  293.         If Delay.Interval = 3000 Then
  294.            Delay.Interval = 500
  295.            Exit Sub
  296.         End If
  297.         Wave1.filename = "AMI.wav"
  298.         Wave1.Action = Voice
  299.         Delay.Interval = 0
  300.         Mouth = 6
  301.         If Voice = 4 Then txtBox2 = "Am I right?"
  302. End Sub
  303.  
  304. Private Sub FileBox_Click()
  305.  
  306.     BrainName = FileBox.filename
  307.     FileBox.Visible = False
  308.     cmdPlay_Click
  309.  
  310. End Sub
  311.  
  312. Private Sub Form_Activate()
  313.   
  314.  'Define Sentences
  315.     S1 = "Type a question that will help me tell "
  316.     S2 = "<-- Please select PLAY or QUIT"
  317.     Frame = 1: Voice = 1
  318.     Intro.Visible = False
  319.  
  320. End Sub
  321.  
  322. Private Sub Main()
  323.      
  324.     If Question(n) = "***" Then   'Question is out of range
  325.         Wave1.filename = "nocheat.wav"
  326.         Wave1.Action = Voice
  327.         txtBox2 = "Sorry - It has to be ANIMAL, VEGETABLE or MINERAL"
  328.         TASK = "PLAY"             'Set Task to PLAY
  329.         Mouth = 10                'Move mouth
  330.         Yn_Off                    'Turn off Yes/No buttons
  331.         txtBox1 = S2              'Print PLAY or QUIT
  332.         Exit Sub
  333.     End If
  334.     If Right$(Question(n), 1) <> "?" Then  'NOT a question
  335.         TASK = "GUESS"            'It is a GUESS
  336.         txtBox2 = "MMMM....I think your WORD is...."
  337.         Wave1.filename = "MMM.wav"
  338.         Wave1.Action = Voice
  339.         Delay.Interval = 3000     'Turn on Delay
  340.         Mouth = 24                'Move Mouth
  341.         Exit Sub
  342.     End If
  343.             l = Len(Question(n))
  344.             Clip = 0
  345.             If n = 0 Then Mouth = 50 Else Mouth = 8
  346.             If Voice = 1 Then
  347.             Fraz = Left$(Question(n), 5)
  348.             If Fraz = "IS IT" Then Fraz = "isit": Clip = 6
  349.             If Fraz = "IS HE" Then Fraz = "ishe": Clip = 6
  350.             If Fraz = "IS SH" Then Fraz = "issh": Clip = 6
  351.             If Fraz = "DOES " Then Fraz = "does": Clip = 7
  352.             On Error GoTo TRAP
  353.             Wave1.filename = Fraz + ".wav"
  354.             Wave1.Action = Voice
  355.         End If
  356.         txtBox2 = Right$(Question(n), l - Clip) 'Put question in Balloon
  357.         TASK = "MAIN"            'Set TASK to MAIN
  358.         Exit Sub
  359. TRAP:
  360.     Print "There no wave file for " + Fraz
  361.     Print "Please make a wave file for it."
  362.     Fraz = "Null"
  363. Resume
  364. End Sub
  365.  
  366. Private Sub NEWCLUE()
  367.  
  368.         'How can I tellthe new word from the old one?
  369.     Wave1.filename = "Typea.wav"
  370.     Wave1.Action = Voice
  371.     txtBox2 = S1 + NewInfo + " ...from... " + Question(n)
  372.     Hold = NewInfo      'Store new word in Hold temporarily
  373.     txtBox1 = ""        'Clear txtBox1
  374.     TASK = "VERIFY"     'Set TASK to VERIFY
  375.     
  376. End Sub
  377.  
  378. Private Sub Pix1_Click()
  379.     Voice = 4           'Voice off
  380. End Sub
  381.  
  382. Private Sub RIGHTO()
  383.  
  384.     Wave1.filename = "Righto.wav"
  385.     Wave1.Action = Voice
  386.     txtBox2 = "I AM RIGHT AGAIN!!!"   'Gloat for a while
  387.     txtBox1 = S2
  388.     Mouth = 12                        'Move mouth
  389.     Yn_Off                            'Turn Y/N buttons off
  390.     
  391. End Sub
  392.  
  393. Private Sub txtBox1_KeyPress(KeyIn As Integer)
  394.     
  395.     KeyIn = Asc(UCase(Chr(KeyIn)))    'Convert to uppercase
  396.     NewInfo = txtBox1.Text            'Get NweInfo
  397.     If KeyIn = 13 Then           'If key is carriage return
  398.         KeyIn = 0                'Erase it.
  399.         'Go to where ever TASK sends you
  400.         If TASK = "NEWCLUE" Then NEWCLUE: Exit Sub
  401.         If TASK = "VERIFY" Then VERIFY: Exit Sub
  402.     End If
  403.  
  404. End Sub
  405.  
  406. Private Sub VERIFY()
  407.     
  408.     Yn_On                           'Turn Yes/No buttons on
  409.     'If the question has no '?' on the end put it on.
  410.     If Right$(NewInfo, 1) <> "?" Then NewInfo = NewInfo + "?"
  411.              'See if question matches answer.
  412.     txtBox2 = "Does the question " + NewInfo + " -describe - " + Hold + " ?"
  413.     TASK = "ADJUST"                 'Set TASK to ADJUST
  414.     txtBox1.Enabled = False
  415.     Wave1.filename = "Well.wav"
  416.     Wave1.Action = Voice
  417.  
  418. End Sub
  419.  
  420. Private Sub WRONGO()
  421.  
  422.          'I screwed up. What's your word?
  423.     txtBox2 = "I know I am close - Please tell me YOUR word.": Mouth = 10
  424.     Wave1.filename = "close.wav"
  425.     Wave1.Action = Voice
  426.     Yn_Off                   'Turn off Yes/No buttons
  427.     txtBox1.Enabled = True       'Turn on txtBox1
  428.     txtBox1.SetFocus             'Open txtBox1 for input
  429.     TASK = "NEWCLUE"         'Set TASKfor NEWCLUE
  430.     
  431. End Sub
  432.  
  433. Private Sub Yn_Off()
  434.  
  435.     cmdYes.Enabled = False       'Turn off Yes/No
  436.     cmdNo.Enabled = False
  437.   
  438.     cmdQuit.Enabled = True       'Turn on Quit/Play buttons
  439.     cmdPlay.Enabled = True
  440.     txtBox1.Visible = True       'Show TxtBox1
  441.   
  442.  
  443. End Sub
  444.  
  445. Private Sub Yn_On()
  446.  
  447.     cmdYes.Enabled = True      'Turn Yes/No on & txtBox1 on
  448.     cmdNo.Enabled = True
  449.     txtBox1.Enabled = False    'Turn TxtBox1 off
  450.     cmdQuit.Enabled = False    'Turn Quit/Play buttons off
  451.     cmdPlay.Enabled = False
  452.     txtBox1.Visible = False     'Erase txtBox1
  453.     
  454. End Sub
  455.  
  456.