//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit4.h"
#include "Unit5.h"
#include "audio.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm4 *Form4;
int fillNum = 1;
//---------------------------------------------------------------------------
__fastcall TForm4::TForm4(TComponent* Owner)
        : TForm(Owner)
{
   OK1 = OK2 = 0;
}
//---------------------------------------------------------------------------


void __fastcall TForm4::ListBox1MouseDown(TObject *Sender,
      TMouseButton Button, TShiftState Shift, int X, int Y)
{
   if ( ListBox1->ItemIndex >= 0)
   {
      if ( fillNum == 1){
         SpeedButton1->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton1;
      }
      if ( fillNum == 2){
         SpeedButton2->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton2;
      }
      if ( fillNum == 3){
         SpeedButton3->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton3;
      }
      if ( fillNum == 4){
         SpeedButton4->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton4;
      }
      if ( fillNum == 5){
         SpeedButton5->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton5;
      }
      if ( fillNum == 6){
         SpeedButton6->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton6;
      }
      if ( fillNum == 7){
         SpeedButton7->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton7;
      }
      if ( fillNum == 8){
         SpeedButton8->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton8;
      }
      if ( fillNum == 9){
         SpeedButton9->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton9;
      }
      if ( fillNum == 10){
         SpeedButton10->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton10;
      }
      if ( fillNum == 11){
         SpeedButton11->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton11;
      }
      if ( fillNum == 12){
         SpeedButton12->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton12;
      }
      if ( fillNum == 13){
         SpeedButton13->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton13;
      }
      if ( fillNum == 14){
         SpeedButton14->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton14;
      }
      if ( fillNum == 15){
         SpeedButton15->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton15;
      }
      if ( fillNum == 16){
         SpeedButton16->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton16;
      }
      if ( fillNum == 17){
         SpeedButton17->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton17;
      }
      if ( fillNum == 18){
         SpeedButton18->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton18;
      }
      if ( fillNum == 19){
         SpeedButton19->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton19;
      }
      if ( fillNum == 20){
         SpeedButton20->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton20;
      }
      if ( fillNum == 21){
         SpeedButton21->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton21;
      }
      if ( fillNum == 22){
         SpeedButton22->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton22;
      }
      if ( fillNum == 23){
         SpeedButton23->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton23;
      }
      if ( fillNum == 24){
         SpeedButton24->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton24;
      }
      if ( fillNum == 25){
         SpeedButton25->Caption = ListBox1->Items->Strings[ListBox1->ItemIndex];
         Form1->map[ListBox1->Items->Strings[ListBox1->ItemIndex].ToInt()].binGo = SpeedButton25;
         if ( Form1->useSer == 1)
         {
            Form4->Label1->Caption = "§A¥ýª±~";
            OK1 = 1;
            Form1->ServerSocket1->Socket->Connections[0]->SendText("OK1");
         }
         else
         {
            OK2 = 1;
            Form1->ClientSocket1->Socket->SendText("OK2");
         }
         if ( OK1 == 1 && OK2 == 1)
            playGame();
      }

      ListBox1->Items->Delete( ListBox1->ItemIndex);
      fillNum++;
   }
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton1Click(TObject *Sender)
{
   TSpeedButton *a;
   a = (TSpeedButton*) Sender;
   if ( count%2 == 0 && a->Font->Color != clRed && a->Font->Color != clGreen && a->Font->Color != clBlue)
   {
      if ( Form1->useSer == 1)
      {
         Form1->ServerSocket1->Socket->Connections[0]->SendText("YourTurn");
         Form1->ServerSocket1->Socket->Connections[0]->SendText(a->Caption);
      }
      else
      {
         Form1->ClientSocket1->Socket->SendText("YourTurn");
         Form1->ClientSocket1->Socket->SendText(a->Caption);
      }
      a->AllowAllUp = false;
      a->Down = true;
      a->Font->Color = clBlue;
      Label1->Caption = "";
      count++;
      BinGo();
   }
   else
   {
   if ( a->Font->Color != clRed && a->Font->Color != clGreen && a->Font->Color != clBlue){
      a->AllowAllUp = true;
      a->Down = false;
      }
   }
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton2Click(TObject *Sender)
{
/*   if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton2->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton2->Caption);
      SpeedButton2->AllowAllUp = false;
      SpeedButton2->Down = true;
      SpeedButton2->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton2->Font->Color != clRed && SpeedButton2->Font->Color != clGreen && SpeedButton2->Font->Color != clBlue){
      SpeedButton2->AllowAllUp = true;
      SpeedButton2->Down = false;
      }
   }      */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton3Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton3->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton3->Caption);
      SpeedButton3->AllowAllUp = false;
      SpeedButton3->Down = true;
      SpeedButton3->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton3->Font->Color != clRed && SpeedButton3->Font->Color != clGreen && SpeedButton3->Font->Color != clBlue){
      SpeedButton3->AllowAllUp = true;
      SpeedButton3->Down = false;
      }
   }     */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton4Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton4->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton4->Caption);
      SpeedButton4->Down = true;
      SpeedButton4->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton4->Font->Color != clRed && SpeedButton4->Font->Color != clGreen && SpeedButton4->Font->Color != clBlue){
      SpeedButton4->AllowAllUp = true;
      SpeedButton4->Down = false;
      }
   }       */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton5Click(TObject *Sender)
{
 /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton5->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton5->Caption);
      SpeedButton5->Down = true;
      SpeedButton5->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton5->Font->Color == clBlack){
      SpeedButton5->AllowAllUp = true;
      SpeedButton5->Down = false;
      }
   }      */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton6Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton6->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton6->Caption);
      SpeedButton6->Down = true;
      SpeedButton6->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton6->Font->Color == clBlack){
      SpeedButton6->AllowAllUp = true;
      SpeedButton6->Down = false;
      }
   }        */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton7Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton7->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton7->Caption);
      SpeedButton7->Down = true;
      SpeedButton7->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton7->Font->Color == clBlack){
      SpeedButton7->AllowAllUp = true;
      SpeedButton7->Down = false;
      }
   }              */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton8Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton8->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton8->Caption);
      SpeedButton8->Down = true;
      SpeedButton8->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton8->Font->Color == clBlack){
      SpeedButton8->AllowAllUp = true;
      SpeedButton8->Down = false;
      }
   }          */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton9Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton9->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton9->Caption);
      SpeedButton9->Down = true;
      SpeedButton9->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton9->Font->Color == clBlack){
      SpeedButton9->AllowAllUp = true;
      SpeedButton9->Down = false;
      }
   }       */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton10Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton10->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton10->Caption);
      SpeedButton10->Down = true;
      SpeedButton10->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton10->Font->Color == clBlack){
      SpeedButton10->AllowAllUp = true;
      SpeedButton10->Down = false;
      }
   }      */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton11Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton11->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton11->Caption);
      SpeedButton11->Down = true;
      SpeedButton11->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton11->Font->Color == clBlack){
      SpeedButton11->AllowAllUp = true;
      SpeedButton11->Down = false;
      }
   }             */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton12Click(TObject *Sender)
{
   /*if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton12->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton12->Caption);
      SpeedButton12->Down = true;
      SpeedButton12->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton12->Font->Color == clBlack){
      SpeedButton12->AllowAllUp = true;
      SpeedButton12->Down = false;
      }
   }              */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton13Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton13->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton13->Caption);
      SpeedButton13->Down = true;
      SpeedButton13->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton13->Font->Color == clBlack){
      SpeedButton13->AllowAllUp = true;
      SpeedButton13->Down = false;
      }
   }    */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton14Click(TObject *Sender)
{
/*   if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton14->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton14->Caption);
      SpeedButton14->Down = true;
      SpeedButton14->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton14->Font->Color == clBlack){
      SpeedButton14->AllowAllUp = true;
      SpeedButton14->Down = false;
      }
   }         */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton15Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton15->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton15->Caption);
      SpeedButton15->Down = true;
      SpeedButton15->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton15->Font->Color == clBlack){
      SpeedButton15->AllowAllUp = true;
      SpeedButton15->Down = false;
      }
   }      */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton16Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton16->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton16->Caption);
      SpeedButton16->Down = true;
      SpeedButton16->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton16->Font->Color == clBlack){
      SpeedButton16->AllowAllUp = true;
      SpeedButton16->Down = false;
      }
   }        */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton17Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton17->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton17->Caption);
      SpeedButton17->Down = true;
      SpeedButton17->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton17->Font->Color == clBlack){
      SpeedButton17->AllowAllUp = true;
      SpeedButton17->Down = false;
      }
   }         */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton18Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton18->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton18->Caption);
      SpeedButton18->Down = true;
      SpeedButton18->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton18->Font->Color == clBlack){
      SpeedButton18->AllowAllUp = true;
      SpeedButton18->Down = false;
      }
   }            */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton19Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton19->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton19->Caption);
      SpeedButton19->Down = true;
      SpeedButton19->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton19->Font->Color == clBlack){
      SpeedButton19->AllowAllUp = true;
      SpeedButton19->Down = false;
      }
   }             */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton20Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton20->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton20->Caption);
      SpeedButton20->Down = true;
      SpeedButton20->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton20->Font->Color == clBlack){
      SpeedButton20->AllowAllUp = true;
      SpeedButton20->Down = false;
      }
   }          */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton21Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton21->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton21->Caption);
      SpeedButton21->Down = true;
      SpeedButton21->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton21->Font->Color == clBlack){
      SpeedButton21->AllowAllUp = true;
      SpeedButton21->Down = false;
      }
   }      */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton22Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton22->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton22->Caption);
      SpeedButton22->Down = true;
      SpeedButton22->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton22->Font->Color == clBlack){
      SpeedButton22->AllowAllUp = true;
      SpeedButton22->Down = false;
      }
   }         */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton23Click(TObject *Sender)
{
  /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton23->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton23->Caption);
      SpeedButton23->Down = true;
      SpeedButton23->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton23->Font->Color == clBlack){
      SpeedButton23->AllowAllUp = true;
      SpeedButton23->Down = false;
      }
   }     */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton24Click(TObject *Sender)
{
 /*  if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton24->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton24->Caption);
      SpeedButton24->Down = true;
      SpeedButton24->Font->Color = clBlue;
      count++;
      BinGo();
   }
   else
   {
   if ( SpeedButton24->Font->Color == clBlack){
      SpeedButton24->AllowAllUp = true;
      SpeedButton24->Down = false;
      }
   }       */

}
//---------------------------------------------------------------------------

void __fastcall TForm4::SpeedButton25Click(TObject *Sender)
{
 /* if ( count%2 == 0)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText(SpeedButton25->Caption);
      else
         Form1->ClientSocket1->Socket->SendText(SpeedButton25->Caption);
      SpeedButton25->Down = true;
      SpeedButton25->Font->Color = clBlue;
      count++;
   }
   else
   {
   if ( SpeedButton25->Font->Color == clBlack){
      SpeedButton25->AllowAllUp = true;
      SpeedButton25->Down = false;
      }
   }
   BinGo();   */
}
//---------------------------------------------------------------------------

void __fastcall TForm4::FormShow(TObject *Sender)
{
   if ( Form1->useSer == 1)
      count = 0;
   else
      count = 1;
}
//---------------------------------------------------------------------------

void TForm4::BinGo(void)
{
   if ( Form4->SpeedButton1->Down == true && Form4->SpeedButton2->Down == true && Form4->SpeedButton3->Down == true &&
        Form4->SpeedButton4->Down == true && Form4->SpeedButton5->Down == true)
   {
      Form4->SpeedButton1->Font->Color = clGreen;
      Form4->SpeedButton2->Font->Color = clGreen;
      Form4->SpeedButton3->Font->Color = clGreen;
      Form4->SpeedButton4->Font->Color = clGreen;
      Form4->SpeedButton5->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton6->Down == true && Form4->SpeedButton7->Down == true && Form4->SpeedButton8->Down == true &&
        Form4->SpeedButton9->Down == true && Form4->SpeedButton10->Down == true)
   {
      Form4->SpeedButton6->Font->Color = clGreen;
      Form4->SpeedButton7->Font->Color = clGreen;
      Form4->SpeedButton8->Font->Color = clGreen;
      Form4->SpeedButton9->Font->Color = clGreen;
      Form4->SpeedButton10->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton11->Down == true && Form4->SpeedButton12->Down == true && Form4->SpeedButton13->Down == true &&
        Form4->SpeedButton14->Down == true && Form4->SpeedButton15->Down == true)
   {
      Form4->SpeedButton11->Font->Color = clGreen;
      Form4->SpeedButton12->Font->Color = clGreen;
      Form4->SpeedButton13->Font->Color = clGreen;
      Form4->SpeedButton14->Font->Color = clGreen;
      Form4->SpeedButton15->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton16->Down == true && Form4->SpeedButton17->Down == true && Form4->SpeedButton18->Down == true &&
        Form4->SpeedButton19->Down == true && Form4->SpeedButton20->Down == true)
   {
      Form4->SpeedButton16->Font->Color = clGreen;
      Form4->SpeedButton17->Font->Color = clGreen;
      Form4->SpeedButton18->Font->Color = clGreen;
      Form4->SpeedButton19->Font->Color = clGreen;
      Form4->SpeedButton20->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton21->Down == true && Form4->SpeedButton22->Down == true && Form4->SpeedButton23->Down == true &&
        Form4->SpeedButton24->Down == true && Form4->SpeedButton25->Down == true)
   {
      Form4->SpeedButton21->Font->Color = clGreen;
      Form4->SpeedButton22->Font->Color = clGreen;
      Form4->SpeedButton23->Font->Color = clGreen;
      Form4->SpeedButton24->Font->Color = clGreen;
      Form4->SpeedButton25->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton1->Down == true && Form4->SpeedButton6->Down == true && Form4->SpeedButton11->Down == true &&
        Form4->SpeedButton16->Down == true && Form4->SpeedButton21->Down == true)
   {
      Form4->SpeedButton1->Font->Color = clGreen;
      Form4->SpeedButton6->Font->Color = clGreen;
      Form4->SpeedButton11->Font->Color = clGreen;
      Form4->SpeedButton16->Font->Color = clGreen;
      Form4->SpeedButton21->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton2->Down == true && Form4->SpeedButton7->Down == true && Form4->SpeedButton12->Down == true &&
        Form4->SpeedButton17->Down == true && Form4->SpeedButton22->Down == true)
   {
      Form4->SpeedButton2->Font->Color = clGreen;
      Form4->SpeedButton7->Font->Color = clGreen;
      Form4->SpeedButton12->Font->Color = clGreen;
      Form4->SpeedButton17->Font->Color = clGreen;
      Form4->SpeedButton22->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton3->Down == true && Form4->SpeedButton8->Down == true && Form4->SpeedButton13->Down == true &&
        Form4->SpeedButton18->Down == true && Form4->SpeedButton23->Down == true)
   {
      Form4->SpeedButton3->Font->Color = clGreen;
      Form4->SpeedButton8->Font->Color = clGreen;
      Form4->SpeedButton13->Font->Color = clGreen;
      Form4->SpeedButton18->Font->Color = clGreen;
      Form4->SpeedButton23->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton4->Down == true && Form4->SpeedButton9->Down == true && Form4->SpeedButton14->Down == true &&
        Form4->SpeedButton19->Down == true && Form4->SpeedButton24->Down == true)
   {
      Form4->SpeedButton4->Font->Color = clGreen;
      Form4->SpeedButton9->Font->Color = clGreen;
      Form4->SpeedButton14->Font->Color = clGreen;
      Form4->SpeedButton19->Font->Color = clGreen;
      Form4->SpeedButton24->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton5->Down == true && Form4->SpeedButton10->Down == true && Form4->SpeedButton15->Down == true &&
        Form4->SpeedButton20->Down == true && Form4->SpeedButton25->Down == true)
   {
      Form4->SpeedButton5->Font->Color = clGreen;
      Form4->SpeedButton10->Font->Color = clGreen;
      Form4->SpeedButton15->Font->Color = clGreen;
      Form4->SpeedButton20->Font->Color = clGreen;
      Form4->SpeedButton25->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton1->Down == true && Form4->SpeedButton7->Down == true && Form4->SpeedButton13->Down == true &&
        Form4->SpeedButton19->Down == true && Form4->SpeedButton25->Down == true)
   {
      Form4->SpeedButton1->Font->Color = clGreen;
      Form4->SpeedButton7->Font->Color = clGreen;
      Form4->SpeedButton13->Font->Color = clGreen;
      Form4->SpeedButton19->Font->Color = clGreen;
      Form4->SpeedButton25->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form4->SpeedButton5->Down == true && Form4->SpeedButton9->Down == true && Form4->SpeedButton13->Down == true &&
        Form4->SpeedButton17->Down == true && Form4->SpeedButton21->Down == true)
   {
      Form4->SpeedButton5->Font->Color = clGreen;
      Form4->SpeedButton9->Font->Color = clGreen;
      Form4->SpeedButton13->Font->Color = clGreen;
      Form4->SpeedButton17->Font->Color = clGreen;
      Form4->SpeedButton21->Font->Color = clGreen;
      Form1->counter = Form1->counter + 1;
   }
   if ( Form1->counter == 5)
   {
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText("IWin");
      else
         Form1->ClientSocket1->Socket->SendText("IWin");
      Form5->Label1->Caption = "You Win!!";
      Form5->ShowModal();
   }
   Form1->counter = 0;
}

void TForm4::playGame( void)
{
      SpeedButton1->Enabled = true;
      SpeedButton2->Enabled = true;
      SpeedButton3->Enabled = true;
      SpeedButton4->Enabled = true;
      SpeedButton5->Enabled = true;
      SpeedButton6->Enabled = true;
      SpeedButton7->Enabled = true;
      SpeedButton8->Enabled = true;
      SpeedButton9->Enabled = true;
      SpeedButton10->Enabled = true;
      SpeedButton11->Enabled = true;
      SpeedButton12->Enabled = true;
      SpeedButton13->Enabled = true;
      SpeedButton14->Enabled = true;
      SpeedButton15->Enabled = true;
      SpeedButton16->Enabled = true;
      SpeedButton17->Enabled = true;
      SpeedButton18->Enabled = true;
      SpeedButton19->Enabled = true;
      SpeedButton20->Enabled = true;
      SpeedButton21->Enabled = true;
      SpeedButton22->Enabled = true;
      SpeedButton23->Enabled = true;
      SpeedButton24->Enabled = true;
      SpeedButton25->Enabled = true;
}
void __fastcall TForm4::FormClose(TObject *Sender, TCloseAction &Action)
{
      SpeedButton1->Enabled = false;
      SpeedButton2->Enabled = false;
      SpeedButton3->Enabled = false;
      SpeedButton4->Enabled = false;
      SpeedButton5->Enabled = false;
      SpeedButton6->Enabled = false;
      SpeedButton7->Enabled = false;
      SpeedButton8->Enabled = false;
      SpeedButton9->Enabled = false;
      SpeedButton10->Enabled = false;
      SpeedButton11->Enabled = false;
      SpeedButton12->Enabled = false;
      SpeedButton13->Enabled = false;
      SpeedButton14->Enabled = false;
      SpeedButton15->Enabled = false;
      SpeedButton16->Enabled = false;
      SpeedButton17->Enabled = false;
      SpeedButton18->Enabled = false;
      SpeedButton19->Enabled = false;
      SpeedButton20->Enabled = false;
      SpeedButton21->Enabled = false;
      SpeedButton22->Enabled = false;
      SpeedButton23->Enabled = false;
      SpeedButton24->Enabled = false;
      SpeedButton25->Enabled = false;
      SpeedButton1->AllowAllUp = true;
      SpeedButton1->Down = false;
      SpeedButton1->AllowAllUp = false;
      SpeedButton2->AllowAllUp = true;
      SpeedButton2->Down = false;
      SpeedButton2->AllowAllUp = false;
      SpeedButton3->AllowAllUp = true;
      SpeedButton3->Down = false;
      SpeedButton3->AllowAllUp = false;
      SpeedButton4->AllowAllUp = true;
      SpeedButton4->Down = false;
      SpeedButton4->AllowAllUp = false;
      SpeedButton5->AllowAllUp = true;
      SpeedButton5->Down = false;
      SpeedButton5->AllowAllUp = false;
      SpeedButton6->AllowAllUp = true;
      SpeedButton6->Down = false;
      SpeedButton6->AllowAllUp = false;
      SpeedButton7->AllowAllUp = true;
      SpeedButton7->Down = false;
      SpeedButton7->AllowAllUp = false;
      SpeedButton8->AllowAllUp = true;
      SpeedButton8->Down = false;
      SpeedButton8->AllowAllUp = false;
      SpeedButton9->AllowAllUp = true;
      SpeedButton9->Down = false;
      SpeedButton9->AllowAllUp = false;
      SpeedButton10->AllowAllUp = true;
      SpeedButton10->Down = false;
      SpeedButton10->AllowAllUp = false;
      SpeedButton11->AllowAllUp = true;
      SpeedButton11->Down = false;
      SpeedButton11->AllowAllUp = false;
      SpeedButton12->AllowAllUp = true;
      SpeedButton12->Down = false;
      SpeedButton12->AllowAllUp = false;
      SpeedButton13->AllowAllUp = true;
      SpeedButton13->Down = false;
      SpeedButton13->AllowAllUp = false;
      SpeedButton14->AllowAllUp = true;
      SpeedButton14->Down = false;
      SpeedButton14->AllowAllUp = false;
      SpeedButton15->AllowAllUp = true;
      SpeedButton15->Down = false;
      SpeedButton15->AllowAllUp = false;
      SpeedButton16->AllowAllUp = true;
      SpeedButton16->Down = false;
      SpeedButton16->AllowAllUp = false;
      SpeedButton17->AllowAllUp = true;
      SpeedButton17->Down = false;
      SpeedButton17->AllowAllUp = false;
      SpeedButton18->AllowAllUp = true;
      SpeedButton18->Down = false;
      SpeedButton18->AllowAllUp = false;
      SpeedButton19->AllowAllUp = true;
      SpeedButton19->Down = false;
      SpeedButton19->AllowAllUp = false;
      SpeedButton20->AllowAllUp = true;
      SpeedButton20->Down = false;
      SpeedButton20->AllowAllUp = false;
      SpeedButton21->AllowAllUp = true;
      SpeedButton21->Down = false;
      SpeedButton21->AllowAllUp = false;
      SpeedButton22->AllowAllUp = true;
      SpeedButton22->Down = false;
      SpeedButton22->AllowAllUp = false;
      SpeedButton23->AllowAllUp = true;
      SpeedButton23->Down = false;
      SpeedButton23->AllowAllUp = false;
      SpeedButton24->AllowAllUp = true;
      SpeedButton24->Down = false;
      SpeedButton24->AllowAllUp = false;
      SpeedButton25->AllowAllUp = true;
      SpeedButton25->Down = false;
      SpeedButton25->AllowAllUp = false;
      SpeedButton1->Caption = "";
      SpeedButton2->Caption = "";
      SpeedButton3->Caption = "";
      SpeedButton4->Caption = "";
      SpeedButton5->Caption = "";
      SpeedButton6->Caption = "";
      SpeedButton7->Caption = "";
      SpeedButton8->Caption = "";
      SpeedButton9->Caption = "";
      SpeedButton10->Caption = "";
      SpeedButton11->Caption = "";
      SpeedButton12->Caption = "";
      SpeedButton13->Caption = "";
      SpeedButton14->Caption = "";
      SpeedButton15->Caption = "";
      SpeedButton16->Caption = "";
      SpeedButton17->Caption = "";
      SpeedButton18->Caption = "";
      SpeedButton19->Caption = "";
      SpeedButton20->Caption = "";
      SpeedButton21->Caption = "";
      SpeedButton22->Caption = "";
      SpeedButton23->Caption = "";
      SpeedButton24->Caption = "";
      SpeedButton25->Caption = "";
      SpeedButton1->Font->Color = clBlack;
      SpeedButton2->Font->Color = clBlack;
      SpeedButton3->Font->Color = clBlack;
      SpeedButton4->Font->Color = clBlack;
      SpeedButton5->Font->Color = clBlack;
      SpeedButton6->Font->Color = clBlack;
      SpeedButton7->Font->Color = clBlack;
      SpeedButton8->Font->Color = clBlack;
      SpeedButton9->Font->Color = clBlack;
      SpeedButton10->Font->Color = clBlack;
      SpeedButton11->Font->Color = clBlack;
      SpeedButton12->Font->Color = clBlack;
      SpeedButton13->Font->Color = clBlack;
      SpeedButton14->Font->Color = clBlack;
      SpeedButton15->Font->Color = clBlack;
      SpeedButton16->Font->Color = clBlack;
      SpeedButton17->Font->Color = clBlack;
      SpeedButton18->Font->Color = clBlack;
      SpeedButton19->Font->Color = clBlack;
      SpeedButton20->Font->Color = clBlack;
      SpeedButton21->Font->Color = clBlack;
      SpeedButton22->Font->Color = clBlack;
      SpeedButton23->Font->Color = clBlack;
      SpeedButton24->Font->Color = clBlack;
      SpeedButton25->Font->Color = clBlack;
      ListBox1->Items->Clear();
      Label1->Caption = "";
      for ( int i = 1; i < 26; i++)
         ListBox1->Items->Add(i);
      fillNum = 1;
      OK1 = OK2 = 0;
      if ( Form1->useSer == 1)
         Form1->ServerSocket1->Socket->Connections[0]->SendText("CloseGame");
      else
         Form1->ClientSocket1->Socket->SendText("CloseGame");
}
//---------------------------------------------------------------------------

