ActionRet HoldemTournamentAIManual::pfLimp(const TableTexture& t, bool debug)
{
	ActionRet ret;
	ret.name="pfLimp";
	ret.action=FOLD;
	ret.amt=0;
	
	profile_line(" -- pfLimp() -- ");
	string debugstr="";
	PokerHand h=table->getHand();

	bool limp=false;
	int relStack=table->getStack(getAIPlayer())/double(table->getCostToCall());

	// NOTE: relStack<20 designed to keep PokerPirate out of the game in the early stages of the tournament
	if (relStack<20&&h[0].GetSuit()==h[1].GetSuit()) {
		debugstr=" [s] ";
		//limp=true;
	}
	if (relStack<20&&abs(h[0].GetRank()-h[1].GetRank())==1) {
		debugstr=" [c] ";
		//limp=true;
	}
	if (abs(h[0].GetRank()-h[1].GetRank())==1&&h[0].GetSuit()==h[1].GetSuit()) {
		debugstr=" [sc] ";
		if (h[0].GetIndex()=='A'||h[0].GetIndex()=='K') {
			limp=false; // should limp half the time with KQs (if 1st card king, don't limp; if 2nd king, limp) never with AKs (first card guaranteed to be 'A' or 'K')
		}
		else {
			limp=true;
		}
	}
	if (relStack<20&&h[0].GetRank()==h[1].GetRank()&&h[1].GetRank()<9) {
		debugstr=" [p] ";
		limp=true;
	}

	if (getTableHandedness()<2) limp=false;
	if (t.desperate||t.uberDesperate||t.medAgg||t.uberAgg||table->getBB()>=80) {
		limp=false;
	}

	if (debug) {
		cout << "limp:  " << limp  << endl;
		cout << " handedness: " << getTableHandedness() << endl;
		cout << " stack/cost2call: " << table->getStack(getAIPlayer())/double(table->getCostToCall()) << debugstr << endl;
		cout << endl;
	}

	if (limp) {
		ret.action=CALL;
		ret.amt=table->getCostToCall(getAIPlayer());
	}

	return ret;
}