<commit_before>/***************************************************************************
 *   Copyright (C) 2006 by <NAME>   *
 *   <EMAIL>   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "localhand.h"
#include <game_defs.h>

using namespace std;

LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g),  myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
{

	int i, j, k;
	lastPlayersTurn = 0;

	CardsValue myCardsValue;

	myGui->setHand(this);
	myBoard->setHand(this);


	for(i=0; i<startQuantityPlayers; i++) {
		if(playerArray[i]->getMyActiveStatus() != 0) {
			playerArray[i]->setHand(this);
		}
	}


	// roundStartCashArray fllen
	for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
		playerArray[i]->setMyRoundStartCash(playerArray[i]->getMyCash());
	}
		

	// Dealer, SB, BB bestimmen
	assignButtons();

// 	myGui->refreshAll();

	// Karten generieren und Board sowie Player zuweisen
	Tools myTool;
	int *cardsArray = new int[2*actualQuantityPlayers+5];
	myTool.getRandNumber(0, 51, 2*actualQuantityPlayers+5, cardsArray, 1);
	int tempBoardArray[5];
	int tempPlayerArray[2];
	int tempPlayerAndBoardArray[7];
	int sBluff;
	for(i=0; i<5; i++) {
		tempBoardArray[i] = cardsArray[i];
		tempPlayerAndBoardArray[i+2] = cardsArray[i];
	}


	k = 0;
	myBoard->setMyCards(tempBoardArray);
	for(i=0; i<startQuantityPlayers; i++) {
		if(playerArray[i]->getMyActiveStatus() != 0) {
			for(j=0; j<2; j++) {
				tempPlayerArray[j] = cardsArray[2*k+j+5];
				tempPlayerAndBoardArray[j] = cardsArray[2*k+j+5];
			}
			playerArray[i]->setMyCards(tempPlayerArray);
			playerArray[i]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[i]->getMyBestHandPosition()));

			// myBestHandPosition auf Fehler ueberpruefen
			for(j=0; j<5; j++) {
				if((playerArray[i]->getMyBestHandPosition())[j] == -1) {
					cout << "ERROR get myBestHandPosition in localhand.cpp" << endl;
				}
			}

			// sBluff für alle aktiver Spieler außer human player setzen
			if(i) {
				myTool.getRandNumber(1,100,1,&sBluff,0);
				playerArray[i]->setSBluff(sBluff);
				playerArray[i]->setSBluffStatus(0);
			}

			k++;
		}
	}

	// Karten austeilen
	myGui->dealHoleCards();
	
	// myFlipCards auf 0 setzen
	for(i=0; i<startQuantityPlayers; i++) {
		playerArray[i]->setMyCardsFlip(0);
	}
<commit_msg>bugfix PositionArray<commit_after>/***************************************************************************
 *   Copyright (C) 2006 by <NAME>   *
 *   <EMAIL>   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#include "localhand.h"
#include <game_defs.h>

using namespace std;

LocalHand::LocalHand(EngineFactory *f, GuiInterface *g, BoardInterface *b, PlayerInterface **p, int id, int sP, int aP, int dP, int sB,int sC) : HandInterface(), myFactory(f), myGui(g),  myBoard(b), playerArray(p), myPreflop(0), myFlop(0), myTurn(0), myRiver(0), myID(id), actualQuantityPlayers(aP), startQuantityPlayers(sP), dealerPosition(dP), actualRound(0), smallBlind(sB), startCash(sC), allInCondition(0), bettingRoundsPlayed(0)
{

	int i, j, k;
	lastPlayersTurn = 0;

	CardsValue myCardsValue;

	myGui->setHand(this);
	myBoard->setHand(this);


	for(i=0; i<startQuantityPlayers; i++) {
		if(playerArray[i]->getMyActiveStatus() != 0) {
			playerArray[i]->setHand(this);
		}
	}


	// roundStartCashArray fllen
	for(i=0; i<MAX_NUMBER_OF_PLAYERS; i++) {
		playerArray[i]->setMyRoundStartCash(playerArray[i]->getMyCash());
	}
		

	// Dealer, SB, BB bestimmen
	assignButtons();

// 	myGui->refreshAll();

	// Karten generieren und Board sowie Player zuweisen
	Tools myTool;
	int *cardsArray = new int[2*actualQuantityPlayers+5];
	myTool.getRandNumber(0, 51, 2*actualQuantityPlayers+5, cardsArray, 1);
	int tempBoardArray[5];
	int tempPlayerArray[2];
	int tempPlayerAndBoardArray[7];
	int sBluff;
	for(i=0; i<5; i++) {
		tempBoardArray[i] = cardsArray[i];
		tempPlayerAndBoardArray[i+2] = cardsArray[i];
	}


	k = 0;
	myBoard->setMyCards(tempBoardArray);
	for(i=0; i<startQuantityPlayers; i++) {
		if(playerArray[i]->getMyActiveStatus() != 0) {
			for(j=0; j<2; j++) {
				tempPlayerArray[j] = cardsArray[2*k+j+5];
				tempPlayerAndBoardArray[j] = cardsArray[2*k+j+5];
			}
			playerArray[i]->setMyCards(tempPlayerArray);
			playerArray[i]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[i]->getMyBestHandPosition()));

			// myBestHandPosition auf Fehler ueberpruefen
			for(j=0; j<5; j++) {
				if((playerArray[i]->getMyBestHandPosition())[j] == -1) {
					cout << "ERROR get myBestHandPosition in localhand.cpp" << endl;
				}
			}

			// sBluff für alle aktiver Spieler außer human player setzen
			if(i) {
				myTool.getRandNumber(1,100,1,&sBluff,0);
				playerArray[i]->setSBluff(sBluff);
				playerArray[i]->setSBluffStatus(0);
			}

			k++;
		}
	}

// // 	// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!   testing !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! //

// // 	int *temp5Array;
// // 
// // 	tempBoardArray[0] = 2;
// // 	tempBoardArray[1] = 15;
// // 	tempBoardArray[2] = 4;
// // 	tempBoardArray[3] = 28;
// // 	tempBoardArray[4] = 17;
// // 
// // 	myBoard->setMyCards(tempBoardArray);
// // 
// // 	tempPlayerAndBoardArray[2] = 2;
// // 	tempPlayerAndBoardArray[3] = 15;
// // 	tempPlayerAndBoardArray[4] = 4;
// // 	tempPlayerAndBoardArray[5] = 28;
// // 	tempPlayerAndBoardArray[6] = 17;
// // 
// // 	tempPlayerArray[0] = 0;
// // 	tempPlayerArray[1] = 5;
// // 	tempPlayerAndBoardArray[0] = 0;
// // 	tempPlayerAndBoardArray[1] = 5;
// // 
// // 	playerArray[0]->setMyCards(tempPlayerArray);
// // 	playerArray[0]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[0]->getMyBestHandPosition()));
// // 
// // 	temp5Array = playerArray[0]->getMyBestHandPosition();
// // 
// // 	for(i=0; i<5; i++) {
// // 		cout << temp5Array[i] << " ";
// // 	}
// // 	cout << endl;
// // 
// // 	tempPlayerArray[0] = 12;
// // 	tempPlayerArray[1] = 24;
// // 	tempPlayerAndBoardArray[0] = 12;
// // 	tempPlayerAndBoardArray[1] = 24;
// // 
// // 	playerArray[1]->setMyCards(tempPlayerArray);
// // 	playerArray[1]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[1]->getMyBestHandPosition()));
// // 
// // 	tempPlayerArray[0] = 25;
// // 	tempPlayerArray[1] = 35;
// // 	tempPlayerAndBoardArray[0] = 25;
// // 	tempPlayerAndBoardArray[1] = 35;
// // 
// // 	playerArray[2]->setMyCards(tempPlayerArray);
// // 	playerArray[2]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[2]->getMyBestHandPosition()));
// // 
// // 	tempPlayerArray[0] = 51;
// // 	tempPlayerArray[1] = 33;
// // 	tempPlayerAndBoardArray[0] = 25;
// // 	tempPlayerAndBoardArray[1] = 35;
// // 
// // 	playerArray[3]->setMyCards(tempPlayerArray);
// // 	playerArray[3]->setMyCardsValueInt(myCardsValue.cardsValue(tempPlayerAndBoardArray,playerArray[3]->getMyBestHandPosition()));


// // // 	seven-two, the others have Ace-King, Ace-Jack, Ace-Nine. The pot is obviously split. 






	/////////////////////

	// Karten austeilen
	myGui->dealHoleCards();
	
	// myFlipCards auf 0 setzen
	for(i=0; i<startQuantityPlayers; i++) {
		playerArray[i]->setMyCardsFlip(0);
	}

{'fraction_non_alphanumeric': 0.18160521491138726, 'fraction_numerical': 0.022407822367080873, 'mean_word_length': 2.840046929996089, 'pattern_counts': {'":': 0, '<': 38, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '234025', 'n_tokens_mistral': 3539, 'n_tokens_neox': 3218, 'n_words': 652}