home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code2 / tab100 / tab.bas < prev    next >
BASIC Source File  |  1991-12-03  |  21KB  |  795 lines

  1.  
  2. Sub ShiftLeftTable (Pos As Integer)
  3.     If TableNo = 1 Then
  4.         Form1.Picture1(1).Picture = Form1.Picture1(2).Picture
  5.         Form1.Picture1(1).Tag = "End"
  6.         Form1.Picture1(2).Visible = FALSE
  7.         Form1.Picture1(2).Enabled = FALSE
  8.         TableNo = 0
  9.         Exit Sub
  10.     End If
  11.  
  12.     For i = Pos To TableNo
  13.         Form1.Picture1(i).Picture = Form1.Picture1(i + 1).Picture
  14.         Form1.Picture1(i).Tag = Form1.Picture1(i + 1).Tag
  15.     Next i
  16.  
  17.     Form1.Picture1(TableNo + 1).Visible = FALSE
  18.     Form1.Picture1(TableNo + 1).Enabled = FALSE
  19.     
  20.     
  21.     TableNo = TableNo - 1
  22.     
  23.     
  24.  
  25.  
  26.     
  27. End Sub
  28.  
  29. Sub SetNewValue (Value As Integer)
  30. '   Tablenette has the following Values:-
  31. '   Ace 1 or 11, Jack 12, Queen 14, King 14
  32. '   all other cards are face value.
  33.  
  34.     Select Case Value
  35.         Case 13
  36.             Value = 14
  37.         Case 12
  38.             Value = 13
  39.         Case 11
  40.             Value = 12
  41.         Case 1
  42.             Value = 11
  43.     End Select
  44.     
  45. End Sub
  46.  
  47. Sub CheckTableCards (A() As String, V As Integer, Pos As Integer, VNo As Integer)
  48.  
  49.  
  50.     Dim TableVal As Integer
  51.     Dim FirstCardVal As Integer
  52.     Dim j As Integer
  53.     
  54.  
  55.     TableVal = CardValue(Cards(Val(Form1.Picture1(Pos).Tag)))
  56.     SetNewValue TableVal
  57.     FirstCardVal = TableVal
  58.     
  59.  
  60.  
  61.     For j = Pos + 1 To TableNo
  62.         TableVal = CardValue(Cards(Val(Form1.Picture1(j).Tag)))
  63.         SetNewValue TableVal
  64.         If V = FirstCardVal + TableVal Then
  65.             A(VNo + 1) = Str$(Pos) + "," + Str$(j)
  66.             VNo = VNo + 1
  67.         Else
  68.             CheckAcesAsOne FirstCardVal, TableVal, V, A(), Pos, j, VNo
  69.         End If
  70.     Next j
  71.     
  72. End Sub
  73.  
  74. Sub LoadSuits ()
  75.     Suits(1) = "Spades"
  76.     Suits(2) = "Hearts"
  77.     Suits(3) = "Clubs"
  78.     Suits(4) = "Diamonds"
  79. End Sub
  80.  
  81. Sub CheckFor27Cards ()
  82.     If PlayerCardsNo > 27 Then
  83.         PSCore = PSCore + 3
  84.         Form1.PlayerScore.Caption = Str$(PSCore)
  85.     End If
  86.     If ComputerCardsNo > 27 Then
  87.         CSCore = CSCore + 3
  88.         Form1.ComputerScore.Caption = Str$(CSCore)
  89.     End If
  90. End Sub
  91.  
  92. Sub ScoreTablenette (C1 As Integer)
  93.  
  94.     Dim PlayVal As Integer
  95.     Dim ComputerVal As Integer
  96.  
  97.     If GameSwitch = PLAYER_MOVE Then
  98.         PlayVal = CardValue(Cards(C1))
  99.         SetNewValue PlayVal
  100.         PSCore = PSCore + TableTotal + PlayVal
  101.         Form1.PlayerScore.Caption = Str$(PSCore)
  102.     Else
  103.         ComputerVal = CardValue(Cards(C1))
  104.         SetNewValue ComputerVal
  105.         CSCore = CSCore + TableTotal + ComputerVal
  106.         Form1.ComputerScore.Caption = Str$(CSCore)
  107.     End If
  108.  
  109. End Sub
  110.  
  111. Sub LoadTableArray ()
  112.  
  113.     For i = 1 To TableNo
  114.         TableArray(i) = CardValue(Cards(Val(Form1.Picture1(i).Tag)))
  115.         SetNewValue TableArray(i)
  116.         NewTableArray(i) = TableArray(i)
  117.     Next i
  118. End Sub
  119.  
  120. Sub TestAsAces (T1 As Integer, T2 As Integer, P1 As Integer, RCds As Integer, Vp As String, Flag As Integer)
  121.     If T2 = 11 Then
  122.         If P1 = T1 + 1 Then
  123.             Vp = "Y"
  124.             Flag = TRUE
  125.             Exit Sub
  126.         End If
  127.     Else
  128.         If T1 = 11 Then
  129.             If P1 = 1 + T2 Then
  130.                 Vp = "Y"
  131.                 Flag = TRUE
  132.                 Exit Sub
  133.             End If
  134.         Else
  135.             If T1 = 11 Then
  136.                 If T2 = 11 Then
  137.                     If P1 = 2 Then
  138.                         Vp = "Y"
  139.                         Flag = TRUE
  140.                     End If
  141.                 End If
  142.             End If
  143.         End If
  144.     End If
  145.                    
  146.     
  147. End Sub
  148.  
  149. Sub TestPlays ()
  150.     Dim i As Integer
  151.  
  152.     Dim PlayVal As Integer
  153.     Dim RemainingCards As Integer
  154.     Dim MatchFound As Integer
  155.     Dim JackFound As Integer
  156.     
  157.  
  158.  
  159.     For i = 1 To ComputerNo
  160.  
  161.         RemainingCards = TableNo
  162.         LoadTableArray
  163.         
  164.         PlayVal = CardValue(Cards(Val(Form1.Picture4(i).Tag)))
  165.         SetNewValue PlayVal
  166.  
  167.         TestForJack PlayVal, ValidPlay(i), JackFound
  168.  
  169.         If JackFound = FALSE Then
  170.             TestEqualRank PlayVal, ValidPlay(i), RemainingCards
  171.             TestEqualValue PlayVal, ValidPlay(i), RemainingCards
  172.         End If
  173.  
  174.         If ValidPlay(i) = "Y" Then
  175.             TestForTypeOfPlay PlayVal, ValidPlay(i), i, RemainingCards, TypeOfPlay(i)
  176.         End If
  177.  
  178.     Next i
  179.                 
  180. End Sub
  181.  
  182. Sub TestForJack (Pv As Integer, Vp As String, Flag As Integer)
  183.         If Pv = 12 Then
  184.            Vp = "Y"
  185.         End If
  186. End Sub
  187.  
  188. Sub TestEqualRank (Pv As Integer, Vp As String, RCds As Integer)
  189.     Dim i As Integer
  190.  
  191.     For i = 1 To TableNo
  192.         If Pv = TableArray(i) Then
  193.             Vp = "Y"
  194.             NewTableArray(i) = 0
  195.             RCds = RCds - 1
  196.         End If
  197.     Next i
  198.     
  199. End Sub
  200.  
  201. Sub TestEqualValue (Pv As Integer, Vp As String, RCds As Integer)
  202.     
  203.     Dim MatchFound As Integer
  204.     Dim j As Integer
  205.     Dim k As Integer
  206.     
  207.     For j = 1 To TableNo - 1
  208.         For k = j + 1 To TableNo
  209.             If Pv = TableArray(j) + TableArray(k) Then
  210.                 Vp = "Y"
  211.                 NewTableArray(j) = 0
  212.                 NewTableArray(k) = 0
  213.                 RCds = RCds - 2
  214.                 Exit Sub
  215.             End If
  216.             TestAsAces TableArray(j), TableArray(k), Pv, RCds, Vp, MatchFound
  217.             If MatchFound = TRUE Then
  218.                 NewTableArray(j) = 0
  219.                 NewTableArray(k) = 0
  220.                 RCds = RCds - 2
  221.                 Exit Sub
  222.             End If
  223.         Next k
  224.     Next j
  225.     
  226. End Sub
  227.  
  228. Sub TestForTypeOfPlay (Pv As Integer, Vp As String, Pos As Integer, RCds As Integer, TyOP As Integer)
  229.         
  230.     Dim i As Integer
  231.     Dim SumRCds As Integer
  232.  
  233.     SumRCds = 0
  234.  
  235.     If Pv = 12 Then
  236.         TyOP = JACK
  237.         Exit Sub
  238.     End If
  239.  
  240.     If RCds = 0 Then
  241.         TyOP = TABLENETTE
  242.         Exit Sub
  243.     End If
  244.  
  245.     For i = 1 To TableNo
  246.         SumRCds = SumRCds + NewTableArray(i)
  247.     Next i
  248.  
  249.     If SumRCds = 12 Then
  250.         TyOP = TOTAL_12
  251.         Exit Sub
  252.     End If
  253.  
  254.     If RCds = 1 Then
  255.         If SumRCds > 11 Then
  256.             SumRCds = SumRCds - 1
  257.         End If
  258.         If SumRCds = 11 Then
  259.             SumRCds = 1
  260.         End If
  261.         Select Case EqualRankGone(SumRCds)
  262.             Case 3
  263.                 TyOP = ONECARD_NOEQUAL
  264.             Case 2
  265.                 TyOP = ONECARD_ONEEQUAL
  266.             Case 1, 0
  267.                 Vp = ""
  268.                 TyOP = REJECTED_MOVE
  269.         End Select
  270.         Exit Sub
  271.     End If
  272.             
  273.  
  274.     If RCds >= 3 Then
  275.         TyOP = THREECARDS_PLUS
  276.     Else
  277.         TyOP = TWOCARDS
  278.     End If
  279.             
  280. End Sub
  281.  
  282. Sub ClearValidPlays ()
  283.     For i = 1 To 6
  284.         ValidPlay(i) = ""
  285.         TypeOfPlay(i) = 0
  286.     Next i
  287. End Sub
  288.  
  289. Sub AddToScore (C1 As Integer)
  290.  
  291.     Dim Score As Integer
  292.     If GameSwitch = PLAYERMOVE Then
  293.         Score = PSCore
  294.         PickUpSwitch = PLAYER
  295.     Else
  296.         Score = CSCore
  297.         PickUpSwitch = COMPUTER
  298.     End If
  299.  
  300.     Select Case C1
  301.         Case 1, 14, 27, 40          'Aces count 1
  302.             Score = Score + 1
  303.         Case 13, 26, 39, 52         'Kings count 1
  304.             Score = Score + 1
  305.         Case 12, 25, 38, 51         'Queens count 1
  306.             Score = Score + 1
  307.         Case 11, 24, 37, 50         'Jacks count 1
  308.             Score = Score + 1
  309.         Case 10, 23, 36             '10s except Diamonds score 1
  310.             Score = Score + 1
  311.         Case 49                     '10 Diamonds scores 2
  312.             Score = Score + 2
  313.         Case 28                     '2 Clubs scores 1
  314.             Score = Score + 1
  315.     End Select
  316.  
  317.     If GameSwitch = PLAYER_MOVE Then
  318.         PSCore = Score
  319.         If Val(Form1.PlayerScore.Caption) <> PSCore Then
  320.             Form1.PlayerScore.Caption = Str$(PSCore)
  321.         End If
  322.     Else
  323.         CSCore = Score
  324.         If Val(Form1.ComputerScore.Caption) <> CSCore Then
  325.             Form1.ComputerScore.Caption = Str$(CSCore)
  326.         End If
  327.     End If
  328.  
  329. End Sub
  330.  
  331. Sub AddToCardsTotal (Count As Integer)
  332.     If GameSwitch = PLAYER_MOVE Then
  333.         PlayerCardsNo = PlayerCardsNo + Count
  334.     Else
  335.         ComputerCardsNo = ComputerCardsNo + Count
  336.     End If
  337. End Sub
  338.  
  339. Sub AddToEqualRank (C1 As Integer)
  340.     EqualRankGone(C1) = EqualRankGone(C1) + 1
  341. End Sub
  342.  
  343. Sub DiscardOnZero ()
  344.     Dim i As Integer
  345.  
  346.     For i = 1 To ComputerNo
  347.         Select Case EqualRankGone(CardValue(Cards(Val(Form1.Picture4(i).Tag))))
  348.             Case 3
  349.                 TypeOfDiscard(i) = 1
  350.             Case 2
  351.                 If CardValue(Cards(Val(Form1.Picture4(i).Tag))) < 7 Then
  352.                     TypeOfDiscard(i) = 2
  353.                 Else
  354.                     TypeOfDiscard(i) = 3
  355.                 End If
  356.             Case 1
  357.                 If CardValue(Cards(Val(Form1.Picture4(i).Tag))) < 7 Then
  358.                     TypeOfDiscard(i) = 4
  359.                 Else
  360.                     TypeOfDiscard(i) = 5
  361.                 End If
  362.             Case 0
  363.                 If CardValue(Cards(Val(Form1.Picture4(i).Tag))) < 7 Then
  364.                     TypeOfDiscard(i) = 6
  365.                 Else
  366.                     TypeOfDiscard(i) = 7
  367.                 End If
  368.         End Select
  369.     Next i
  370. End Sub
  371.  
  372. Sub DiscardOnOne ()
  373.     
  374.     Dim CompCard As Integer
  375.     Dim TableCard As Integer
  376.     Dim TwoCardVal  As Integer
  377.  
  378.     TableCard = CardValue(Cards(Val(Form1.Picture1(1).Tag)))
  379.     SetNewValue TableCard
  380.     
  381.  
  382.     For i = 1 To ComputerNo
  383.         CompCard = CardValue(Cards(Val(Form1.Picture4(i).Tag)))
  384.         SetNewValue CompCard
  385.  
  386.         If CompCard = TableCard Then
  387.             TypeOfDiscard(i) = 10
  388.         Else
  389.             If CompCard + TableTotal = 12 Then
  390.                 If CompCard <> TableCard Then
  391.                     TypeOfDiscard(i) = 1
  392.                 End If
  393.             Else
  394.                 If CompCard + TableTotal > 14 Then
  395.                     If CompCard <> TableCard Then
  396.                         TypeOfDiscard(i) = 2
  397.                     End If
  398.                 Else
  399.                     Select Case EqualRankGone(CardValue(Cards(Val(Form1.Picture4(i).Tag))))
  400.                         Case 3
  401.                             TypeOfDiscard(i) = 3
  402.                         Case 2
  403.                             If CardValue(Cards(Val(Form1.Picture4(i).Tag))) < 7 Then
  404.                                 TypeOfDiscard(i) = 4
  405.                             Else
  406.                                 TypeOfDiscard(i) = 5
  407.                             End If
  408.                         Case 1
  409.                             If CardValue(Cards(Val(Form1.Picture4(i).Tag))) < 7 Then
  410.                                 TypeOfDiscard(i) = 6
  411.                             Else
  412.                                 TypeOfDiscard(i) = 7
  413.                             End If
  414.                         Case 0
  415.                             If CardValue(Cards(Val(Form1.Picture4(i).Tag))) < 7 Then
  416.                                 TypeOfDiscard(i) = 8
  417.                             Else
  418.                                 TypeOfDiscard(i) = 9
  419.                             End If
  420.                     End Select
  421.                 End If
  422.             End If
  423.         End If
  424.     
  425.  
  426.         Next i
  427. End Sub
  428.  
  429. Sub ShiftLeft (A() As Integer, First As Integer, Last As Integer)
  430.  
  431. '   Shift the specified region of the array 1 to the left.
  432. '
  433.     ' A() is the array
  434.     ' First is the DiaryIndex of the first element to be shifted.
  435.     ' Last is the DiaryIndex of the last element to be shifted.
  436.  
  437.     Dim i As Integer
  438.     
  439.     If First < 2 Then First = 2
  440.     
  441.     For i = First To Last
  442.         A(i - 1) = A(i)
  443.     Next
  444.  
  445. End Sub
  446.  
  447. Function BestComputerMove ()
  448.     Dim i As Integer
  449.     Dim j As Integer
  450.  
  451.     Flag = FALSE
  452.     
  453.     For i = 1 To 7
  454.         For j = 1 To ComputerNo
  455.             If ValidPlay(j) = "Y" Then
  456.                 If TypeOfPlay(j) = i Then
  457.                     BestComputerMove = j
  458.                     Flag = TRUE
  459.                     Exit Function
  460.                 End If
  461.             End If
  462.         Next j
  463.     Next i
  464.  
  465. End Function
  466.  
  467. Sub ShiftLeftWho (Pos As Integer)
  468.     
  469.     Dim Win As Integer
  470.  
  471.     If GameSwitch = PLAYER_MOVE Then
  472.         ShiftLeftPlayer Pos
  473.     Else
  474.         ShiftLeftComputer Pos
  475.     End If
  476.  
  477.     If DealSwitch = PLAYER_DEAL Then
  478.         If PlayerNo = 0 Then
  479.             If CardNo > 52 Then
  480.                 LastPickup
  481.                 CheckFor27Cards
  482.                 Win = CheckForWin()
  483.                 If Win = TRUE Then
  484.                     AskForNewGame
  485.                     Exit Sub
  486.                 End If
  487.                 DealSwitch = COMPUTER_DEAL
  488.                 FirstDeal
  489.             Else
  490.                 PlayerDeal
  491.                 GameSwitch = COMPUTER_MOVE
  492.                 EnableComputerMove
  493.  
  494.             End If
  495.         Else
  496.             If GameSwitch = PLAYER_MOVE Then
  497.                 GameSwitch = COMPUTER_MOVE
  498.                 EnableComputerMove
  499.             Else
  500.                 GameSwitch = PLAYER_MOVE
  501.                 EnablePlayerMove
  502.             End If
  503.         End If
  504.     Else
  505.         If ComputerNo = 0 Then
  506.             If CardNo > 52 Then
  507.                 LastPickup
  508.                 CheckFor27Cards
  509.                 Win = CheckForWin()
  510.                 If Win = TRUE Then
  511.                     AskForNewGame
  512.                     Exit Sub
  513.                 End If
  514.                 DealSwitch = PLAYER_DEAL
  515.                 FirstDeal
  516.             Else
  517.                 ComputerDeal
  518.                 GameSwitch = PLAYER_MOVE
  519.                 EnablePlayerMove
  520.                 
  521.             End If
  522.         Else
  523.             If GameSwitch = PLAYER_MOVE Then
  524.                 GameSwitch = COMPUTER_MOVE
  525.                 EnableComputerMove
  526.             Else
  527.                 GameSwitch = PLAYER_MOVE
  528.                 EnablePlayerMove
  529.             End If
  530.         End If
  531.     End If
  532. End Sub
  533.  
  534. Sub AskForNewGame ()
  535.  
  536.     Dim MsgBoxResponse As Integer
  537.  
  538.     MsgBoxResponse = MsgBox("Do You Wish to Play Again", MBB_YNCAN + MBI_INFO)
  539.     If MsgBoxResponse = MB_YES Then
  540.         NewGame
  541.         FirstDeal
  542.     Else
  543.         End
  544.     End If
  545. End Sub
  546.  
  547. Sub JackPlayed ()
  548.     For i = TableNo To 1 Step -1
  549.         AddToScore CardValue(Cards(Val(Form1.Picture1(i).Tag)))
  550.         AddToEqualRank CardValue(Cards(Val(Form1.Picture1(i).Tag)))
  551.         ShiftLeftTable (i)
  552.         AddToCardsTotal (TableNo + 1)
  553.     Next i
  554.     
  555. End Sub
  556.  
  557. Sub ShiftLeftComputer (Pos As Integer)
  558.     Dim Win As Integer
  559.     
  560.     If ComputerNo = 1 Then
  561.         Form1.Picture4(1).Visible = FALSE
  562.         Form1.Picture4(1).Enabled = FALSE
  563.         ComputerNo = 0
  564.         Exit Sub
  565.     End If
  566.  
  567.     For i = Pos To (ComputerNo - 1)
  568.         Form1.Picture4(i).Picture = Form1.Picture4(i + 1).Picture
  569.         Form1.Picture4(i).Tag = Form1.Picture4(i + 1).Tag
  570.     Next i
  571.     ComputerNo = ComputerNo - 1
  572.     For i = ComputerNo + 1 To 6
  573.         Form1.Picture4(i).Visible = FALSE
  574.         Form1.Picture4(i).Enabled = FALSE
  575.     Next i
  576.     
  577. End Sub
  578.  
  579. Sub ShiftLeftPlayer (Pos As Integer)
  580.  
  581.     Dim Win As Integer
  582.     
  583.     If PlayerNo = 1 Then
  584.         Form1.Picture2(1).Visible = FALSE
  585.         Form1.Picture2(1).Enabled = FALSE
  586.         PlayerNo = 0
  587.         Exit Sub
  588.     End If
  589.  
  590.     For i = Pos To (PlayerNo - 1)
  591.         Form1.Picture2(i).Picture = Form1.Picture2(i + 1).Picture
  592.         Form1.Picture2(i).Tag = Form1.Picture2(i + 1).Tag
  593.     Next i
  594.     PlayerNo = PlayerNo - 1
  595.     For i = PlayerNo + 1 To 6
  596.         Form1.Picture2(i).Visible = FALSE
  597.         Form1.Picture2(i).Enabled = FALSE
  598.     Next i
  599.  
  600. End Sub
  601.  
  602. Function BestComputerDiscard ()
  603.     
  604.     Dim i As Integer
  605.     
  606.  
  607.     If TableNo = 0 Then
  608.         DiscardOnZero
  609.     Else
  610.         If TableNo > 0 Then
  611.             DiscardOnOne
  612.         End If
  613.     End If
  614.     
  615.     For i = 1 To 10
  616.         For j = 1 To ComputerNo
  617.                 If TypeOfDiscard(j) = i Then
  618.                     BestComputerDiscard = j
  619.                     Exit Function
  620.                 End If
  621.         Next j
  622.     Next i
  623.     
  624.  
  625. End Function
  626.  
  627. Sub LastPickup ()
  628.     If PickUpSwitch = PLAYER Then
  629.         GameSwitch = PLAYER_MOVE
  630.     Else
  631.         GameSwitch = COMPUTER_MOVE
  632.     End If
  633.  
  634.     For i = TableNo To 1 Step -1
  635.         AddToScore CardValue(Cards(Val(Form1.Picture1(i).Tag)))
  636.         ShiftLeftTable (i)
  637.         AddToCardsTotal (TableNo)
  638.     Next i
  639. End Sub
  640.  
  641. Function CheckForWin ()
  642.     
  643.     Flag = FALSE
  644.  
  645.     If Val(Form1.PlayerScore.Caption) > 251 Then
  646.         If Val(Form1.PlayerScore.Caption) > Val(Form1.ComputerScore.Caption) Then
  647.             MsgBox ("Well done you've Won")
  648.             CheckForWin = TRUE
  649.         Else
  650.             MsgBox ("Computer Wins This Game")
  651.             Flag = TRUE
  652.         End If
  653.     Else
  654.         If Val(Form1.ComputerScore.Caption) > 251 Then
  655.             MsgBox ("Computer Wins This Game")
  656.             CheckForWin = TRUE
  657.         End If
  658.     End If
  659.  
  660. End Function
  661.  
  662. Sub EnableComputerMove ()
  663.     Form1.ComputerMove.Enabled = TRUE
  664.     For i = 1 To 6
  665.         Form1.Picture2(i).Enabled = FALSE
  666.     Next i
  667.     MakeComputerMove
  668. End Sub
  669.  
  670. Sub EnablePlayerMove ()
  671.     Form1.ComputerMove.Enabled = FALSE
  672.     For i = 1 To 6
  673.         Form1.Picture2(i).Enabled = TRUE
  674.     Next i
  675. End Sub
  676.  
  677. Sub NewGame ()
  678.     
  679.     CardNo = 1
  680.     For i = 6 To 12
  681.         Form1.Picture1(i).Visible = FALSE
  682.         Form1.Picture1(i).Enabled = FALSE
  683.     Next i
  684.     CSCore = 0
  685.     PSCore = 0
  686.     Form1.ComputerScore.Caption = Str$(CSCore)
  687.     Form1.PlayerScore.Caption = Str$(PSCore)
  688.     DealSwitch = COMPUTER_DEAL
  689. End Sub
  690.  
  691. Sub MakeComputerMove ()
  692.     Dim X As Single
  693.     Dim Y As Single
  694.     Dim GoodMove As Integer
  695.     Dim ValidCard As Integer
  696.     Dim BestCard As Integer
  697.     Dim CurrTime As Double
  698.     Dim StartTime As Double
  699.     ClearValidPlays
  700.     TestPlays
  701.     ValidCard = BestComputerMove()
  702.  
  703.     If ValidCard <> 0 Then
  704.         Form1.Picture5(1).Visible = TRUE
  705.         Form1.Picture5(1).Picture = Form1.Picture4(ValidCard).Picture
  706.         Beep
  707.         CurrTime = TimeValue(Time$)
  708.         StartTime = CurrTime + .0000075
  709.         Do While StartTime > CurrTime
  710.             CurrTime = TimeValue(Time$)
  711.         Loop
  712.         
  713.         MakeMove 1, Form1.Picture4(ValidCard), X, Y
  714.         Form1.Picture5(1).Visible = FALSE
  715.     Else
  716.         BestCard = BestComputerDiscard()
  717.         Form1.Picture5(1).Visible = TRUE
  718.         Form1.Picture5(1).Picture = Form1.Picture4(BestCard).Picture
  719.         Beep
  720.         CurrTime = TimeValue(Time$)
  721.         StartTime = CurrTime + .0000075
  722.         Do While StartTime > CurrTime
  723.             CurrTime = TimeValue(Time$)
  724.         Loop
  725.  
  726.         MakeMove TableNo + 1, Form1.Picture4(BestCard), X, Y
  727.  
  728.         Form1.Picture5(1).Visible = FALSE
  729.     End If
  730.  
  731.  
  732.  
  733.     
  734. End Sub
  735.  
  736. Sub MakeMove (Index As Integer, Source As Control, X As Single, Y As Single)
  737.     Dim HoldNo  As Integer
  738.  
  739. '   1. Players covers any card
  740. '           If Jack all cards removed but
  741. '               no Tablenette Scored
  742. '       check if any 2 or 3 cards = its Value
  743. '       check if Equal Rank cards exists
  744. '       check if all Table cards taken "Tablenette score"
  745. '
  746. '   OR
  747. '
  748. '   2. Player drops card on table (the card back at end)
  749. '       Game adds card to table
  750.  
  751.     HoldNo = TableNo
  752.  
  753.     CalculateTableTotal
  754.  
  755.     If CardValue(Cards(Val(Source.Tag))) = 11 Then
  756.         JackPlayed
  757.         AddToScore CardValue(Cards(Val(Source.Tag)))
  758.         AddToEqualRank CardValue(Cards(Val(Source.Tag)))
  759.         ShiftLeftWho (Source.Index)
  760.         Exit Sub
  761.     End If
  762.         
  763.  
  764.     If Index <= TableNo Then
  765.  
  766.         CheckEqualRank Val(Source.Tag)
  767.         CheckEqualValue Val(Source.Tag)
  768.  
  769.         If TableNo = HoldNo Then
  770.             MsgBox ("No Valid Match with This Card")
  771.             Exit Sub
  772.         Else
  773.             AddToScore CardValue(Cards(Val(Source.Tag)))
  774.             AddToEqualRank CardValue(Cards(Val(Source.Tag)))
  775.             If TableNo = 0 Then
  776.                 ScoreTablenette Val(Source.Tag)
  777.             End If
  778.             ShiftLeftWho (Source.Index)
  779.         End If
  780.  
  781.     Else
  782.         Form1.Picture1(Index + 1).Picture = Form1.Picture1(Index).Picture
  783.         Form1.Picture1(Index).Picture = Source.Picture
  784.         Form1.Picture1(Index).Tag = Source.Tag
  785.         Form1.Picture1(Index + 1).Enabled = TRUE
  786.         Form1.Picture1(Index + 1).Visible = TRUE
  787.         Form1.Picture1(Index + 1).Tag = "End"
  788.         TableNo = Index
  789.         ShiftLeftWho (Source.Index)
  790.     End If
  791.  
  792.     
  793. End Sub
  794.  
  795.