home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / tttsrc / form2.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  19.4 KB  |  645 lines

  1. VERSION 2.00
  2. Begin Form Form2 
  3.    BackColor       =   &H00FFFFFF&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Playing Field"
  6.    ClientHeight    =   1905
  7.    ClientLeft      =   465
  8.    ClientTop       =   3945
  9.    ClientWidth     =   3015
  10.    Height          =   2310
  11.    Icon            =   FORM2.FRX:0000
  12.    Left            =   405
  13.    LinkTopic       =   "Form2"
  14.    MaxButton       =   0   'False
  15.    ScaleHeight     =   1905
  16.    ScaleWidth      =   3015
  17.    Top             =   3600
  18.    Width           =   3135
  19.    Begin CommandButton Command11 
  20.       Caption         =   "Quit"
  21.       Height          =   375
  22.       Left            =   2160
  23.       TabIndex        =   16
  24.       Top             =   1080
  25.       Width           =   735
  26.    End
  27.    Begin CommandButton Command10 
  28.       Caption         =   "About"
  29.       Height          =   375
  30.       Left            =   2160
  31.       TabIndex        =   12
  32.       Top             =   360
  33.       Width           =   735
  34.    End
  35.    Begin CommandButton Command9 
  36.       BackColor       =   &H0000FF00&
  37.       Caption         =   "?"
  38.       Height          =   375
  39.       Left            =   1320
  40.       TabIndex        =   8
  41.       Top             =   1320
  42.       Width           =   375
  43.    End
  44.    Begin CommandButton Command8 
  45.       Caption         =   "?"
  46.       Height          =   375
  47.       Left            =   720
  48.       TabIndex        =   7
  49.       Top             =   1320
  50.       Width           =   375
  51.    End
  52.    Begin CommandButton Command7 
  53.       Caption         =   "?"
  54.       Height          =   375
  55.       Left            =   120
  56.       TabIndex        =   6
  57.       Top             =   1320
  58.       Width           =   375
  59.    End
  60.    Begin CommandButton Command6 
  61.       Caption         =   "?"
  62.       Height          =   375
  63.       Left            =   1320
  64.       TabIndex        =   5
  65.       Top             =   720
  66.       Width           =   375
  67.    End
  68.    Begin CommandButton Command5 
  69.       Caption         =   "?"
  70.       Height          =   375
  71.       Left            =   720
  72.       TabIndex        =   4
  73.       Top             =   720
  74.       Width           =   375
  75.    End
  76.    Begin CommandButton Command4 
  77.       Caption         =   "?"
  78.       Height          =   375
  79.       Left            =   120
  80.       TabIndex        =   3
  81.       Top             =   720
  82.       Width           =   375
  83.    End
  84.    Begin CommandButton Command3 
  85.       Caption         =   "?"
  86.       Height          =   375
  87.       Left            =   1320
  88.       TabIndex        =   2
  89.       Top             =   120
  90.       Width           =   375
  91.    End
  92.    Begin CommandButton Command2 
  93.       Caption         =   "?"
  94.       Height          =   375
  95.       Left            =   720
  96.       TabIndex        =   1
  97.       Top             =   120
  98.       Width           =   375
  99.    End
  100.    Begin CommandButton Command1 
  101.       Caption         =   "?"
  102.       Height          =   375
  103.       Left            =   120
  104.       TabIndex        =   0
  105.       Top             =   120
  106.       Width           =   375
  107.    End
  108.    Begin TextBox Text1 
  109.       Height          =   285
  110.       Left            =   2520
  111.       LinkItem        =   "Send"
  112.       LinkTopic       =   "CRoom|Croom"
  113.       TabIndex        =   19
  114.       Text            =   "Text1"
  115.       Top             =   360
  116.       Width           =   180
  117.    End
  118.    Begin CommandButton Command12 
  119.       Caption         =   "Simulate Opponent"
  120.       Height          =   255
  121.       Left            =   2400
  122.       TabIndex        =   18
  123.       Top             =   1080
  124.       Width           =   255
  125.    End
  126.    Begin Line Line4 
  127.       BorderColor     =   &H00FF0000&
  128.       BorderWidth     =   3
  129.       X1              =   1200
  130.       X2              =   1200
  131.       Y1              =   120
  132.       Y2              =   1800
  133.    End
  134.    Begin Line Line3 
  135.       BorderColor     =   &H00FF0000&
  136.       BorderWidth     =   3
  137.       X1              =   600
  138.       X2              =   600
  139.       Y1              =   120
  140.       Y2              =   1800
  141.    End
  142.    Begin Line Line2 
  143.       BorderColor     =   &H00FF0000&
  144.       BorderWidth     =   3
  145.       X1              =   1800
  146.       X2              =   0
  147.       Y1              =   1200
  148.       Y2              =   1200
  149.    End
  150.    Begin Line Line1 
  151.       BorderColor     =   &H00FF0000&
  152.       BorderWidth     =   3
  153.       X1              =   0
  154.       X2              =   1800
  155.       Y1              =   600
  156.       Y2              =   600
  157.    End
  158.    Begin Label Label7 
  159.       Caption         =   "Label7"
  160.       Height          =   135
  161.       Left            =   2520
  162.       LinkItem        =   "Croom"
  163.       LinkTopic       =   "Croom|Croom"
  164.       TabIndex        =   17
  165.       Top             =   360
  166.       Width           =   135
  167.    End
  168.    Begin Label Label6 
  169.       Caption         =   "0"
  170.       Height          =   255
  171.       Left            =   2400
  172.       TabIndex        =   15
  173.       Top             =   360
  174.       Width           =   135
  175.    End
  176.    Begin Label Label5 
  177.       Caption         =   "0"
  178.       Height          =   255
  179.       Left            =   2280
  180.       TabIndex        =   14
  181.       Top             =   360
  182.       Width           =   135
  183.    End
  184.    Begin Label Label4 
  185.       Caption         =   "0"
  186.       Height          =   255
  187.       Left            =   2400
  188.       TabIndex        =   13
  189.       Top             =   360
  190.       Width           =   135
  191.    End
  192.    Begin Label Label3 
  193.       Caption         =   "Tie"
  194.       Height          =   255
  195.       Left            =   2640
  196.       TabIndex        =   11
  197.       Top             =   360
  198.       Width           =   135
  199.    End
  200.    Begin Label Label2 
  201.       Caption         =   "Loss"
  202.       Height          =   255
  203.       Left            =   2520
  204.       TabIndex        =   10
  205.       Top             =   360
  206.       Width           =   135
  207.    End
  208.    Begin Label Label1 
  209.       Caption         =   "Win"
  210.       Height          =   255
  211.       Left            =   2280
  212.       TabIndex        =   9
  213.       Top             =   360
  214.       Width           =   135
  215.    End
  216. Sub Command1_Click ()
  217.     C1 = 1
  218.     Command1.Enabled = False
  219.     Command1.FontSize = 12
  220.     Command1.Caption = Marker
  221.     setmodes
  222.    Text1 = "{d " + "TTT" + "," + opponent + "," + "1"
  223.    Text1.LinkMode = 2    '  This takes the text in the
  224.    Text1.LinkPoke        '  edit control and sends it via
  225.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  226.    Text1 = ""
  227. End Sub
  228. Sub Command10_Click ()
  229.     'msg = "Copyright 1994, Virtual Systems V 0.1b"
  230.     'MsgBox msg
  231.     AboutTTT.Show
  232. End Sub
  233. Sub Command11_Click ()
  234.     End
  235. End Sub
  236. Sub Command12_Click ()
  237.    Text1 = "{d " + Text1 + "," + yourself + "," + Chr$(48 + (Int(Rnd(1) * 9)))
  238.    Text1.LinkMode = 2    '  This takes the text in the
  239.    Text1.LinkPoke        '  edit control and sends it via
  240.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  241.    Text1 = ""
  242. End Sub
  243. Sub Command2_Click ()
  244.    C2 = 1
  245.     Command2.Enabled = False
  246.     Command2.FontSize = 12
  247.     Command2.Caption = Marker
  248.     setmodes
  249.    Text1 = "{d " + "TTT" + "," + opponent + "," + "2"
  250.    Text1.LinkMode = 2    '  This takes the text in the
  251.    Text1.LinkPoke        '  edit control and sends it via
  252.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  253.    Text1 = ""
  254.  '   If Whowon() = 1 Then
  255.  '       msg = "You Win!!"
  256.  '       MsgBox msg
  257.  '   Else
  258.  '       If Whowon() = 2 Then
  259.  '           msg = "You Lose."
  260.  '           MsgBox msg
  261.  '       Else
  262.  '           If Whowon() = 3 Then
  263.  '               msg = "It's a tie."
  264.  ''               MsgBox msg
  265.   '          End If
  266.   '      End If
  267.   '  End If
  268. End Sub
  269. Sub Command3_Click ()
  270.         C3 = 1
  271.     Command3.Enabled = False
  272.     Command3.FontSize = 12
  273.     Command3.Caption = Marker
  274.     setmodes
  275.    Text1 = "{d " + "TTT" + "," + opponent + "," + "3"
  276.    Text1.LinkMode = 2    '  This takes the text in the
  277.    Text1.LinkPoke        '  edit control and sends it via
  278.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  279.    Text1 = ""
  280. End Sub
  281. Sub Command4_Click ()
  282.         C4 = 1
  283.     Command4.Enabled = False
  284.     Command4.FontSize = 12
  285.     Command4.Caption = Marker
  286.     setmodes
  287.    Text1 = "{d " + "TTT" + "," + opponent + "," + "4"
  288.    Text1.LinkMode = 2    '  This takes the text in the
  289.    Text1.LinkPoke        '  edit control and sends it via
  290.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  291.    Text1 = ""
  292. End Sub
  293. Sub Command5_Click ()
  294.         C5 = 1
  295.     Command5.Enabled = False
  296.     Command5.FontSize = 12
  297.     Command5.Caption = Marker
  298.     setmodes
  299.    Text1 = "{d " + "TTT" + "," + opponent + "," + "5"
  300.    Text1.LinkMode = 2    '  This takes the text in the
  301.    Text1.LinkPoke        '  edit control and sends it via
  302.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  303.    Text1 = ""
  304. End Sub
  305. Sub Command6_Click ()
  306.         C6 = 1
  307.     Command6.Enabled = False
  308.     Command6.FontSize = 12
  309.     Command6.Caption = Marker
  310.     setmodes
  311.    Text1 = "{d " + "TTT" + "," + opponent + "," + "6"
  312.    Text1.LinkMode = 2    '  This takes the text in the
  313.    Text1.LinkPoke        '  edit control and sends it via
  314.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  315.    Text1 = ""
  316. End Sub
  317. Sub Command7_Click ()
  318.         C7 = 1
  319.     Command7.Enabled = False
  320.     Command7.FontSize = 12
  321.     Command7.Caption = Marker
  322.     setmodes
  323.    Text1 = "{d " + "TTT" + "," + opponent + "," + "7"
  324.    Text1.LinkMode = 2    '  This takes the text in the
  325.    Text1.LinkPoke        '  edit control and sends it via
  326.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  327.    Text1 = ""
  328. End Sub
  329. Sub Command8_Click ()
  330.         C8 = 1
  331.     Command8.Enabled = False
  332.     Command8.FontSize = 12
  333.     Command8.Caption = Marker
  334.     setmodes
  335.    Text1 = "{d " + "TTT" + "," + opponent + "," + "8"
  336.    Text1.LinkMode = 2    '  This takes the text in the
  337.    Text1.LinkPoke        '  edit control and sends it via
  338.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  339.    Text1 = ""
  340. End Sub
  341. Sub Command9_Click ()
  342.         C9 = 1
  343.     Command9.Enabled = False
  344.     Command9.FontSize = 12
  345.     Command9.Caption = Marker
  346.     setmodes
  347.    Text1 = "{d " + "TTT" + "," + opponent + "," + "9"
  348.    Text1.LinkMode = 2    '  This takes the text in the
  349.    Text1.LinkPoke        '  edit control and sends it via
  350.    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  351.    Text1 = ""
  352. End Sub
  353. Sub Form_Load ()
  354.     label7.LinkMode = 1  'automatic??? Hopefully.
  355.     msg = yourself + ", your opponent will be: " + opponent
  356.     MsgBox msg
  357.     Unload form1
  358.     C1 = 0
  359.     C2 = 0
  360.     C3 = 0
  361.     C4 = 0
  362.     C5 = 0
  363.     C6 = 0
  364.     C7 = 0
  365.     C8 = 0
  366.     C9 = 0
  367.     If CurrentMove = "X" And Marker = "O" Then
  368.     Command1.Enabled = False
  369.     Command2.Enabled = False
  370.     Command3.Enabled = False
  371.     Command4.Enabled = False
  372.     Command5.Enabled = False
  373.     Command6.Enabled = False
  374.     Command7.Enabled = False
  375.     Command8.Enabled = False
  376.     Command9.Enabled = False
  377.     End If
  378.                    
  379.     'firstmove = "noone"
  380.     'If firstmove <> yourself Or firstmove <> opponent Then
  381.     '    gofirst = Int(Rnd(1) * 10) + 1
  382.     '    Text1 = "{d " + "TTG" + "," + opponent + "," + gofirst
  383.     '    Text1.LinkMode = 2    '  This takes the text in the
  384.     '    Text1.LinkPoke        '  edit control and sends it via
  385.     '    Text1.LinkMode = 0    '  DDE to the C-Room "Send Text"
  386.     '    temp = label7
  387.     '    For lp = 1 To 11
  388.     '        If Mid$(temp, lp, 1) = ":" Then
  389.     '        temp = Mid$(temp, lp + 2, (Len(temp) - (lp + 1)))
  390.     '        End If
  391.     '    Next
  392.     '    temp = Mid$(temp, 4, (Len(temp)))
  393.     '    game = Mid$(temp, 1, 3)
  394.     '    For lp = 1 To 9
  395.     '        If Mid$(temp, lp, 1) = "," Then
  396.     '        otherguy = Mid$(temp, 1, lp - 1)
  397.     '        rndnum = Mid$(temp, lp + 1, (Len(temp) - (lp - 1)))
  398.     '        End If
  399.     '    Next
  400.         
  401.         
  402.     '    If game = "TTG" Then
  403.     '        If rndnum < gofirst Then marker
  404.     'marker = "X"
  405.     'establish link here
  406.     ' i.e. send data
  407.     ' check responsese until you see the one you want.
  408.     ' start actual game
  409. End Sub
  410. Sub Label7_Change ()
  411.     ' more testing stuff
  412.     'Text1 = "Testing"
  413.     'more testing stuff
  414.     temp = label7
  415.     For lp = 1 To 11
  416.         If Mid$(temp, lp, 1) = ":" Then
  417.             temp = Mid$(temp, lp + 2, (Len(temp) - (lp + 1)))
  418.         End If
  419.     Next
  420.     temp = Mid$(temp, 4, (Len(temp)))
  421.     game = Mid$(temp, 1, 3)
  422.     For lp = 1 To 9
  423.         If Mid$(temp, lp, 1) = "," Then
  424.             OtherGuy = Mid$(temp, 1, lp - 1)
  425.             temp = Mid$(temp, lp + 1, (Len(temp) - (lp - 1)))
  426.             'Text1 = game + "-" + plname + "-" + temp
  427.         End If
  428.     Next
  429.     'MsgBox yourself + temp + otherguy
  430.     If OtherGuy = yourself Then
  431.         
  432.         If temp = 9 Then
  433.             Command9.Enabled = False
  434.             Command9.FontSize = 12
  435.             Command9.Caption = OMarker
  436.             C9 = 1
  437.         End If
  438.         If temp = 8 Then
  439.             Command8.Enabled = False
  440.             Command8.FontSize = 12
  441.             Command8.Caption = OMarker
  442.             C8 = 1
  443.         End If
  444.         
  445.         If temp = 7 Then
  446.             Command7.Enabled = False
  447.             Command7.FontSize = 12
  448.             Command7.Caption = OMarker
  449.             C7 = 1
  450.         End If
  451.         
  452.         If temp = 6 Then
  453.             Command6.Enabled = False
  454.             Command6.FontSize = 12
  455.             Command6.Caption = OMarker
  456.             C6 = 1
  457.         End If
  458.         
  459.         If temp = 5 Then
  460.             Command5.Enabled = False
  461.             Command5.FontSize = 12
  462.             Command5.Caption = OMarker
  463.             C5 = 1
  464.         End If
  465.         
  466.         If temp = 4 Then
  467.             Command4.Enabled = False
  468.             Command4.FontSize = 12
  469.             Command4.Caption = OMarker
  470.             C4 = 1
  471.         End If
  472.         
  473.         If temp = 3 Then
  474.             Command3.Enabled = False
  475.             Command3.FontSize = 12
  476.             Command3.Caption = OMarker
  477.             C3 = 1
  478.         End If
  479.         
  480.         If temp = 2 Then
  481.             Command2.Enabled = False
  482.             Command2.FontSize = 12
  483.             Command2.Caption = OMarker
  484.             C2 = 1
  485.         End If
  486.         
  487.         If temp = 1 Then
  488.             Command1.Enabled = False
  489.             Command1.FontSize = 12
  490.             Command1.Caption = OMarker
  491.             C1 = 1
  492.         End If
  493.         setmodes
  494.         OtherGuy = ""
  495.     End If
  496.             
  497. End Sub
  498. Sub setmodes ()
  499.     If CurrentMove = "X" Then
  500.         CurrentMove = "O"
  501.         Else
  502.         CurrentMove = "X"
  503.     End If
  504.     If Marker = "X" And CurrentMove = "X" Then
  505.         If C1 = 0 Then Command1.Enabled = True
  506.         If C2 = 0 Then Command2.Enabled = True
  507.         If C3 = 0 Then Command3.Enabled = True
  508.         If C4 = 0 Then Command4.Enabled = True
  509.         If C5 = 0 Then Command5.Enabled = True
  510.         If C6 = 0 Then Command6.Enabled = True
  511.         If C7 = 0 Then Command7.Enabled = True
  512.         If C8 = 0 Then Command8.Enabled = True
  513.         If C9 = 0 Then Command9.Enabled = True
  514.     End If
  515.     If Marker = "X" And CurrentMove = "O" Then
  516.         Command1.Enabled = False
  517.         Command2.Enabled = False
  518.         Command3.Enabled = False
  519.         Command4.Enabled = False
  520.         Command5.Enabled = False
  521.         Command6.Enabled = False
  522.         Command7.Enabled = False
  523.         Command8.Enabled = False
  524.         Command9.Enabled = False
  525.     End If
  526.     If Marker = "O" And CurrentMove = "X" Then
  527.         Command1.Enabled = False
  528.         Command2.Enabled = False
  529.         Command3.Enabled = False
  530.         Command4.Enabled = False
  531.         Command5.Enabled = False
  532.         Command6.Enabled = False
  533.         Command7.Enabled = False
  534.         Command8.Enabled = False
  535.         Command9.Enabled = False
  536.     End If
  537.     If Marker = "O" And CurrentMove = "O" Then
  538.         If C1 = 0 Then Command1.Enabled = True
  539.         If C2 = 0 Then Command2.Enabled = True
  540.         If C3 = 0 Then Command3.Enabled = True
  541.         If C4 = 0 Then Command4.Enabled = True
  542.         If C5 = 0 Then Command5.Enabled = True
  543.         If C6 = 0 Then Command6.Enabled = True
  544.         If C7 = 0 Then Command7.Enabled = True
  545.         If C8 = 0 Then Command8.Enabled = True
  546.         If C9 = 0 Then Command9.Enabled = True
  547.     End If
  548.     WhoWon
  549. End Sub
  550. Sub WhoWon ()
  551.     XWin = 0
  552.     OWin = 0
  553.     If Command1.Caption = "X" And Command2.Caption = "X" And Command3.Caption = "X" Then
  554.         XWin = 1
  555.         Else
  556.         If Command4.Caption = "X" And Command5.Caption = "X" And Command6.Caption = "X" Then
  557.         XWin = 1
  558.         Else
  559.         If Command7.Caption = "X" And Command8.Caption = "X" And Command9.Caption = "X" Then
  560.         XWin = 1
  561.         Else
  562.         If Command1.Caption = "X" And Command4.Caption = "X" And Command7.Caption = "X" Then
  563.         XWin = 1
  564.         Else
  565.         If Command2.Caption = "X" And Command5.Caption = "X" And Command8.Caption = "X" Then
  566.         XWin = 1
  567.         Else
  568.         If Command3.Caption = "X" And Command6.Caption = "X" And Command9.Caption = "X" Then
  569.         XWin = 1
  570.         Else
  571.         If Command1.Caption = "X" And Command5.Caption = "X" And Command9.Caption = "X" Then
  572.         XWin = 1
  573.         Else
  574.         If Command3.Caption = "X" And Command5.Caption = "X" And Command7.Caption = "X" Then
  575.         XWin = 1
  576.         End If
  577.         End If
  578.         End If
  579.         End If
  580.         End If
  581.         End If
  582.         End If
  583.         End If
  584.     If Command1.Caption = "O" And Command2.Caption = "O" And Command3.Caption = "O" Then
  585.         OWin = 1
  586.         Else
  587.         If Command4.Caption = "O" And Command5.Caption = "O" And Command6.Caption = "O" Then
  588.         OWin = 1
  589.         Else
  590.         If Command7.Caption = "O" And Command8.Caption = "O" And Command9.Caption = "O" Then
  591.         OWin = 1
  592.         Else
  593.         If Command1.Caption = "O" And Command4.Caption = "O" And Command7.Caption = "O" Then
  594.         OWin = 1
  595.         Else
  596.         If Command2.Caption = "O" And Command5.Caption = "O" And Command8.Caption = "O" Then
  597.         OWin = 1
  598.         Else
  599.         If Command3.Caption = "O" And Command6.Caption = "O" And Command9.Caption = "O" Then
  600.         OWin = 1
  601.         Else
  602.         If Command1.Caption = "O" And Command5.Caption = "O" And Command9.Caption = "O" Then
  603.         OWin = 1
  604.         Else
  605.         If Command3.Caption = "O" And Command5.Caption = "O" And Command7.Caption = "O" Then
  606.         OWin = 1
  607.         End If
  608.         End If
  609.         End If
  610.         End If
  611.         End If
  612.         End If
  613.         End If
  614.         End If
  615.         
  616.         If XWin = 1 And Marker = "X" Then
  617.             msg = "You Win!! :D"
  618.             MsgBox msg
  619.             End
  620.         Else
  621.         If XWin = 1 And Marker = "O" Then
  622.             msg = "You lose..  :("
  623.             MsgBox msg
  624.             End
  625.         Else
  626.         If OWin = 1 And Marker = "O" Then
  627.             msg = "You Win!!! :D"
  628.             MsgBox msg
  629.             End
  630.         Else
  631.         If OWin = 1 And Marker = "X" Then
  632.             msg = "You lose... :("
  633.             MsgBox msg
  634.             End
  635.         End If
  636.         End If
  637.         End If
  638.         End If
  639.         If XWin = 0 And OWin = 0 And C1 = 1 And C2 = 1 And C3 = 1 And C4 = 1 And C5 = 1 And C6 = 1 And C7 = 1 And C8 = 1 And C9 = 1 Then
  640.             msg = "It's a tie. "
  641.             MsgBox msg
  642.             End
  643.         End If
  644. End Sub
  645.