ActionRet HoldemTournamentAIManual::checkSteal(const TableTexture& t, bool debug)
{
	ActionRet ret;
	ret.name="checkSteal";
	ret.action=FOLD;
	ret.amt=0;

	profile_line(" -- checkSteal() -- ");

	bool stealpos=(table->getPlayersActive()<=3)&&(table->getPositionAfterActive(getAIPlayer())==0);

	int player1=table->getNextActivePlayer(getAIPlayer());
	double p1perFold=table->getCheckAct(player1,FOLD)/(double)table->getCheckAct(player1);
	if (table->getCheckAct(player1,RAISE)!=0) p1perFold=0;
	if (table->getCheckAct(player1)==0) p1perFold=0;

	int player2=table->getNextActivePlayer(player1);
	double p2perFold=table->getCheckAct(player2,FOLD)/(double)table->getCheckAct(player2);
	if (table->getCheckAct(player2,RAISE)!=0) p2perFold=0;
	if (table->getCheckAct(player2)==0) p2perFold=0;
	if (player2==getAIPlayer()) p2perFold=1;

	bool checksteal=stealpos&&(p1perFold>=.5)&&(p2perFold>=.5)&&t.totalaction==0;

	if (debug) {
		cout << "checksteal: " << checksteal << endl;
		cout << " stealpos: " << stealpos << endl;
		cout << " p1 %fold: " << p1perFold << endl;
		cout << " p1 %fold: " << p2perFold << endl;
		cout << endl;
	}

	if (checksteal) {
		ret.action=BET;
		ret.amt=betPassive();
	}

	return ret;
}