Advertisement
fatalryuu

Untitled

Dec 5th, 2022
790
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 33.84 KB | None | 0 0
  1. void checkHigher() {
  2.     if (isGameWithBot)
  3.         if (highestCards[0] > highestCards[1]) {
  4.             winnerName = "Вы";
  5.             return;
  6.         } else if (highestCards[0] == highestCards[1]) {
  7.             for (int i = 0; i < AMOUNT_OF_HAND_CARDS; i++) {
  8.                 if (playersCards[0][i].value > playersCards[1][i].value) {
  9.                     winnerName = "Вы";
  10.                     return;
  11.                 } else if (playersCards[0][i].value < playersCards[1][i].value) {
  12.                     winnerName = "Бот";
  13.                     return;
  14.                 }
  15.             }
  16.             winnerName = "Отсутствует (Ничья)";
  17.  
  18.         } else {
  19.             winnerName = "Бот";
  20.             return;
  21.         }
  22.     else {
  23.         int maxI = 0;
  24.         int max = highestCards[maxI];
  25.         for (int i = 1; i < amountOfPlayers; i++) {
  26.             if (highestCards[i] > max) {
  27.                 max = highestCards[i];
  28.                 maxI = i;
  29.             } else if (highestCards[i] == max) {
  30.                 for (int j = 0; j < AMOUNT_OF_HAND_CARDS; j++) {
  31.                     if (playersCards[i][j].value > playersCards[maxI][j].value) {
  32.                         max = highestCards[i];
  33.                         maxI = i;
  34.                         break;
  35.                     }
  36.                 }
  37.             }
  38.         }
  39.         winnerName = playersNames[maxI];
  40.         combinationName = combinations[playersCombinations[maxI]];
  41.     }
  42. }
  43.  
  44. //-------------------------Winner Finder-----------------------------------------
  45.  
  46. void insertionSort(Card arr[],const int n) {
  47.     for(int i = 1; i < n; i++) {
  48.         int j = i - 1;
  49.         while(j > -1 && arr[j].value < arr[j + 1].value) {
  50.             swap(arr[j], arr[j + 1]);
  51.             j--;
  52.         }
  53.     }
  54. }
  55.  
  56. void findCombinationForPlayer(Card сards[], int n, int index) {
  57.     Card savedCards[n];
  58.     for (int i = 0; i < n; i++)
  59.         savedCards[i] = сards[i];
  60.  
  61.     if (isRoyalFlush(сards, n, index))
  62.         playersCombinations[index] = 9;
  63.     else if (isStraightFlush(сards, n, index))
  64.         playersCombinations[index] = 8;
  65.     else if (isFour(сards, n, index))
  66.         playersCombinations[index] = 7;
  67.     else if (isFullHouse(сards, n, index))
  68.         playersCombinations[index] = 6;
  69.     else if (isFlush(сards, n, index))
  70.         playersCombinations[index] = 5;
  71.     else if (isStraight(сards, n, index))
  72.         playersCombinations[index] = 4;
  73.     else if (isSet(сards, n, index))
  74.         playersCombinations[index] = 3;
  75.     else if (isTwoPair(сards, n, index))
  76.         playersCombinations[index] = 2;
  77.     else if (isPair(сards, n, index))
  78.         playersCombinations[index] = 1;
  79.     else
  80.         playersCombinations[index] = 0;
  81. }
  82.  
  83. void setVicroryWithBot(Card playerCards[], Card botCards[]) {
  84.     if (playersCombinations[0] > playersCombinations[1]) {
  85.         winnerName = "Вы";
  86.         combinationName = combinations[playersCombinations[0]];
  87.     } else if (playersCombinations[0] == playersCombinations[1]) {
  88.         checkHigher();
  89.         combinationName = combinations[playersCombinations[0]];
  90.     } else {
  91.         winnerName = "Бот";
  92.         combinationName = combinations[playersCombinations[1]];
  93.     }
  94. }
  95.  
  96. void TMainForm::ConfigureChips() {
  97.     if (winnerName == "Вы") {
  98.         playersChips[0] += bank;
  99.         ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  100.     } else if (winnerName == "Бот") {
  101.         playersChips[1] += bank;
  102.         BotChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[1]);
  103.     } else {
  104.         playersChips[0] += bank / 2;
  105.         playersChips[1] += bank / 2;
  106.         ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  107.         BotChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[1]);
  108.     }
  109.     bank = 0;
  110.     BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  111. }
  112.  
  113. void TMainForm::FindWinnerWithBot() {
  114.     Card* playerCards = new Card[AMOUNT_OF_CARDS_FOR_COMBINATION];
  115.     Card* botCards = new Card[AMOUNT_OF_CARDS_FOR_COMBINATION];
  116.  
  117.     for (int i = 0; i < AMOUNT_OF_CARDS_FOR_COMBINATION; i++) {
  118.         if (i < 2) {
  119.             playerCards[i] = playersCards[0][i];
  120.             botCards[i] = playersCards[1][i];
  121.         } else {
  122.             playerCards[i] = tableCards[i - 2];
  123.             botCards[i] = tableCards[i - 2];
  124.         }
  125.     }
  126.  
  127.     insertionSort(playerCards, AMOUNT_OF_CARDS_FOR_COMBINATION);
  128.     insertionSort(botCards, AMOUNT_OF_CARDS_FOR_COMBINATION);
  129.     for (int i = 0; i < amountOfPlayers; i++)
  130.         insertionSort(playersCards[i], 2);
  131.  
  132.     findCombinationForPlayer(playerCards, AMOUNT_OF_CARDS_FOR_COMBINATION, 0);
  133.     findCombinationForPlayer(botCards, AMOUNT_OF_CARDS_FOR_COMBINATION, 1);
  134.  
  135.     setVicroryWithBot(playerCards, botCards);
  136.  
  137.     ConfigureChips();
  138. }
  139.  
  140. //------------------------Game Buttons Methods-----------------------------------
  141.  
  142. void __fastcall TMainForm::FoldBtnClick(TObject *Sender) {
  143.     if (!isGameWithBot)
  144.         ConfigureFoldWithPlayers();
  145.     else
  146.         ConfigureFoldWithBot();
  147. }
  148.  
  149. void __fastcall TMainForm::CallBtnClick(TObject *Sender) {
  150.     if (!isGameWithBot)
  151.         ConfigureCallWithPlayers();
  152.     else
  153.         ConfigureCallWithBot();
  154. }
  155.  
  156. void __fastcall TMainForm::RaiseBtnClick(TObject *Sender) {
  157.     if (!isGameWithBot)
  158.         ConfigureRaiseWithPlayers();
  159.     else
  160.         ConfigureRaiseWithBot();
  161. }
  162.  
  163. void __fastcall TMainForm::HideCardsBtnClick(TObject *Sender) {
  164.     DistributeTableCards();
  165.     ChangePlayers();
  166. }
  167.  
  168. //------------------------Bot Methods-----------------------------------
  169.  
  170. void __fastcall TMainForm::PlayWithBotBtnClick(TObject *Sender) {
  171.     isGameWithBot = true;
  172.     HideMainMenuButtons();
  173.     BotPreparingForm -> ShowModal();
  174.     BackToMenu -> Visible = true;
  175. }
  176.  
  177. void TMainForm::PrepareGameTableWithBot(const int chips) {
  178.     FirstBotCard -> Picture -> LoadFromFile("cards/back_of_card.png");
  179.     SecondBotCard -> Picture -> LoadFromFile("cards/back_of_card.png");
  180.     amountOfChips = chips;
  181.     amountOfPlayers = 2;
  182.     BotPreparingForm -> Close();
  183.     randomize();
  184.     for (int i = 1; i < amountOfPlayers + 1; i++) {
  185.         GiveCardsToPlayer(i);
  186.     }
  187.     GenerateTableCards();
  188.     Background -> Picture -> LoadFromFile("background_game.png");
  189.     FirstHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[0][0].value) + "_of_" + playersCards[0][0].suit + ".png");
  190.     SecondHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[0][1].value) + "_of_" + playersCards[0][1].suit + ".png");
  191.     ShowBotCards();
  192.     ShowHandCards();
  193.     ShowButtons();
  194.     HideCardsBtn -> Visible = false;
  195.     ShowLabels();
  196.     PlayerNameLabel -> Visible = false;
  197.     PrepareChips();
  198.     isFirstGame = false;
  199. }
  200.  
  201. void TMainForm::PrepareNewTableWithBot() {
  202.     FirstBotCard -> Picture -> LoadFromFile("cards/back_of_card.png");
  203.     SecondBotCard -> Picture -> LoadFromFile("cards/back_of_card.png");
  204.     amountOfPlayers = 2;
  205.     randomize();
  206.     isInGame[1] = true;
  207.     for (int i = 1; i < amountOfPlayers + 1; i++) {
  208.         GiveCardsToPlayer(i);
  209.         GenerateTableCards();
  210.     }
  211.     FirstHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[0][0].value) + "_of_" + playersCards[0][0].suit + ".png");
  212.     SecondHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[0][1].value) + "_of_" + playersCards[0][1].suit + ".png");
  213.     NextRoundBtn -> Visible = false;
  214. }
  215.  
  216. void __fastcall TMainForm::NextRoundBtnClick(TObject *Sender) {
  217.     EnableButtons();
  218.     createArrayOfCards();
  219.     if (isGameWithBot)
  220.         PrepareNewTableWithBot();
  221.     else
  222.         PrepareNewTableWithPlayers();
  223.  
  224.     HideCards();
  225.     initFlops();
  226.     changeBlinds();
  227.  
  228.     WinnerLabel -> Visible = false;
  229.     CombinationLabel -> Visible = false;
  230.     ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  231.  
  232.     int minBlind = amountOfChips / DIVIDER_FOR_SMALL_BLIND;
  233.     FirstHandCard -> Visible = true;
  234.     SecondHandCard -> Visible = true;
  235.  
  236.     PrepareChips();
  237.  
  238.     if (isGameWithBot) {
  239.         BotChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[1]);
  240.         FirstBotCard -> Visible = true;
  241.         SecondBotCard -> Visible = true;
  242.     } else {
  243.         hideCardsAndLabelsFormArrays();
  244.         CrownImage -> Visible = false;
  245.     }
  246.  
  247. }
  248.  
  249. void TMainForm::FoldForBot() {
  250.     FirstBotCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[1][0].value) + "_of_" + playersCards[1][0].suit + ".png");
  251.     SecondBotCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[1][1].value) + "_of_" + playersCards[1][1].suit + ".png");
  252.     playersChips[0] += bank;
  253.     ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  254.     bank = 0;
  255.     BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  256.     WinnerLabel -> Visible = true;
  257.     WinnerLabel -> Caption = WINNER_LABEL + "Вы";
  258.     NextRoundBtn -> Visible = true;
  259.     isInGame[1] = false;
  260.     TurnOffButtons();
  261. }
  262.  
  263. void TMainForm::CallForBot() {
  264.     if (bid >= playersChips[1]) {
  265.         FoldForBot();
  266.     } else {
  267.         bank += bid;
  268.         BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  269.         playersChips[1] -= bid;
  270.         BotChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[1]);
  271.         if (bid == 0)
  272.             CallBtn -> Caption = CHECK_CAPTION;
  273.         EnableButtons();
  274.     }
  275.     isRaised = false;
  276.     bid = 0;
  277. }
  278.  
  279. void TMainForm::RaiseForBot(int amount) {
  280.     if (isInAllIn)
  281.         CallForBot();
  282.     else {
  283.         bid = amount;
  284.         bank += bid;
  285.         BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  286.         playersChips[1] -= bid;
  287.         BotChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[1]);
  288.         isRaised = true;
  289.         if (bid >= playersChips[0]) {
  290.             CallBtn -> Caption = ALL_IN_CAPTION;
  291.             bid = playersChips[0];
  292.             isInAllIn = true;
  293.             RaiseBtn -> Enabled = false;
  294.         } else
  295.             CallBtn -> Caption = CALL_CAPTION + IntToStr(bid) + ")";
  296.         isOnceRaised = true;
  297.     }
  298. }
  299.  
  300. //-------------------Analyzation Methods-------------------------------
  301.  
  302. void TMainForm::AnalyzePreFlop() {
  303.     int randomNumber;
  304.     randomize;
  305.     if (isFirstTimeOnThisStage)
  306.         if (!isRaised) { //нет повышения от игрока
  307.             if (playersCards[1][0].value == playersCards[1][1].value && !isOnceRaised) { //если у бота пара
  308.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  309.                 if (randomNumber > 90) { //10% не повысить ставку
  310.                     CallForBot();
  311.                 } else { //90% на большое/небольшое повышение
  312.                     int amount;
  313.                     randomNumber = random(2);
  314.                     if (randomNumber == 0) //рандом много/мало
  315.                         amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  316.                     else
  317.                         amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  318.                     RaiseForBot(amount);
  319.                 }
  320.             } else if (!isOnceRaised) { //блеф
  321.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  322.                 if (randomNumber > 90) { //10% блефануть
  323.                     int amount;
  324.                     randomNumber = random(2);
  325.                     if (randomNumber == 0) //рандом много/мало
  326.                         amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  327.                     else
  328.                         amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  329.                     RaiseForBot(amount);
  330.                 }
  331.             }
  332.         } else if (bid >= playersChips[1] / DIVIDER_FOR_BIG_BID) { //повышение от игрока с большой ставкой
  333.             if (playersCards[1][0].value == playersCards[1][1].value) { //если у бота пара
  334.                 CallForBot();
  335.             } else {
  336.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  337.                 if (randomNumber > 90) //10% блефануть
  338.                     CallForBot();
  339.                 else //90% сбросить
  340.                     FoldForBot();
  341.             }
  342.         } else //небольшая ставка
  343.             CallForBot();
  344.     if (!isRaised) {
  345.         CallBtn -> Caption = CHECK_CAPTION;
  346.         bid = 0;
  347.         isPreFlop = false;
  348.         isFlop = true;
  349.         if (isInGame[1])
  350.             ShowTableCards(3);
  351.     }
  352.     isFirstTimeOnThisStage = false;
  353. }
  354.  
  355. void TMainForm::AnalyzeFlop() {
  356.     const int AMOUNT_OF_SHOWN_CARDS = AMOUNT_OF_HAND_CARDS + 3;
  357.     int randomNumber;
  358.  
  359.     Card botCards[AMOUNT_OF_SHOWN_CARDS];
  360.  
  361.     for (int i = 0; i < AMOUNT_OF_SHOWN_CARDS; i++)
  362.         if (i < 2)
  363.             botCards[i] = playersCards[1][i];
  364.         else
  365.             botCards[i] = tableCards[i - 2];
  366.  
  367.     randomize;
  368.     if (isFirstTimeOnThisStage) {
  369.         findCombinationForPlayer(botCards, AMOUNT_OF_SHOWN_CARDS, 1); //нынешняя комбинация бота
  370.         if (!isRaised) { //нет повышения от игрока
  371.             if (playersCombinations[1] > 1 && !isOnceRaised) { //если у бота уже есть комбинация выше пары
  372.                 int amount;
  373.                 randomNumber = random(2);
  374.                 if (randomNumber == 0) //рандом много/мало
  375.                     amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  376.                 else
  377.                     amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  378.                 RaiseForBot(amount); //повышает
  379.             } else if (!isOnceRaised) { //блеф
  380.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  381.                 if (randomNumber > 90) { //10% блефануть
  382.                     int amount;
  383.                     randomNumber = random(2);
  384.                     if (randomNumber == 0) //рандом много/мало
  385.                         amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  386.                     else
  387.                         amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  388.                     RaiseForBot(amount);
  389.                 }
  390.             }
  391.         } else if (bid >= playersChips[1] / DIVIDER_FOR_BIG_BID) { //повышение от игрока с большой ставкой
  392.             if (playersCombinations[1] > 1) { //если у бота комбинация выше пары
  393.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  394.                 if (randomNumber > 90) { //10% не поддержать ставку
  395.                     FoldForBot();
  396.                 } else { //90% поддержать ставку
  397.                     CallForBot();
  398.                 }
  399.             } else {
  400.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  401.                 if (randomNumber > 80) //20% блефануть
  402.                     CallForBot();
  403.                 else //80% сбросить
  404.                     FoldForBot();
  405.             }
  406.         } else { //небольшая ставка
  407.             if (playersCombinations[1] > 0) { //если у бота пара или выше
  408.                 CallForBot(); //поддерживает
  409.             } else {
  410.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  411.                 if (randomNumber > 50) { //50% не поддержать ставку
  412.                     FoldForBot();
  413.                 } else { //50% поддержать ставку
  414.                     CallForBot();
  415.                 }
  416.             }
  417.  
  418.         }
  419.     }
  420.     if (!isRaised) {
  421.         CallBtn -> Caption = CHECK_CAPTION;
  422.         isFlop = false;
  423.         isTurn = true;
  424.         isOnceRaised = false;
  425.         bid = 0;
  426.         if (isInGame[1]) //если бот не сбросил
  427.             ShowTableCards(4);
  428.     }
  429.     isFirstTimeOnThisStage = false;
  430. }
  431.  
  432. void TMainForm::AnalyzeTurn() {
  433.     const int AMOUNT_OF_SHOWN_CARDS = AMOUNT_OF_HAND_CARDS + 4;
  434.     int randomNumber;
  435.  
  436.     Card botCards[AMOUNT_OF_SHOWN_CARDS];
  437.  
  438.     for (int i = 0; i < AMOUNT_OF_SHOWN_CARDS; i++)
  439.         if (i < 2)
  440.             botCards[i] = playersCards[1][i];
  441.         else
  442.             botCards[i] = tableCards[i - 2];
  443.  
  444.     randomize;
  445.     if (isFirstTimeOnThisStage) {
  446.         findCombinationForPlayer(botCards, AMOUNT_OF_SHOWN_CARDS, 1); //нынешняя комбинация бота
  447.         if (!isRaised) { //нет повышения от игрока
  448.             if (playersCombinations[1] > 3 && !isOnceRaised) { //если у бота комбинация выше сета
  449.                 int amount;
  450.                 randomNumber = random(2);
  451.                 if (randomNumber == 0) //рандом много/мало
  452.                     amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  453.                 else
  454.                     amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  455.                 RaiseForBot(amount); //повышает
  456.             } else if (!isOnceRaised) { //блеф
  457.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  458.                 if (randomNumber > 80) { //20% блефануть
  459.                     int amount;
  460.                     randomNumber = random(2);
  461.                     if (randomNumber == 0) //рандом много/мало
  462.                         amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  463.                     else
  464.                         amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  465.                     RaiseForBot(amount);
  466.                 }
  467.             }
  468.         } else if (bid >= playersChips[1] / DIVIDER_FOR_BIG_BID) { //повышение от игрока с большой ставкой
  469.             if (playersCombinations[1] > 3) { //если у бота комбинация выше сета
  470.                 CallForBot(); //поддерживает
  471.             } else {
  472.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  473.                 if (randomNumber > 70) //30% блефануть
  474.                     CallForBot();
  475.                 else //70% сбросить
  476.                     FoldForBot();
  477.             }
  478.         } else { //небольшая ставка
  479.             if (playersCombinations[1] > 0) { //если у бота пара или выше
  480.                 CallForBot(); //поддерживает
  481.             } else {
  482.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  483.                 if (randomNumber > 50) { //50% не поддержать ставку
  484.                     FoldForBot();
  485.                 } else { //50% поддержать ставку
  486.                     CallForBot();
  487.                 }
  488.             }
  489.         }
  490.     }
  491.     if (!isRaised) {
  492.         CallBtn -> Caption = CHECK_CAPTION;
  493.         isTurn = false;
  494.         isRiver = true;
  495.         isOnceRaised = false;
  496.         bid = 0;
  497.         if (isInGame[1]) //если бот не сбросил
  498.             ShowTableCards(5);
  499.     }
  500.     isFirstTimeOnThisStage = false;
  501. }
  502.  
  503. void TMainForm::AnalyzeRiver() {
  504.     const int AMOUNT_OF_SHOWN_CARDS = AMOUNT_OF_HAND_CARDS + AMOUNT_OF_TABLE_CARDS;
  505.     int randomNumber;
  506.  
  507.     Card botCards[AMOUNT_OF_SHOWN_CARDS];
  508.  
  509.     for (int i = 0; i < AMOUNT_OF_SHOWN_CARDS; i++)
  510.         if (i < 2)
  511.             botCards[i] = playersCards[1][i];
  512.         else
  513.             botCards[i] = tableCards[i - 2];
  514.  
  515.     randomize;
  516.     if (isFirstTimeOnThisStage) {
  517.         findCombinationForPlayer(botCards, AMOUNT_OF_SHOWN_CARDS, 1); //нынешняя комбинация бота
  518.         if (!isRaised) { //нет повышения от игрока
  519.             if (playersCombinations[1] > 4 && !isOnceRaised) { //если у бота комбинация выше стрита
  520.                 int amount;
  521.                 randomNumber = random(3);
  522.                 if (randomNumber == 0) //33.3% на маленькую ставку
  523.                     amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  524.                 else //66.6% на высокую
  525.                     amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  526.                 RaiseForBot(amount); //повышает
  527.             } else if (!isOnceRaised) { //блеф
  528.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  529.                 if (randomNumber > 80) { //20% блефануть
  530.                     int amount;
  531.                     randomNumber = random(3);
  532.                     if (randomNumber > 0) //66.6% на мальнкую ставку
  533.                         amount = playersChips[1] / DIVIDER_FOR_SMALL_BID;
  534.                     else //33.3% на высокую
  535.                         amount = playersChips[1] / DIVIDER_FOR_BIG_BID;
  536.                     RaiseForBot(amount);
  537.                 }
  538.             }
  539.         } else if (bid >= playersChips[1] / DIVIDER_FOR_BIG_BID) { //повышение от игрока с большой ставкой
  540.             if (playersCombinations[1] > 3) { //если у бота комбинация выше сета
  541.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  542.                 if (randomNumber > 90) { //10% не поддержать ставку
  543.                     FoldForBot();
  544.                 } else { //90% поддержать ставку
  545.                     CallForBot();
  546.                 }
  547.             } else {
  548.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  549.                 if (randomNumber > 80) //20% блефануть
  550.                     CallForBot();
  551.                 else //80% сбросить
  552.                     FoldForBot();
  553.             }
  554.         } else { //небольшая ставка
  555.             if (playersCombinations[1] > 0) { //если у бота пара или выше
  556.                 CallForBot(); //поддерживает
  557.             } else {
  558.                 randomNumber = random(MAX_PERCENTAGE) + 1;
  559.                 if (randomNumber > 50) { //50% не поддержать ставку
  560.                     FoldForBot();
  561.                 } else { //50% поддержать ставку
  562.                     CallForBot();
  563.                 }
  564.             }
  565.         }
  566.     }
  567.     if (!isRaised) {
  568.         OpenBotCards();
  569.         FindWinnerWithBot();
  570.         PrintWinner();
  571.         PrintCombination();
  572.         TurnOffButtons();
  573.         NextRoundBtn -> Visible = true;
  574.         if (playersChips[0] == 0 || playersChips[1] == 0) {
  575.             NextRoundBtn -> Visible = false;
  576.             playersChips[0] = amountOfChips;
  577.             playersChips[1] = amountOfChips;
  578.             EndForm -> ShowModal();
  579.         }
  580.     }
  581.     isFirstTimeOnThisStage = false;
  582. }
  583.  
  584. void TMainForm::AnalyzeSituation() {
  585.     if (isPreFlop) {
  586.         AnalyzePreFlop();
  587.         isOnceRaised = false;
  588.     } else if (isFlop) {
  589.         isFirstTimeOnThisStage = true;
  590.         AnalyzeFlop();
  591.     } else if (isTurn) {
  592.         isFirstTimeOnThisStage = true;
  593.         AnalyzeTurn();
  594.     } else if (isRiver) {
  595.         isFirstTimeOnThisStage = true;
  596.         AnalyzeRiver();
  597.     }
  598. }
  599.  
  600. //-------------------------Player Actions With Bot-------------------------------
  601.  
  602. void TMainForm::ConfigureFoldWithBot() {
  603.     FirstBotCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[1][0].value) + "_of_" + playersCards[1][0].suit + ".png");
  604.     SecondBotCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[1][1].value) + "_of_" + playersCards[1][1].suit + ".png");
  605.     playersChips[1] += bank;
  606.     BotChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[1]);
  607.     bank = 0;
  608.     BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  609.     WinnerLabel -> Visible = true;
  610.     WinnerLabel -> Caption = WinnerLabel -> Caption + "Бот";
  611.     NextRoundBtn -> Visible = true;
  612.     TurnOffButtons();
  613. }
  614.  
  615. void TMainForm::ConfigureCallWithBot() {
  616.     bank += bid;
  617.     BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  618.     playersChips[0] -= bid;
  619.     ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  620.     if (isPreFlop)
  621.         bid = 0;
  622.     if (isInAllIn)
  623.         bid = 0;
  624.     isRaised = false;
  625.     AnalyzeSituation();
  626. }
  627.  
  628. void TMainForm::ConfigureRaiseWithBot() {
  629.     if (isShown) {
  630.         bid = ChipsTrackBar -> Position;
  631.         ChipsTrackBar -> Visible = false;
  632.         CurrChipsLabel -> Visible = false;
  633.         CurrChipsLabel -> Caption = SELECTED_LABEL + IntToStr(ChipsTrackBar -> Min);
  634.         ChipsTrackBar -> Position = amountOfChips / DIVIDER_FOR_SMALL_BLIND;
  635.         bank += bid;
  636.         BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  637.         playersChips[0] -= bid;
  638.         ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  639.         RaiseBtn -> Enabled = true;
  640.         isRaised = true;
  641.         isShown = false;
  642.         AnalyzeSituation();
  643.      } else {
  644.         ChipsTrackBar -> Min = amountOfChips / DIVIDER_FOR_SMALL_BLIND * 2 + 1;
  645.         ChipsTrackBar -> Max = playersChips[0];
  646.         ChipsTrackBar -> Visible = true;
  647.         FoldBtn -> Enabled = false;
  648.         CallBtn -> Enabled = false;
  649.         CurrChipsLabel -> Visible = true;
  650.         isShown = true;
  651.      }
  652. }
  653.  
  654. //-------------------------Players Actions-------------------------------
  655.  
  656. void TMainForm::ConfigureFoldWithPlayers() {
  657.     HideCardsBtn -> Enabled = true;
  658.     isInGame[currPlayer] = false;
  659.     TurnOffButtons();
  660.     int winner = checkIfWin();
  661.     if (winner != -1)
  662.         ConfigureWinAfterFold(winner);
  663. }
  664.  
  665. void TMainForm::ConfigureCallWithPlayers() {
  666.     if (playersChips[currPlayer] > bid) {
  667.         playersChips[currPlayer] -= bid;
  668.         bank += bid;
  669.         if (bid == odds)
  670.             bid = savedBid;
  671.     } else {
  672.         bank += playersChips[currPlayer];
  673.         playersChips[currPlayer] = 0;
  674.     }
  675.     BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  676.     ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[currPlayer]);
  677.     TurnOffButtons();
  678.     HideCardsBtn -> Enabled = true;
  679. }
  680.  
  681. void TMainForm::ConfigureRaiseWithPlayers() {
  682.     if (isShown) {
  683.         if (isRaised)
  684.             odds = ChipsTrackBar -> Position - bid;
  685.         bid = ChipsTrackBar -> Position;
  686.         playersChips[currPlayer] -= bid;
  687.         bank += bid;
  688.         ChipsTrackBar -> Visible = false;
  689.         CurrChipsLabel -> Visible = false;
  690.         CurrChipsLabel -> Caption = SELECTED_LABEL + IntToStr(ChipsTrackBar -> Min);
  691.         ChipsTrackBar -> Position = ChipsTrackBar -> Min;
  692.         BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  693.         ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[currPlayer]);
  694.         RaiseBtn -> Enabled = false;
  695.         HideCardsBtn -> Enabled = true;
  696.         if (isRaised) {
  697.             prevPlayerWhoRaised = playerWhoRaised;
  698.         }
  699.         isRaised = true;
  700.         playerWhoRaised = currPlayer;
  701.         isShown = false;
  702.     } else {
  703.         if (isRaised)
  704.             if (bid == odds)
  705.                 ChipsTrackBar -> Min = savedBid + 1;
  706.             else
  707.                 ChipsTrackBar -> Min = bid + 1;
  708.         ChipsTrackBar -> Max = playersChips[currPlayer];
  709.         ChipsTrackBar -> Visible = true;
  710.         FoldBtn -> Enabled = false;
  711.         CallBtn -> Enabled = false;
  712.         CurrChipsLabel -> Visible = true;
  713.         isShown = true;
  714.     }
  715. }
  716.  
  717. //------------------------Players Methods-----------------------------------
  718.  
  719. void __fastcall TMainForm::PlayWithPeopleBtnClick(TObject *Sender) {
  720.     HideMainMenuButtons();
  721.     WelcomeForm -> ShowModal();
  722.     BackToMenu -> Visible = true;
  723. }
  724.  
  725. void TMainForm::PrepareGameTable() {
  726.     amountOfPlayers = StrToInt(WelcomeForm -> PlayersSpinEdit -> Text);
  727.     imagesOfPlayersCards = new TImage*[amountOfPlayers * 2];
  728.     lablesOfPlayersNames = new TLabel*[amountOfPlayers];
  729.     for (int i = 0; i < amountOfPlayers * 2; i++) {
  730.         imagesOfPlayersCards[i] = new TImage(MainForm);
  731.         if (i < amountOfPlayers)
  732.             lablesOfPlayersNames[i] = new TLabel(MainForm);
  733.     }
  734.     randomize();
  735.     for (int i = 1; i < amountOfPlayers + 1; i++) {
  736.         GiveCardsToPlayer(i);
  737.     }
  738.     GenerateTableCards();
  739.     Background -> Picture -> LoadFromFile("background_game.png");
  740.     FirstHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[currPlayer][0].value) + "_of_" + playersCards[currPlayer][0].suit + ".png");
  741.     SecondHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[currPlayer][1].value) + "_of_" + playersCards[currPlayer][1].suit + ".png");
  742.     ShowHandCards();
  743.     ShowButtons();
  744.     ShowLabels();
  745.     BotChipsLabel -> Visible = false;
  746. }
  747.  
  748. void TMainForm::PrepareNewTableWithPlayers() {
  749.     initFlops();
  750.     currPlayer = 0;
  751.     odds = 0;
  752.     isRaised = false;
  753.     isShown = false;
  754.     isOnceRaised = false;
  755.     isFirstGame = false;
  756.     arePlayersCardsShown = true;
  757.     isRoundEnded = false;
  758.     for (int i = 0; i < amountOfPlayers; i++)
  759.         isInGame[i] = true;
  760.     randomize();
  761.     for (int i = 1; i < amountOfPlayers + 1; i++) {
  762.         GiveCardsToPlayer(i);
  763.     }
  764.     GenerateTableCards();
  765.     FirstHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[currPlayer][0].value) + "_of_" + playersCards[currPlayer][0].suit + ".png");
  766.     SecondHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[currPlayer][1].value) + "_of_" + playersCards[currPlayer][1].suit + ".png");
  767.     ShowHandCards();
  768.     ShowButtons();
  769.     ShowLabels();
  770.     HideCardsBtn -> Caption = HIDE_CARDS_STR;
  771.     PlayerNameLabel -> Caption = ACTIVE_LABEL + playersNames[0];
  772.     HideCardsBtn -> Enabled = false;
  773.     BotChipsLabel -> Visible = false;
  774.     NextRoundBtn -> Visible = false;
  775.     ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[0]);
  776. }
  777.  
  778. void TMainForm::WriteDownPlayers() {
  779.     playersNames[0] = WelcomeForm -> Player1Edit -> Text;
  780.     playersNames[1] = WelcomeForm -> Player2Edit -> Text;
  781.     playersNames[2] = WelcomeForm -> Player3Edit -> Text;
  782.     playersNames[3] = WelcomeForm -> Player4Edit -> Text;
  783.     amountOfChips = WelcomeForm -> ChipsSpinEdit -> Value;
  784.     WelcomeForm -> Close();
  785.  
  786.     PlayerNameLabel -> Caption = ACTIVE_LABEL + playersNames[0];
  787.     PrepareChips();
  788. }
  789.  
  790. void TMainForm::ConfigureWinAfterFold(int winner) {
  791.     isRoundEnded = true;
  792.     winnerName = playersNames[winner];
  793.     ConfigureChipsWithPlayers(winner);
  794.     ConfigureGUIForWin(winner);
  795.     PrintWinner();
  796.     HideButtons();
  797.     HideLabels();
  798.     BankLabel -> Visible = true;
  799.     HideCardsBtn -> Visible = false;
  800.     WinnerLabel -> Visible = true;
  801.     NextRoundBtn -> Visible = true;
  802. }
  803.  
  804. bool allWasShown() {
  805.     if (!isRaised) {
  806.         if (currPlayer == amountOfPlayers - 1)
  807.             return true;
  808.     } else {
  809.         int nextPlayer = (currPlayer + 1) % amountOfPlayers;
  810.         if (nextPlayer == playerWhoRaised)
  811.             return true;
  812.     }
  813.  
  814.     return false;
  815. }
  816.  
  817. void TMainForm::InitAllPlayersCardsImages() {
  818.     int j = 0;
  819.     for (int i = 0; i < amountOfPlayers * 2; i++) {
  820.         imagesOfPlayersCards[i] -> Parent = MainForm;
  821.         imagesOfPlayersCards[i] -> Visible = true;
  822.         imagesOfPlayersCards[i] -> Left = FIRST_CARD_LEFT;
  823.         if (i % 2 == 0 && i != 0)
  824.             imagesOfPlayersCards[i] -> Left = imagesOfPlayersCards[i - 1] -> Left + NEW_PAIR_LEFT_ITERATOR;
  825.         else if (i != 0)
  826.             imagesOfPlayersCards[i] -> Left = imagesOfPlayersCards[i - 1] -> Left + SECOND_CARD_LEFT_ITERATOR;
  827.  
  828.         imagesOfPlayersCards[i] -> Top = CARDS_TOP;
  829.         imagesOfPlayersCards[i] -> AutoSize = true;
  830.         imagesOfPlayersCards[i] -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[j][i % 2].value) + "_of_" + playersCards[j][i % 2].suit + ".png");
  831.         imagesOfPlayersCards[i] -> SendToBack();
  832.         if (i % 2 != 0) {
  833.             imagesOfPlayersCards[i] -> BringToFront();
  834.             j++;
  835.         }
  836.     }
  837. }
  838.  
  839. void TMainForm::InitAllPlayersNamesLabels() {
  840.     for (int i = 0; i < amountOfPlayers; i++) {
  841.         lablesOfPlayersNames[i] -> Parent = MainForm;
  842.         lablesOfPlayersNames[i] -> Visible = true;
  843.         lablesOfPlayersNames[i] -> AutoSize = true;
  844.         if (isInGame[i])
  845.             lablesOfPlayersNames[i] -> Caption = playersNames[i];
  846.         else
  847.             lablesOfPlayersNames[i] -> Caption = playersNames[i] + FOLDED_CAPTION;
  848.         lablesOfPlayersNames[i] -> Left = FIRST_NAMELABEL_LEFT + (PAIR_OF_CARDS_WIDTH - lablesOfPlayersNames[i] -> Width) / 2 + 392 * i;
  849.         lablesOfPlayersNames[i] -> Top = NAMELABEL_TOP;
  850.         lablesOfPlayersNames[i] -> Font -> Size = FONT_SIZE_FOR_NAMELABEL;
  851.         lablesOfPlayersNames[i] -> Font -> Color = clYellow;
  852.     }
  853. }
  854.  
  855. void TMainForm::ConfigureGUIForWin(int i) {
  856.     InitAllPlayersCardsImages();
  857.     InitAllPlayersNamesLabels();
  858.     Background -> SendToBack();
  859.     CrownImage -> BringToFront();
  860.     CrownImage -> Visible = true;
  861.     CrownImage -> Picture -> LoadFromFile("crown.png");
  862.     FirstHandCard -> Visible = false;
  863.     SecondHandCard -> Visible = false;
  864.     lablesOfPlayersNames[i] -> Visible = false;
  865.     CrownImage -> Left = FISRT_CROWN_LEFT + NEXT_CROWN_LEFT * i;
  866.     CrownImage -> Top = CROWN_TOP;
  867. }
  868.  
  869. void TMainForm::СheckGameStage() {
  870.     if (isPreFlop && allWasShown()) {
  871.         isPreFlop = false;
  872.         isFlop = true;
  873.         bid = 0;
  874.         CallBtn -> Caption = CHECK_CAPTION;
  875.     } else if (isFlop && allWasShown()) {
  876.         isFlop = false;
  877.         isTurn = true;
  878.         bid = 0;
  879.         CallBtn -> Caption = CHECK_CAPTION;
  880.     } else if (isTurn && allWasShown()) {
  881.         isTurn = false;
  882.         isRiver = true;
  883.         bid = 0;
  884.         CallBtn -> Caption = CHECK_CAPTION;
  885.     } else if (isRiver && allWasShown()) {
  886.         isRoundEnded = true;
  887.         int i = FindWinnerWithPlayers();
  888.         ConfigureGUIForWin(i);
  889.         PrintWinner();
  890.         PrintCombination();
  891.         for (int j = 0; j < amountOfPlayers; j++) {
  892.             if (playersChips[j] == 0) {
  893.                 EndForm -> ShowModal();
  894.                 break;
  895.             }
  896.         }
  897.     }
  898. }
  899.  
  900. int findIndexOfMax() {
  901.     int maxI = 0;
  902.     int maxCombination = playersCombinations[maxI];
  903.     for (int i = 1; i < MAX_AMOUNT_OF_PLAYERS; i++) {
  904.         if (playersCombinations[i] > maxCombination) {
  905.             maxI = i;
  906.             maxCombination = playersCombinations[i];
  907.         } else if (playersCombinations[i] == maxCombination) {
  908.             checkHigher();
  909.         }
  910.     }
  911.  
  912.     return maxI;
  913. }
  914.  
  915. int setVicroryWithPlayers(Card** cards) {
  916.     int i = findIndexOfMax();
  917.     winnerName = playersNames[i];
  918.     combinationName = combinations[playersCombinations[i]];
  919.     return i;
  920. }
  921.  
  922. void TMainForm::ConfigureGUIWhileChanging(const int situation) {
  923.     if (situation == 1) {
  924.         FirstHandCard -> Picture -> LoadFromFile("cards/back_of_card.png");
  925.         SecondHandCard -> Picture -> LoadFromFile("cards/back_of_card.png");
  926.         HideCardsBtn -> Caption = SHOW_CARDS_STR;
  927.         int nextPlayer = (currPlayer + 1) % amountOfPlayers;
  928.         if (isInGame[nextPlayer]) {
  929.             if (isRaised && nextPlayer == playerWhoRaised)
  930.                 PlayerNameLabel -> Caption = PREPARING_LABEL + playersNames[0];
  931.             else
  932.                 PlayerNameLabel -> Caption = PREPARING_LABEL + playersNames[nextPlayer];
  933.             СheckGameStage();
  934.         } else {
  935.             СheckGameStage();
  936.             currPlayer = (currPlayer + 1) % amountOfPlayers;
  937.             ConfigureGUIWhileChanging(situation);
  938.             return;
  939.         }
  940.         HideButtons();
  941.         if (!isRiver)
  942.             HideLabels();
  943.         BankLabel -> Visible = true;
  944.         PlayerNameLabel -> Visible = true;
  945.         HideCardsBtn -> Visible = true;
  946.         FoldBtn -> Enabled = true;
  947.         if (isRiver && allWasShown() && isRoundEnded) {
  948.             PlayerNameLabel -> Visible = false;
  949.             ChipsLabel -> Visible = false;
  950.             NextRoundBtn -> Visible = true;
  951.             HideCardsBtn -> Visible = false;
  952.         }
  953.     } else if (situation == 2) {
  954.         FirstHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[currPlayer][0].value) + "_of_" + playersCards[currPlayer][0].suit + ".png");
  955.         SecondHandCard -> Picture -> LoadFromFile("cards/" + IntToStr(playersCards[currPlayer][1].value) + "_of_" + playersCards[currPlayer][1].suit + ".png");
  956.         HideCardsBtn -> Caption = HIDE_CARDS_STR;
  957.         HideCardsBtn -> Enabled = false;
  958.         PlayerNameLabel -> Caption = ACTIVE_LABEL + playersNames[currPlayer];
  959.         ChipsLabel -> Caption = CHIPS_LABEL + IntToStr(playersChips[currPlayer]);
  960.         if (bid >= playersChips[currPlayer] && bid != 0)
  961.             CallBtn -> Caption = ALL_IN_CAPTION;
  962.         ShowButtons();
  963.         EnableButtons();
  964.         ShowLabels();
  965.     }
  966. }
  967.  
  968. void TMainForm::ConfigureRaisingAndCalling() {
  969.     if (isRaised) {
  970.         if (currPlayer == playerWhoRaised) {
  971.             currPlayer = 0;
  972.             bid = 0;
  973.             isRaised = false;
  974.         } else {
  975.             if (odds != 0) { //если было переповышение
  976.                 savedBid = bid;
  977.                 if ((prevPlayerWhoRaised + 1) % amountOfPlayers == playerWhoRaised) { //если переповышение было сразу
  978.                     if (currPlayer == prevPlayerWhoRaised) {
  979.                         bid = odds;
  980.                     }
  981.                 } else { //не сразу
  982.                     if (currPlayer != playerWhoRaised) {
  983.                         bid = odds;
  984.                     }
  985.                 }
  986.             }
  987.             CallBtn -> Caption = CALL_CAPTION + IntToStr(bid) + ")";
  988.         }
  989.     } else {
  990.         if (isPreFlop) {
  991.             if (currPlayer == smallBlind) {
  992.                 bid = amountOfChips / DIVIDER_FOR_SMALL_BLIND;
  993.                 CallBtn -> Caption = CALL_CAPTION + IntToStr(bid) + ")";
  994.             } else if (currPlayer == bigBlind) {
  995.                 bid = 0;
  996.                 CallBtn -> Caption = CHECK_CAPTION;
  997.             } else {
  998.                 bid = amountOfChips / DIVIDER_FOR_SMALL_BLIND * 2;
  999.                 CallBtn -> Caption = CALL_CAPTION + IntToStr(bid) + ")";
  1000.             }
  1001.         }
  1002.     }
  1003. }
  1004.  
  1005. void TMainForm::ChangePlayers() {
  1006.     if (arePlayersCardsShown) {
  1007.         ConfigureGUIWhileChanging(1);
  1008.         arePlayersCardsShown = false;
  1009.     } else {
  1010.         currPlayer = (currPlayer + 1) % amountOfPlayers;
  1011.         ConfigureRaisingAndCalling();
  1012.         ConfigureGUIWhileChanging(2);
  1013.         arePlayersCardsShown = true;
  1014.     }
  1015. }
  1016.  
  1017. void TMainForm::ConfigureChipsWithPlayers(int i) {
  1018.     playersChips[i] += bank;
  1019.     bank = 0;
  1020.     BankLabel -> Caption = BANK_LABEL + IntToStr(bank);
  1021. }
  1022.  
  1023. int TMainForm::FindWinnerWithPlayers() {
  1024.     int challengers = 0;
  1025.     for (int i = 0; i < amountOfPlayers; i++) {
  1026.         if (isInGame[i])
  1027.             challengers++;
  1028.     }
  1029.  
  1030.     Card** challengersCards = new Card*[MAX_AMOUNT_OF_PLAYERS];
  1031.     for (int i = 0; i < MAX_AMOUNT_OF_PLAYERS; i++)
  1032.         challengersCards[i] = new Card[AMOUNT_OF_CARDS_FOR_COMBINATION];
  1033.  
  1034.     for (int i = 0; i < amountOfPlayers; i++)
  1035.         if (isInGame[i])
  1036.             for (int j = 0; j < AMOUNT_OF_CARDS_FOR_COMBINATION; j++)
  1037.                 if (j < 2)
  1038.                     challengersCards[i][j] = playersCards[i][j];
  1039.                 else
  1040.                     challengersCards[i][j] = tableCards[j - 2];
  1041.  
  1042.  
  1043.     for (int i = 0; i < MAX_AMOUNT_OF_PLAYERS; i++)
  1044.         insertionSort(challengersCards[i], AMOUNT_OF_CARDS_FOR_COMBINATION);
  1045.  
  1046.     for (int i = 0; i < amountOfPlayers; i++)
  1047.         if (isInGame[i])
  1048.             findCombinationForPlayer(challengersCards[i], AMOUNT_OF_CARDS_FOR_COMBINATION, i);
  1049.  
  1050.     int i = setVicroryWithPlayers(challengersCards);
  1051.  
  1052.     ConfigureChipsWithPlayers(i);
  1053.  
  1054.     return i;
  1055. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement