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;
}
Ejemplo n.º 2
0
int main()
{
	int odds[8];
	int player1[5], player2[5];
	int position[8]={0,0,0,0,0,0,0,0};
	int count;
	int winner;
	char more_race='Y';

//Player array, slot0=money total, slot1=horse bet on, slot2=bet amount, slot3=odds of bet
//slot4=original cash level.
	srand(time(0));

	title_screen();
	get_cash(player1,1);
	get_cash(player2,2);

	do
	{
	for(count=0;count<8;count++)
		position[count]=0;
	winner=6000;
	generate_odds(odds,8);
    disp_odds(odds);
	bet(player1,1,odds);
    disp_odds(odds);
	bet(player2,2,odds);

	do
	{
	for(count=0;count<8;count++)
		{	
		position[count]+=move_horse(odds, count);
		if(position[count]>=50)
			winner=count;
		}
	disp_race(position);
	}
	while(winner==6000);
	
	cout<<"\nThe winning horse is horse "<<winner+1<<endl;
	player1[0]+=payoff(winner, player1,1);
	player2[0]+=payoff(winner, player2,2);

	if((player1[0]<=0)||(player2[0]<=0))
		more_race='n';
	else
		{
		cout<<"\nWould you like another race? (Y/N)\n";
		cin>>more_race;
		}
	}
	while((more_race=='Y')||(more_race=='y'));

	final_results(player1,player2);

	return 0;
}
Ejemplo n.º 3
0
Archivo: is.c Proyecto: shurikasa/mod2c
static int  rates ( _threadargsprotocomma_ double _lv ) {
   double _la , _lb ;
 _la = alp ( _threadargscomma_ _lv , 0.0 ) ;
   _lb = bet ( _threadargscomma_ _lv , 0.0 ) ;
   mtau = 1.0 / ( _la + _lb ) ;
   minf = _la / ( _la + _lb ) ;
   _la = alp ( _threadargscomma_ _lv , 1.0 ) ;
   _lb = bet ( _threadargscomma_ _lv , 1.0 ) ;
   ntau = 1.0 / ( _la + _lb ) ;
   ninf = _la / ( _la + _lb ) ;
    return 0; }
Ejemplo n.º 4
0
// plug in volume function
DLLExport volumeFunctionalConectivity(studyParams &vdb, int index, char *volume, void *&userData)
{
	if (index == 1)
	{
		FunctionalConnectivity *fcconn = (FunctionalConnectivity *)userData;
		strcpy(vdb.motionRefVolume, volume);

		stringstream CmdLn;

		CmdLn << "bet " << volume << " " << vdb.inputDir << "RFI_sks" << vdb.trainFeatureSuffix << " " << vdb.betParameters;
		bet((char *)CmdLn.str().c_str());

		sprintf(vdb.maskFile, "%sRFI_sks%s", vdb.inputDir, vdb.trainFeatureSuffix);

		if (fileExists(fcconn->correlationMapFile))
		{
			char outputFile[500];

			changeFileExt(fcconn->correlationMapFile, vdb.trainFeatureSuffix, outputFile);
			functionalNormalization(fcconn->correlationMapFile, fcconn->correlationMapFileRef, vdb.maskFile, outputFile, true);
			fcconn->connectivityCalculator.loadRegionMap(outputFile);
		}
	}
   return 1;
}
Ejemplo n.º 5
0
void cb_b500(GtkWidget *widget, gpointer data) {
    int amt = 500;
    config *c;
    c = (config *)data;
    bet(amt, c->p, c->bamt, c->mamt);
    gtk_widget_show_all((GtkWidget *)c->window);
}
Ejemplo n.º 6
0
Archivo: is.c Proyecto: shurikasa/mod2c
static void _hoc_bet(void) {
  double _r;
   double* _p; Datum* _ppvar; Datum* _thread; _NrnThread* _nt;
   if (_extcall_prop) {_p = _extcall_prop->param; _ppvar = _extcall_prop->dparam;}else{ _p = (double*)0; _ppvar = (Datum*)0; }
  _thread = _extcall_thread;
  _nt = nrn_threads;
 _r =  bet ( _p, _ppvar, _thread, _nt, *getarg(1) , *getarg(2) );
 hoc_retpushx(_r);
}
Ejemplo n.º 7
0
static int  rate (  double _lv ) {
   double _la , _lb , _lqt ;
 _lqt = pow( q10 , ( ( celsius - 25.0 ) / 10.0 ) ) ;
   _la = alp ( _threadargscomma_ _lv ) ;
   _lb = 1.0 / ( ( _la + bet ( _threadargscomma_ _lv ) ) ) ;
   minf = _la * _lb ;
   tau = betmt ( _threadargscomma_ _lv ) / ( _lqt * a0m * ( 1.0 + alpmt ( _threadargscomma_ _lv ) ) ) ;
   if ( tau < mmin / _lqt ) {
     tau = mmin / _lqt ;
     }
    return 0; }
Ejemplo n.º 8
0
TEST(generateExpression, variable_expr) {
  static const bool user_facing = true;
  std::stringstream msgs;

  stan::lang::matrix_type tMat;
  stan::lang::bare_array_type d2_ar(tMat,2);
  stan::lang::bare_expr_type bet(d2_ar);
  stan::lang::variable v("foo");
  v.set_type(bet);
  stan::lang::expression e1 = v;

  generate_expression(e1, user_facing, msgs);
  EXPECT_EQ(msgs.str(), "foo");
}
Ejemplo n.º 9
0
void GameApplication::startStopGame() {
	if (board.isStarted()) {
		board.stop();
		startStopTimer();
		setToDefault();
	} else {
		if (!theGameIsOver()) {
			board.start();
			startStopTimer();
			bet();
			setToDefault();
		} else {
			gameOver = true;
		}
	}
}
Ejemplo n.º 10
0
void Cplm::mainLoop()
{
    CStrOut message;
    int i = 0;

    // If a player left in the middle of hand, it might
    // happen that the pot still has money - if so, give
    // the chips here to the player

    if (!inGame_ &&
         (table_->countPlayers(PLAYER_STATE_ACTIVE) < 2 ||
          table_->numPlayersSittingIn() < 2 ||
          CTournament::Inst()->pause()))
    {
        doCleanup();
        Sys_Sleep(2000);

        if (!CTournament::Inst()->isTournament())
        {
          // Players are sitting out
          CpduAnnounce pdu(table_);
          pdu.sendAnnounce("Waiting for players to sit in");
          Sys_Sleep(2000);
        }

        return;
    }
    else
    {
        // The game thread function calls this repeatedly.
        // It only gets this far when there's enough players for a game.
        // First off, get the game number, and setLog all of the current players.

        memcpy((void*)&currentInstr_, pgl_->fetchInstr(), sizeof(pgl_instr_t));

        switch (currentInstr_.opcode)
        {
        case (Instr_NOP):
          break;

        case (Instr_Deal):
          deal();
          break;  // Deal Cards To All Active Players

        case (Instr_Ante):                      // Do ANTE
        {
            table_->setGameNumber();
            CpduGameNumber::SendGameNumber(table_);
            for (i = 0; i < 10; i++)
            {
                CPlayer* player = table_->getPlayerFromSlot(i);
                if (player)
                {
                  message << CStrOut::Clear
                          << "Seat " << i << ": "
                          << player->getUsername() 
                          << " (" << player->getChips() 
                          << " in chips)";
                  table_->setLog(message.str());
                }
            }

            ante();
        }
        break;

        case (Instr_Draw):
          draw();
          break;       // Allow Players to Draw Cards

        case (Instr_Bet):
          bet();
          break;       // Do a betting Round

        case (Instr_Showdown):
          showdown();
          break;       // Do Showdown/Announce

        default:
          printf("Unknown operation %d!\n", (int)currentInstr_.opcode);
          break;
        }
    }
}
Ejemplo n.º 11
0
double CTableLimits::bet()
{
	return (bet(p_symbols->sym()->betround));
}
double CSymbolEngineTableLimits::bet() {
	return (bet(p_betround_calculator->betround()));
}
Ejemplo n.º 13
0
static void _hoc_bet(void) {
  double _r;
   _r =  bet (  *getarg(1) );
 hoc_retpushx(_r);
}
Ejemplo n.º 14
0
double CTableLimits::bet()
{
	return (bet(p_betround_calculator->betround()));
}
Ejemplo n.º 15
0
static int run(connection_t connection, int op) {
	switch(op) {
		case MONEY: {
			if(!money(connection, client_money)) {
				log_send(LEVEL_ERROR, "Error getting the money.");
				return -1;
			}else{
				log_send(LEVEL_INFO, "Succesfully got money.");
			}
		} break;

		case CUCCO_ADD: {
			if(!cucco_add(connection, database)) {
				log_send(LEVEL_ERROR, "Error adding the cucco.");
				return -1;
			}else{
				log_send(LEVEL_INFO, "Succesfully added cucco.");
			}
		} break;

		case CUCCO_REMOVE: {
			if(!cucco_remove(connection, database)) {
				log_send(LEVEL_ERROR, "Error removing the cucco.");
				return -1;
			}else{
				log_send(LEVEL_INFO, "Succesfully removed cucco.");
			}
		} break;

		case LIST: {
			if(!list(connection, database)) {
				log_send(LEVEL_ERROR, "Error getting the list of cuccos.");
				return -1;
			}else{
				log_send(LEVEL_INFO, "Sucesfully returned list of cuccos");
			}
		} break;

		case BET: {
			if(!bet(connection, &client_money, clients, bettors, winner, database)) {
				log_send(LEVEL_ERROR, "Error placing bet.");
				return -1;
			}else{
				log_send(LEVEL_INFO, "Succesfully placed bet.");
			}
		} break;

		case RESET: {
			if(!reset(connection)) {
				log_send(LEVEL_ERROR, "Error reseting the amount of money");
				return -1;
			}
			log_send(LEVEL_INFO, "Succesfully reseted the users amount of money");
			client_money = MONEY_DEFAULT;
		} break;

		case EXIT: {
			log_send(LEVEL_INFO, "[CHILD SV] Exiting.");
			return 1;
		} break;

		default: {
			log_send(LEVEL_ERROR, "Invalid opcode.");
			return -1;
		} break;
	}

	return 0;
}
Ejemplo n.º 16
0
Bet Player::makeBet(SmallDeck comm, int minBet) {
	Bet bet(1, 50000000);
	return bet;
}
Ejemplo n.º 17
0
void kpok::drawClick()
{
  if (!drawButton->isEnabled())
    return;

  // If this is the start of a new round, then deal new cards.
  if (m_game.getState() == StateStartRound) {
    drawButton->setEnabled(false);
    betBox->setEnabled(false);
    newRound();
  }
  else if (m_game.getState() == StateBet1) { // bet
    emit showClickToHold(false);

    bet();
    if (m_game.getState() == StateExchangeCards) {// should be set in bet()
      drawClick();
    }
  }
  else if (m_game.getState() == StateRaise1) { // continue bet
    bet();
    if (m_game.getState() == StateExchangeCards) {// should be set in bet()
      drawClick();
    }
  }
  else if (m_game.getState() == StateExchangeCards) { // exchange cards
    drawButton->setEnabled(false);
    playerBox[0]->setHeldEnabled(false);
    betBox->setEnabled(false);
    bool skip[PokerHandSize];
    for (int i = 0; i < PokerHandSize; i++)
      skip[i] = false;

    for (int i = 0; i < m_game.getNumActivePlayers(); i++) {
      if (!m_game.getActivePlayer(i)->getHuman())
	m_game.getActivePlayer(i)->exchangeCards(skip);
      else {
	for (int i = 0; i < PokerHandSize; i++) {
	  skip[i] = playerBox[0]->getHeld(i);
	  if (!skip[i])
	    playerBox[0]->paintDeck(i);
	}
      }
      drawCards(m_game.getActivePlayer(i), skip);
    }

    if (playerBox[0]->getHeld(0))
      drawTimer->start(0, TRUE);
    else
      drawTimer->start(drawDelay, TRUE);
  }
  else if (m_game.getState() == StateBet2) { // raise
    setBetButtonEnabled(false);
    bet();

    if (m_game.getState() == StateSee)//should be set in bet()->if no one has raised
      drawClick();
  }
  else if (m_game.getState() == StateRaise2) {
    bet();
    if (m_game.getState() == StateSee)
      drawClick();
  }
  else if (m_game.getState() == StateSee)
    winner();
}