当前位置: 首页>>代码示例>>C++>>正文


C++ Hand::evaluate方法代码示例

本文整理汇总了C++中Hand::evaluate方法的典型用法代码示例。如果您正苦于以下问题:C++ Hand::evaluate方法的具体用法?C++ Hand::evaluate怎么用?C++ Hand::evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Hand的用法示例。


在下文中一共展示了Hand::evaluate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateBet

Bet ComputerPlayer::calculateBet(SmallDeck comm, int minBet, GameState state) {

	srand((unsigned) time(0));
	ifstream inputFile;
	inputFile.open("PocketRanking.txt");
	char temp[4];
	int rank;
	int card1;
	int card2;
	int suited;
	int cardsuits;
	int ComputerRank;

	Card temp1;
	Card temp2;
	Card temp3;
	Hand Current;
	SmallDeck d = *pocket;

	if (!comm.isEmpty()) {
		Current.evaluate(d, comm);
	}
	temp1 | d.getCard(0);
	temp2 | d.getCard(1);

	if (temp1.getSuit() == temp2.getSuit()) {
		cardsuits = 1;
	} else {
		cardsuits = 0;
	}
	if (temp2.getValue() > temp1.getValue()) {
		temp3 | temp1;
		temp1 | temp2;
		temp2 | temp3;
	}

	for (int i = 0; i < 169; i++) {

		inputFile.getline(temp, 4, '	');
		inputFile >> temp;
		rank = atoi(temp);

		inputFile.getline(temp, 4, '	');
		inputFile >> temp;
		card1 = atoi(temp);

		inputFile.getline(temp, 4, '	');
		inputFile >> temp;
		card2 = atoi(temp);

		inputFile.getline(temp, 4, '	');
		inputFile >> temp;
		suited = atoi(temp);

		if (card1 == temp1.getValue() && card2 == temp2.getValue()
				&& suited == cardsuits)
			ComputerRank = rank;

	}

	int PC; //PocketConfidence
	int FP; //Flop Confidence
	if (ComputerRank <= 169 && ComputerRank >= 120)
		PC = 0;
	else if (ComputerRank <= 119 && ComputerRank >= 80)
		PC = 1;
	else if (ComputerRank <= 79 && ComputerRank >= 30)
		PC = 2;
	else if (ComputerRank <= 29 && ComputerRank >= 20)
		PC = 3;
	else if (ComputerRank <= 19 && ComputerRank >= 10)
		PC = 4;
	else if (ComputerRank <= 9 && ComputerRank >= 1)
		PC = 5;

	BetAction betAct = CALL;
	int betAmt = 0;
	int percent = rand() % 10;
	if (state == NEWROUND) {

		switch (PC) {
		case 0: {
			if (percent < 5) {
				if (minBet == 0) {
					betAct = CALL;
					betAmt = 0;
				} else {
					betAct = FOLD;
					betAmt = 0;
				}
				break;
			} else {
				betAct = CALL;
				betAmt = minBet;
			}
			break;
		}
		case 1: {
			if (percent < 3) {
				if (minBet == 0) {
//.........这里部分代码省略.........
开发者ID:bcspragu,项目名称:Casino,代码行数:101,代码来源:ComputerPlayer.cpp


注:本文中的Hand::evaluate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。