bool CSymbolEngineChecksBetsFolds::EvaluateSymbol(const CString name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "nopponents", 10)==0) {
		if (memcmp(name, "nopponentschecking", 18)==0 && strlen(name)==18) {
			*result = nopponentschecking();
		}	else if (memcmp(name, "nopponentsbetting", 17)==0 && strlen(name)==17) {
			*result = nopponentsbetting();
		}	else if (memcmp(name, "nopponentsfolded", 16)==0 && strlen(name)==16)	{
			*result = nopponentsfolded();
		}	else {
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	if (memcmp(name, "nplayerscallshort", 17)==0 && strlen(name)==17)	{
		*result = nplayerscallshort();
	}	else if (memcmp(name, "foldbits", 8)==0 && strlen(name)==9) {
		*result = foldbits(name[8]-'0');
  }	else {
		// Symbol of a different symbol-engine
		return false;
	}
	// Valid symbol
	return true;
}
bool CSymbolEngineRandom::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "random", 6) == 0)
	{
		if (memcmp(name, "randomheartbeat", 15)==0 && strlen(name)==15)
		{
			*result = randomheartbeat();
		}
		else if (memcmp(name, "randomhand", 10)==0 && strlen(name)==10)
		{
			*result = randomhand();
		}
		else if (memcmp(name, "randomround", 11)==0 && strlen(name)==11)
		{
			*result = randomround();
		}
		else if (memcmp(name, "random", 6) == 0 && strlen(name)==6)
		{
			*result = random();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineBlinds::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "nopponentsblind", 15)==0 && strlen(name)==15)
	{
		*result = nopponentsblind();
	}
	else if (memcmp(name, "nplayersblind", 13)==0 && strlen(name)==13)	
	{
		*result = nplayersblind();
	}
	else if (memcmp(name, "playersblindbits", 16)==0 && strlen(name)==16)	
	{
		*result = playersblindbits();
	}
	else if (memcmp(name, "opponentsblindbits", 18)==0 && strlen(name)==18)	
	{
		*result = opponentsblindbits();
	}
	else if (memcmp(name, "bblindbits", 10)==0 && strlen(name)==10)  	
	{
		*result = bblindbits();
	}
	else
	{
		// Invalid symbol
		return false;
	}
	// Valid symbol
	return true;
}
bool CSymbolEngineMemorySymbols::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  // memory-commands
  // "name" = query
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  if (memcmp(name, "me_", 3) == 0) {
    write_log(preferences.debug_memorysymbols(), 
      "[CSymbolEngineMemorySymbols] EvaluateSymbol(%s)\n", name);
    if (memcmp(name, "me_st_", 6) == 0) {  
      Store(name);
      *result = kUndefinedZero;
      return true;
    } else if (memcmp(name, "me_re_", 6) == 0) {
      *result = Recall(name);
      return true;
    } else if (memcmp(name, "me_inc_", 7) == 0) {
      Increment(name);
      *result = kUndefinedZero;
      return true;
    } else {
    // Looks like a memory-command, but is invalid
    return false;
    }
  }
  // Not a memory symbol
  return false;
}
bool CSymbolEngineTableLimits::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "bet", 3)==0)	{
		if (memcmp(name, "bet", 3)==0 && strlen(name)==3) {
			*result = bet();
      return true;
		}	else if (memcmp(name, "bet", 3)==0 && strlen(name)==4) {
      char betround = name[3];
      if ((betround >= '1') && (betround <= '4')) {
			  *result = bet(name[3]-'0');
        return true;
      }
		}
    // Invalid symbol
		return false;
	}
	if (memcmp(name, "bblind", 6)==0 && strlen(name)==6) {
		*result = bblind();
	}	else if (memcmp(name, "sblind", 6)==0 && strlen(name)==6)	{
		*result = sblind();
	}	else if (memcmp(name, "ante", 4)==0 && strlen(name)==4)	{
		*result = ante();
	}	else if (memcmp(name, "buyin", 5)==0 && strlen(name)==5) {
		*result = buyin();
  }	else {
		// Symbol of a different symbol-engine
		return false;
	}
	// Valid symbol
	return true;
}
bool CSymbolEngineIsTournament::EvaluateSymbol(const char *name, double *result, bool log /* = false */) { 
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  if (memcmp(name, "is", 2)!=0)  {
    // Symbol of a different symbol-engine
    return false;
  }
	if (memcmp(name, "istournament", 12)==0 && strlen(name)==12) {
		*result = istournament();
		// Valid symbol
		return true;
	}
  if (memcmp(name, "issng", 5)==0 && strlen(name)==5) {
		*result = IsSNG();
		// Valid symbol
		return true;
	}
  if (memcmp(name, "ismtt", 5)==0 && strlen(name)==5) {
		*result = IsMTT();
		// Valid symbol
		return true;
	}
  if (memcmp(name, "isdon", 5)==0 && strlen(name)==5) {
		*result = IsDON();
		// Valid symbol
		return true;
	}

	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineChipAmounts::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "pot", 3)==0) {
		// CHIP AMOUNTS 1(2)
		if (memcmp(name, "pot", 3)==0 && strlen(name)==3)	{
			*result = pot();
		}	else if (memcmp(name, "potcommon", 9)==0 && strlen(name)==9) {
			*result = potcommon();
		}	else if (memcmp(name, "potplayer", 9)==0 && strlen(name)==9) {
			*result = potplayer();
		}	else {
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}	else if (memcmp(name, "balance", 7)==0)	{
		if (memcmp(name, "balance", 7)==0 && strlen(name)==7)	{
			*result = p_table_state->User()->_balance; 
		}	else if (memcmp(name, "balance", 7)==0 && strlen(name)==8) {
			*result = p_table_state->_players[name[7]-'0']._balance;
		}	else if (memcmp(name, "balanceatstartofsession", 23)==0 && strlen(name)==23) {
			*result = balanceatstartofsession();
		} else if (memcmp(name, "balance_rank", 12)==0 && strlen(name)==13) {
      *result = SortedBalance(name[12]-'0');
    }	else {
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	if (memcmp(name, "maxbalance", 10)==0 && strlen(name)==10) {
		*result = maxbalance();
	}	else if (memcmp(name, "stack", 5)==0 && strlen(name)==6) {
		*result = stack(name[5]-'0');
	}	else if (memcmp(name, "currentbet", 10)==0 && strlen(name)==10)	{
		*result = currentbet(p_symbol_engine_userchair->userchair());
	}	else if (memcmp(name, "currentbet", 10)==0 && strlen(name)==11)	{
		*result = currentbet(name[10]-'0');
	}	else if (memcmp(name, "call", 4)==0 && strlen(name)==4)	{
		*result = call();
	}	else if (memcmp(name, "nbetstocall", 11)==0 && strlen(name)==11) {
		*result = nbetstocall();
	}	else if (memcmp(name, "nbetstorais", 11)==0 && strlen(name)==11) {
		*result = nbetstorais();
	}	else if (memcmp(name, "ncurrentbets", 12)==0 && strlen(name)==12)	{
		*result = ncurrentbets();
	}	else if (memcmp(name, "ncallbets", 9)==0 && strlen(name)==9) {
		*result = ncallbets();
	}	else if (memcmp(name, "nraisbets", 9)==0 && strlen(name)==9) {
		*result = nraisbets();
	}	else {
		// Symbol of a different symbol-engine
		return false;
	}
	// Valid symbol
	return true;
}
bool CSymbolEngineVariousDataLookup::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  // DLL
  if (memcmp(name, "dll$", 4) == 0) {
    assert(p_dll_extension != NULL);
    if (p_dll_extension->IsLoaded()) {
	    *result = ProcessQuery(name);
    } else {
	    *result = kUndefinedZero;
    }
  }
  // Various symbols below
  // without any optimized lookup.
  //ROUND&POSITIONS
  else if (memcmp(name, "betround", 8)==0 && strlen(name)==8)	*result = p_betround_calculator->betround();
  //FLAGS
  else if (memcmp(name, "fmax", 4)==0 && strlen(name)==4)			*result = p_flags_toolbar->GetFlagMax();
  // flags f0..f9
  else if (memcmp(name, "f", 1)==0 && strlen(name)==2)				*result = p_flags_toolbar->GetFlag(RightDigitCharacterToNumber(name));
  // flags f10..f19
  else if (memcmp(name, "f", 1)==0 && strlen(name)==3)				*result = p_flags_toolbar->GetFlag(10 * RightDigitCharacterToNumber(name, 1) + RightDigitCharacterToNumber(name, 0));
  else if (memcmp(name, "flagbits", 8)==0 && strlen(name)==8)	*result = p_flags_toolbar->GetFlagBits();
  // GENERAL
  else if (memcmp(name, "session", 7)==0 && strlen(name)==7)	*result = p_sessioncounter->session_id();
  else if (memcmp(name, "version", 7)==0 && strlen(name)==7)	*result = VERSION_NUMBER;
  // Handreset
  else if (memcmp(name, "handsplayed", 11)==0 && strlen(name)==11) *result = p_handreset_detector->hands_played();
  else if (memcmp(name, "handsplayed_headsup", 19)==0 && strlen(name)==19)  *result = p_handreset_detector->hands_played_headsup();
  // OH-script-messagebox
  else if (memcmp(name, "msgbox$", 7)==0 && strlen(name)>7) {
    // Don't show name messagebox if in parsing-mode
    if (p_formula_parser->IsParsing()
        || !p_autoconnector->IsConnected()
	      || !p_symbol_engine_userchair->userchair_confirmed()) {
	    *result = 0;
    } else {
	    OH_MessageBox_OH_Script_Messages(name);
	    *result = 0;
    }
  }
  else if ((memcmp(name, "log$", 4)==0) && (strlen(name)>4)) {
    if (!p_formula_parser->IsParsing()) {
      write_log(preferences.debug_auto_trace(), 
        "[CSymbolEngineVariousDataLookup] %s -> 0.000 [just logged]\n", name);
      p_autoplayer_trace->Add(name, 0);
      p_white_info_box->SetCustomLogMessage(name);
    }
    *result = 0;
  } else if ((memcmp(name, "attached_hwnd", 13)==0) && (strlen(name)==13)) {
    *result = int(p_autoconnector->attached_hwnd());
  } else if ((memcmp(name, "islobby", 7)==0) && (strlen(name)==7)) {
    *result = p_tablemap->islobby();
  } 
  else {
    *result = kUndefined;
    return false;
  }
  return true;
}
bool CSymbolEngineIsRush::EvaluateSymbol(const CString name, double *result, bool log /* = false */) { 
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  if (memcmp(name, "isrush", 6)==0)  {
    *result = isrush();
    return true;
  }
  // Symbol of a different symbol-engine
  return false;
}
bool CSymbolEngineDealerchair::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "dealerchair", 11)==0 && strlen(name)==11)	
	{
		*result = p_symbol_engine_dealerchair->dealerchair();
		return true;
	}
	return false;
}
bool CSymbolEngineIsOmaha::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  if (memcmp(name, "isomaha", 7)==0 && strlen(name)==7)	{
    // Up to now only Hold'Em supported
		*result = false;
    return true;
	}
  // Symbol of a different symbol-engine
  return false;
}
bool CSymbolEngineUserchair::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "userchair", 9)==0 && strlen(name)==9)
	{
		*result = userchair();
		return true;
	}
	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineDealerchair::EvaluateSymbol(const CString name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (name == "dealerchair")	{
		*result = p_engine_container->symbol_engine_dealerchair()->dealerchair();
		return true;
	}
  if (name == "buttonchair") {
    *result = p_engine_container->symbol_engine_dealerchair()->dealerchair();
    return true;
  }
	return false;
}
Exemplo n.º 14
0
bool CSymbolEnginePrwin::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "pr", 2)==0) {
    if (memcmp(name, "prwin", 5)==0 && strlen(name)==5) {
      *result = p_iterator_thread->prwin();
    } 
    else if (memcmp(name, "prlos", 5)==0 && strlen(name)==5) {
      *result = p_iterator_thread->prlos();
    }
    else if (memcmp(name, "prtie", 5)==0 && strlen(name)==5) {
      *result = p_iterator_thread->prtie();
    }
		else if (memcmp(name, "prwinnow", 8)==0 && strlen(name)==8) {
			*result = prwinnow();
		}
		else if (memcmp(name, "prlosnow", 8)==0 && strlen(name)==8)	{
			*result = prlosnow();
		}
    else {
      return false;
    }
    // Valid symbol
    return true;
  }
	else if (memcmp(name, "nhands", 6)==0)
	{
		if (memcmp(name, "nhands", 6)==0 && strlen(name)==6)	
		{
			*result = nhands();
		}
		else if (memcmp(name, "nhandshi", 8)==0 && strlen(name)==8)
		{
			*result = nhandshi();
		}
		else if (memcmp(name, "nhandslo", 8)==0 && strlen(name)==8)
		{
			*result = nhandslo();
		}
		else if (memcmp(name, "nhandsti", 8)==0 && strlen(name)==8)
		{
			*result = nhandsti();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineAutoplayer::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "is", 2)==0)
	{
		if (memcmp(name, "isfinaltable", 12)==0 && strlen(name)==12)	
		{
			*result = isfinaltable();
		}
		else if (memcmp(name, "ismyturn", 8)==0 && strlen(name)==8)		
		{
			*result = ismyturn();
		}
		else if (memcmp(name, "issittingin", 11)==0 && strlen(name)==11)	
		{
			*result = issittingin();
		}
		else if (memcmp(name, "issittingout", 12)==0 && strlen(name)==12)
		{
			*result = issittingout();
		}
		else if (memcmp(name, "isautopost", 10)==0 && strlen(name)==10)	
		{
			*result = isautopost();
		}
		else if (memcmp(name, "isfinalanswer", 13)==0 && strlen(name)==13)	
		{
			*result = isfinalanswer();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	else if (memcmp(name, "myturnbits", 10)==0 && strlen(name)==10)
	{
		*result = myturnbits();
		// Valid symbol
		return true;
	}

	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineColourCodes::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "colour", 6) != 0) {
		// Symbol of a different symbol-engine
	  return false;
	}
  if ((memcmp(name, "colourcode", 10) == 0) && (strlen(name) == 11)) {
    // colourcode0..colourcode9
    char c_index = name[10];
    if ((c_index < '0') || (c_index > '9')) return false;
    int index = c_index - '0';
    *result = p_table_state->_players[index]._colourcode;
    return true;
  }
	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineRaisersCallers::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "nopponents", 10)==0) {
		if (memcmp(name, "nopponentschecking", 18)==0 && strlen(name)==18) {
			*result = nopponentschecking();
		}	else if (memcmp(name, "nopponentscalling", 17)==0 && strlen(name)==17) {
      RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
			*result = nopponentscalling();
		}	else if (memcmp(name, "nopponentstruelyraising", 23)==0 && strlen(name)==23) {
      RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
			*result = nopponentstruelyraising();
		}	else if (memcmp(name, "nopponentsbetting", 17)==0 && strlen(name)==17) {
			*result = nopponentsbetting();
		}	else if (memcmp(name, "nopponentsfolded", 16)==0 && strlen(name)==16)	{
			*result = nopponentsfolded();
		}	else {
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	if (memcmp(name, "nplayerscallshort", 17)==0 && strlen(name)==17)	{
    RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
		*result = nplayerscallshort();
	}	else if (memcmp(name, "raischair", 9)==0 && strlen(name)==9) {
		*result = raischair();
	}	else if (memcmp(name, "raisbits", 8)==0 && strlen(name)==9) {
    RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
		*result = raisbits(name[8]-'0');
	}	else if (memcmp(name, "callbits", 8)==0 && strlen(name)==9) {
    RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
		*result = callbits(name[8]-'0');
	}	else if (memcmp(name, "foldbits", 8)==0 && strlen(name)==9) {
    RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
		*result = foldbits(name[8]-'0');
	} else if (memcmp(name, "lastraised", 10)==0 && strlen(name)==11) { 
    *result = LastRaised(name[10]-'0');
  }	else {
		// Symbol of a different symbol-engine
		return false;
	}
	// Valid symbol
	return true;
}
Exemplo n.º 18
0
bool CSymbolEngineCallers::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "nopponentscalling", 17)==0 && strlen(name)==17) {
    RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
		*result = nopponentscalling();
		return true;
	}	else if (memcmp(name, "callbits", 8)==0 && strlen(name)==9) {
    RETURN_UNDEFINED_VALUE_IF_NOT_MY_TURN
		*result = callbits(RightDigitCharacterToNumber(name));
    return true;
  } else if (memcmp(name, "firstcaller_chair", 17)==0) {
		*result = _firstcaller_chair;
		return true;
	} else if (memcmp(name, "lastcaller_chair", 16)==0) {
		*result = _lastcaller_chair;
		return true;
  }
	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEngineMTTInfo::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  if (memcmp(name, "mtt_", 4) != 0) {
    // Symbol of a different symbol-engine
	  return false;
  }
	// MTT symbols
  if (memcmp(name, "mtt_number_entrants", 19)==0)        *result = _mtt_number_entrants;
  else if (memcmp(name, "mtt_players_remaining", 21)==0) *result = _mtt_players_remaining;
  else if (memcmp(name, "mtt_my_rank", 11)==0)	         *result = _mtt_my_rank;
  else if (memcmp(name, "mtt_paid_places", 15)==0)       *result = _mtt_paid_places;
  else if (memcmp(name, "mtt_largest_stack", 17)==0)	   *result = _mtt_largest_stack;
  else if (memcmp(name, "mtt_average_stack", 17)==0)	   *result = _mtt_average_stack;
  else if (memcmp(name, "mtt_smallest_stack", 18)==0) 	 *result = _mtt_smallest_stack;
  else {
	  // Symbol of a different symbol-engine
	  return false;
  }
  return true;
}
bool CSymbolEngineOpenPPLUserVariables::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  if (_memicmp(name, "user", 4) != 0) {
    // Not a user-variable
    return false;
  }
  if (memcmp(name+4, "chair", 5) == 0) {
    // Symbol "userchair", not a user-variable
    return false;
  }
  // Try to look it up
  if (_user_variables[name]) {
    write_log(preferences.debug_symbolengine_open_ppl(),
      "[CSymbolEngineOpenPPLUserVariables] user-variable exists: %s\n", name);
    *result = double(true);
    return true;
  }
  write_log(preferences.debug_symbolengine_open_ppl(),
    "[CSymbolEngineOpenPPLUserVariables] user-variable does not exist: %s\n", name);
  *result = double(false);
  return true;
}
bool CSymbolEngineHandrank::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "handrank", 8) == 0)
	{
		if (memcmp(name, "handrank169", 11)==0 && strlen(name)==11)
		{
			*result = handrank169();
		}
		else if (memcmp(name, "handrank2652", 12)==0 && strlen(name)==12)
		{
			*result = handrank2652();
		}
		else if (memcmp(name, "handrank1326", 12)==0 && strlen(name)==12)
		{
			*result = handrank1326();
		}
		else if (memcmp(name, "handrank1000", 12)==0 && strlen(name)==12)
		{
			*result = handrank1000();
		}
		else if (memcmp(name, "handrankp", 9)==0 && strlen(name)==9)
		{
			*result = handrankp();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	// Symbol of a different symbol-engine
	return false;
}
bool CSymbolEnginePositions::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "nchairsdealt", 12)==0)
	{
		if (memcmp(name, "nchairsdealtright", 17)==0 && strlen(name)==17)
		{
			*result = nchairsdealtright();
		}
		else if (memcmp(name, "nchairsdealtleft", 16)==0 && strlen(name)==16)
		{
			*result = nchairsdealtleft();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	else if (memcmp(name, "betposition", 11)==0)
	{
		if (memcmp(name, "betposition", 11)==0 && strlen(name)==11)		
		{
			*result = betposition();
		}
		else if (memcmp(name, "betpositionrais", 15)==0 && strlen(name)==15)	
		{
			*result = betpositionrais();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	else if (memcmp(name, "dealposition", 12)==0)
	{
		if (memcmp(name, "dealposition", 12)==0 && strlen(name)==12)	
		{
			*result = dealposition();
		}
		else if (memcmp(name, "dealpositionrais", 16)==0 && strlen(name)==16)
		{
			*result = dealpositionrais();
		}
		else
		{
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}
	else if (memcmp(name, "callposition", 12)==0 && strlen(name)==12)	
	{
		*result = callposition();
		// Valid symbol
		return true;
	}
	else
	{
		// Symbol of a different symbol-engine
		return false;
	}
}
bool CSymbolEnginePokerTracker::EvaluateSymbol(const char *name, double *result, bool log /* = false */)
{
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name,"pt_",3)!=0)
	{
		// Symbol of a different symbol-engine
		return false;
	}
	CString s = name;
	CheckForChangedPlayersOncePerHeartbeatAndSymbolLookup();
	if (IsOldStylePTSymbol(s))
	{
		CString error_message;
		error_message.Format(
			"Old style PokerTracker symbol detected: %s.\n"
			"\n"
			"PokerTracker symbol start with \"pt_\".\n"
      "Possible postfixes:\n"
      "  * chair number (0..9)\n"
      "  * _raischair\n"
      "  * _headsup\n"
      "  * _smallblind\n"
      "  * _bigblind\n"
      "  * _dealer\n"
      "  * _cutoff\n"
      "  * _user\n"
      "  * _firstraiser\n"
      "  * _firstcaller\n"
      "  * _lastcaller\n", s);
		OH_MessageBox_Formula_Error(
			error_message,			 
			"ERROR: Invalid PokerTracker Symbol");
		*result = kUndefined;
		return true;
	}
	if (!PT_DLL_IsValidSymbol(CString(s)))
	{
		// Invalid PokerTracker symbol
		WarnAboutInvalidPTSymbol(s);
		*result = kUndefined;
		return true;
	}
	int chair = 0;

	if (!p_pokertracker_thread->IsConnected()) 	{
		if (!p_symbol_engine_userchair->userchair_confirmed() || p_formula_parser->IsParsing()) {
			// We are not yet seated or formula is getting parsed.
			// Symbol-lookup happens, because of Formula-validation.
			// Not a problem, if we do not yet have a DB-connection.
			// Don't throw a warning here.
       write_log(preferences.debug_pokertracker(), "[PokerTracker] Not yet seated or formula parsing.\n");
		} else {
			// We are seated and playing.
			// Serious problem, if we do not have a DB-connection.
			OH_MessageBox_Error_Warning("Not connected to PokerTracker database.\n"
				"Can't use PokerTracker symbols.");
		}
		*result = kUndefined;
		return true;
	}

	CString standard_symbol_name;
	assert(StringAIsPrefixOfStringB("pt_", s));
	// PokerTracker symbols for the raise-chair
	if (s.Right(10) == "_raischair") {
		chair = p_symbol_engine_raisers->raischair();
	}
	// PokerTracker symbols for the opponent headsup chair
	else if (s.Right(8) == "_headsup") {
    chair = p_symbol_engine_chairs->opponent_headsup_chair();
	}
  // PokerTracker symbols for the smallblind chair
	else if (s.Right(11) == "_smallblind") {
    chair = p_symbol_engine_chairs->smallblind_chair();
	}
  // PokerTracker symbols for the bigblind chair
	else if (s.Right(9) == "_bigblind") {
    chair = p_symbol_engine_chairs->bigblind_chair();
	}
  // PokerTracker symbols for the cutoff chair
	else if (s.Right(7) == "_cutoff") {
    chair = p_symbol_engine_chairs->cutoff_chair();
	}
  // PokerTracker symbols for the firstcaller chair
	else if (s.Right(12) == "_firstcaller") {
    chair = p_symbol_engine_callers->firstcaller_chair();
	}
  // PokerTracker symbols for the lastcaller chair
	else if (s.Right(11) == "_lastcaller") {
    chair = p_symbol_engine_callers->lastcaller_chair();
	}
  // PokerTracker symbols for the firstraiser chair
	else if (s.Right(12) == "_firstraiser") {
		chair = p_symbol_engine_raisers->firstraiser_chair();
	}
  // PokerTracker symbols for the dealerchair chair
	else if (s.Right(7) == "_dealer") {
    chair = p_symbol_engine_dealerchair->dealerchair();
	}
  // PokerTracker symbols for the  chair
	else if (s.Right(5) == "_user") {
    chair = p_symbol_engine_userchair->userchair();
	}
  // PokerTracker symbols for chair X
	else {
		CString symbol = s;
		CString last_character = symbol.Right(1);
    if (!isdigit(last_character[0])) {
      CString error_message;
      error_message.Format("Invalid PokerTracker Symbol: &s",
        symbol);
      OH_MessageBox_Formula_Error(error_message, "ERROR");
		  *result = kUndefined;
      return false;
    }
		chair = atoi(last_character);
	}
  // Catch undefined chair (e.g. pt_r_-symbol without raisee)
  if (chair < 0) {
    *result = kUndefined;
    return true;
  }
	AssertRange(chair, kFirstChair, kLastChair);
	*result = PT_DLL_GetStat(s, chair); 
	return true;
}
bool CSymbolEngineHistory::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
	if (memcmp(name, "did", 3) == 0)	{
		if (memcmp(name, "didchec", 7)==0 && strlen(name)==7)	{
			*result = didchec(p_betround_calculator->betround());
		}	else if (memcmp(name, "didcall", 7)==0 && strlen(name)==7) {
			*result = didcall(p_betround_calculator->betround());
		}	else if (memcmp(name, "didrais", 7)==0 && strlen(name)==7) {
			*result = didrais(p_betround_calculator->betround());
		}	else if (memcmp(name, "didbetsize", 10)==0 && strlen(name)==10) {
			*result = didswag(p_betround_calculator->betround());
		}	else if (memcmp(name, "didfold", 7)==0 && strlen(name)==7) {
			*result = didfold(p_betround_calculator->betround());
		}	else if (memcmp(name, "didalli", 7)==0 && strlen(name)==7) {
			*result = didalli(p_betround_calculator->betround());
		}	else if (memcmp(name, "didchecround", 12)==0 && strlen(name)==13)	{
			*result = didchec(name[12]-'0');
		}	else if (memcmp(name, "didcallround", 12)==0 && strlen(name)==13)	{
			*result = didcall(name[12]-'0');
		}	else if (memcmp(name, "didraisround", 12)==0 && strlen(name)==13)	{
			*result = didrais(name[12]-'0');
		}	else if (memcmp(name, "didbetsizeround", 15)==0 && strlen(name)==16)	{
			*result = didswag(name[12]-'0');
		}	else if (memcmp(name, "didfoldround", 12)==0 && strlen(name)==7) {
			*result = didfold(name[12]-'0');
		}	else if (memcmp(name, "didalliround", 12)==0 && strlen(name)==7) {
			*result = didalli(name[12]-'0');
    }	else {
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}	else if (memcmp(name, "nplayersround", 13)==0) {
		if (memcmp(name, "nplayersround", 13)==0 && strlen(name)==13) {
      // For current betting round
			*result = nplayersround(p_betround_calculator->betround());
		}	else if (memcmp(name, "nplayersround", 13)==0 && strlen(name)==14) {
			*result = nplayersround(name[13]-'0');
		}	else {
			// Invalid symbol
			return false;
		}
		// Valid symbol
		return true;
	}	else if (memcmp(name, "prevaction", 10)==0 && strlen(name)==10)	{
		*result = prevaction();
	}	else if (memcmp(name, "nbetsround", 10)==0 && strlen(name)==10)	{
		*result = nbetsround(p_betround_calculator->betround());
	}	else if (memcmp(name, "nbetsround", 10)==0 && strlen(name)==11)	{
		*result = nbetsround(name[10]-'0');
	}  else if (memcmp(name, "hi_", 3)==0) {
    // History symbols
    int	round = name[strlen(name)-1]-'0';
    char *pure_name = (char*)name + 3;
    char pure_name_without_betround[256];
    int length = strlen(pure_name);
    assert(length < 256);
    memcpy(pure_name_without_betround, pure_name, length); 
    pure_name_without_betround[length - 1] = '\0';
    *result = HistorySymbol(pure_name_without_betround, round);
    return true;
  }	else {
		// Symbol of a different symbol-engine
		return false;
	}
	// Valid symbol
	return true;
}
bool CSymbolEngineVariousDataLookup::EvaluateSymbol(const char *name, double *result, bool log /* = false */) {
  FAST_EXIT_ON_OPENPPL_SYMBOLS(name);
  // DLL
  if (memcmp(name, "dll$", 4) == 0) {
    assert(p_dll_extension != NULL);
    if (p_dll_extension->IsLoaded()) {
	    *result = ProcessQuery(name);
    } else {
	    *result = kUndefinedZero;
    }
  }
  // Various symbols below
  // without any optimized lookup.
  //ROUND&POSITIONS
  else if (memcmp(name, "betround", 8)==0 && strlen(name)==8)	*result = p_betround_calculator->betround();
  //FLAGS
  else if (memcmp(name, "fmax", 4)==0 && strlen(name)==4)			*result = p_flags_toolbar->GetFlagMax();
  // flags f0..f9
  else if (memcmp(name, "f", 1)==0 && strlen(name)==2)				*result = p_flags_toolbar->GetFlag(RightDigitCharacterToNumber(name));
  // flags f10..f19
  else if (memcmp(name, "f", 1)==0 && strlen(name)==3)				*result = p_flags_toolbar->GetFlag(10 * RightDigitCharacterToNumber(name, 1) + RightDigitCharacterToNumber(name, 0));
  else if (memcmp(name, "flagbits", 8)==0 && strlen(name)==8)	*result = p_flags_toolbar->GetFlagBits();
  // GENERAL
  else if (memcmp(name, "session", 7)==0 && strlen(name)==7)	*result = p_sessioncounter->session_id();
  else if (memcmp(name, "version", 7)==0 && strlen(name)==7)	*result = VERSION_NUMBER;
  // Handreset
  else if (memcmp(name, "handsplayed", 11)==0 && strlen(name)==11) *result = p_handreset_detector->hands_played();
  else if (memcmp(name, "handsplayed_headsup", 19)==0 && strlen(name)==19)  *result = p_handreset_detector->hands_played_headsup();
  // OH-script-messagebox
  else if (memcmp(name, "msgbox$", 7)==0 && strlen(name)>7) {
    // Don't show name messagebox if in parsing-mode
    if (p_formula_parser->IsParsing()
        || !p_autoconnector->IsConnected()
	      || !p_symbol_engine_userchair->userchair_confirmed()) {
	    *result = 0;
    } else {
	    OH_MessageBox_OH_Script_Messages(name);
	    *result = 0;
    }
  }
  else if ((memcmp(name, "log$", 4)==0) && (strlen(name)>4)) {
    if (!p_formula_parser->IsParsing()) {
       write_log(preferences.debug_auto_trace(), 
        "[CSymbolEngineVariousDataLookup] %s -> 0.000 [just logged]\n", name);
      p_autoplayer_trace->Add(name, 0);
      p_white_info_box->SetCustomLogMessage(name);
    }
    // True (1) is convenient in sequences of ANDed conditions
    // http://www.maxinmontreal.com/forums/viewtopic.php?f=110&t=19421
    *result = true;
  } else if ((memcmp(name, "attached_hwnd", 13)==0) && (strlen(name)==13)) {
    *result = int(p_autoconnector->attached_hwnd());
  } else if ((memcmp(name, "islobby", 7)==0) && (strlen(name)==7)) {
    *result = p_tablemap->islobby();
  } else if ((memcmp(name, kEmptyExpression_False_Zero_WhenOthersFoldForce, strlen(kEmptyExpression_False_Zero_WhenOthersFoldForce))==0) 
      && (strlen(name)==strlen(kEmptyExpression_False_Zero_WhenOthersFoldForce))) {
    *result = kUndefinedZero;
  } else {
    // Special symbol for empty expressions. Its evaluation adds something 
    // meaningful to the log when the end of an open-ended when-condition 
    // gets reached during evaluation.
    *result = kUndefined;
    return false;
  }
  return true;
}