Валерий Алексеевич Жарков

Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 3: Программирование на Visual C# искусственного интеллекта (продолжение 2)


Скачать книгу

(), 10, 80, Color. Black,

      Color. Yellow, messageFont, g);

      break;

      case GameMode.PlayerActive:

      dealerHand. DrawHand (g, 10, 30, 80, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      break;

      case GameMode.PlayerWon:

      case GameMode. PocketJack:

      dealerHand. DrawHand (g, 10, 30, 20, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (dealerHand. BlackJackScoreHand ().

      ToString (), 140, 45, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText («Вы выиграли!»,

      20, 80, Color. Black, Color. Yellow, messageFont, g);

      break;

      case GameMode.PlayerBust:

      dealerHand. DrawHand (g, 10, 30, 80, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText («Вы перебрали.»,

      20, 80, Color. Black, Color.Red, messageFont, g);

      break;

      case GameMode.DealerActive:

      dealerHand. DrawHand (g, 10, 30, 20, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (dealerHand. BlackJackScoreHand ().

      ToString (), 140, 45, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      break;

      case GameMode.DealerWon:

      dealerHand. DrawHand (g, 10, 30, 20, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (dealerHand. BlackJackScoreHand ().

      ToString (), 140, 45, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText («Вы потеряли.»,

      20, 80, Color. Black, Color.Red, messageFont, g);

      break;

      case GameMode.DealerBust:

      dealerHand. DrawHand (g, 10, 30, 20, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (dealerHand. BlackJackScoreHand ().

      ToString (), 140, 45, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText («Dealer Bust»,

      20, 80, Color. Black, Color. Yellow, messageFont, g);

      break;

      case GameMode. Push:

      dealerHand. DrawHand (g, 10, 30, 20, 25);

      playerHand. DrawHand (g, 10, 135, 20, 25);

      Utilities.BigText (dealerHand. BlackJackScoreHand ().

      ToString (), 140, 45, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText (playerHand. BlackJackScoreHand ().

      ToString (), 140, 150, Color. Black,

      Color. Yellow, messageFont, g);

      Utilities.BigText («Вы выиграли.»,

      20, 80, Color. Black, Color. Yellow, messageFont, g);

      break;

      }

      }

      void playerHits ()

      {

      if (playerHand. BlackJackScoreHand () <21)

      {

      playerHand.Add(shoe.DealCard ());

      if (playerHand. BlackJackScoreHand ()> 21)

      {

      //We write in the original:

      pot.DoPlaceBet ();

      pot. HouseWins ();

      showPot ();

      mode = GameMode.PlayerBust;

      }

      this.Invalidate ();

      }

      }

      void playerStays ()

      {

      dealerHoleCard. FaceUp = true;

      mode = GameMode.DealerActive;

      this.Refresh ();

      System.Threading.Thread.Sleep (750);

      while (dealerHand. BlackJackScoreHand () <17)

      {

      dealerHand.Add(shoe.DealCard ());

      this.Refresh ();

      System.Threading.Thread.Sleep (750);

      }

      if (dealerHand. BlackJackScoreHand ()> 21)

      {

      mode = GameMode.DealerBust;

      pot.PlayerWins ();

      showPot ();

      return;

      }

      if (playerHand. BlackJackScoreHand ()>

      dealerHand. BlackJackScoreHand ())

      {

      mode = GameMode.PlayerWon;

      pot.PlayerWins ();

      showPot ();

      return;

      }

      if (playerHand. BlackJackScoreHand () <

      dealerHand. BlackJackScoreHand ())

      {

      mode = GameMode.DealerWon;

      //We write in the original:

      pot.DoPlaceBet ();

      pot. HouseWins ();

      showPot ();

      return;

      }

      if (playerHand. BlackJackScoreHand () ==

      dealerHand. BlackJackScoreHand ())

      {

      mode = GameMode. Push;

      pot.DoPushBet ();

      showPot ();

      return;

      }

      }

      void