void
Conversation::add(const std::string& topic, const std::string& text)
{
  if (!active)
  {
    choices.push_back(Choice(topic, text));
    if (selection >= int(choices.size()))
      selection = 0;
  }
}
예제 #2
0
boolean FileChooser::Accept() {
    boolean accepted, dirSelected;

    do {
        accepted = StringChooser::Accept();
        dirSelected = browser()->IsADirectory(Choice());
    } while (accepted && dirSelected);

    return accepted;
}
예제 #3
0
static int choice(int p1,int p2) {
  if(P_IS(p1,P_NOT_ALLOWED)) return p2;
  if(P_IS(p2,P_NOT_ALLOWED)) return p1;
  if(P_IS(p2,P_CHOICE)) {
    int p21,p22; Choice(p2,p21,p22);
    p1=choice(p1,p21); return choice(p1,p22);
  }
  if(samechoice(p1,p2)) return p1;
  if(nullable(p1) && (P_IS(p2,P_EMPTY))) return p1;
  if(nullable(p2) && (P_IS(p1,P_EMPTY))) return p2;
  return newChoice(p1,p2);
}
예제 #4
0
bool ChoiceEditor::EndEdit(int row, int col,
                           wxGrid* grid)
{
   wxString val = mChoices[Choice()->GetSelection()];

   if (val == mOld)
      return false;

   grid->GetTable()->SetValue(row, col, val);

   return true;
}
예제 #5
0
int main()
{
	int parent_x, parent_y;
START:
	head = (psnakeHead)malloc(sizeof(snakeHead));
	head -> length = 0;
	head -> row = 14;
	head -> col = 14;
	head -> pbody = NULL;
	head -> headdirection = RIGHT;
	InitSnake(head);

    initscr();  
    raw();                  /* close row buffer */
    cbreak();               /* put termial to CBREAK mode */  
    noecho();  
    curs_set(FALSE);            /* set cursor invisible */  
    keypad(stdscr,TRUE);    /* recognise user's function key,F1,F2,...
							   display some message about title and wall */  
    signal(SIGALRM, StartAlarm);  
	getmaxyx(stdscr, parent_y, parent_x);
	WINDOW *welwin = newwin(29, parent_x, 0, 0);
	WINDOW *lelwin = newwin(7, parent_x, 30, 0);
	if (!welwin || !lelwin) {
		Die("Unable to allocate window memory\n");
	}
	Welcome(welwin, 29, parent_x);
	int speed = Choice(lelwin);
    Set_ticker(speed);  
	DrawWalls();
    StartAlarm();
    foodpos = DisplayFood(head);
    while(!isfailed && chinput !='q') {
        chinput = getch();
		ControlSnake(chinput, head);
    }
    if(isfailed) {
		ClearScr(LEFT_EDGE+1, RIGHT_EDGE-1, TOP_ROW+1, BUT_ROW-1);		//mark
		free(head -> pbody);
		free(head);
		head = NULL;
    }
    if(isrestart) {
        isfailed = 0;
        isrestart = 0;      // clear the flag
        goto START;    		// go to the START statement
    }
	endwin();
	return 0;
}
예제 #6
0
파일: blackjack.c 프로젝트: alieveldar/c
int main(void) {
	fillDeck();
	shuffleDeck();
	passCard(playerHand, Player);
	passCard(playerHand, Player);
	PrintHand();
	printf("You score is (%i).        ", scorePlayerHand);
	do {
		CheckHand();
		Ask();
		Choice();
		PrintHand();
		printf("You score is (%i).    ", scorePlayerHand);
	} while ((userAnswer == 'y' || userAnswer == 'Y'));
	getWinner();
	return 0;
}
예제 #7
0
파일: Grid.cpp 프로젝트: GYGit/Audacity
bool ChoiceEditor::EndEdit(int row, int col,
                           wxGrid* grid)
{
   int sel = Choice()->GetSelection();

   // This can happen if the wxChoice control is displayed and the list of choices get changed
   if ((sel < 0) || (sel >= (int)(mChoices.GetCount())))
   {
      return false;
   }

   wxString val = mChoices[sel];
   if (val == mOld)
      return false;

   grid->GetTable()->SetValue(row, col, val);

   return true;
}
예제 #8
0
static int drv(int p,int c) {
  int p1,p2,cf,cl,cn,ret,m;
  assert(!P_IS(p,P_ERROR));
  m=new_memo(p,c);
  if(m!=-1) return M_RET(m);
  switch(P_TYP(p)) {
  case P_NOT_ALLOWED: case P_EMPTY: ret=notAllowed; break;
  case P_CHOICE: Choice(p,p1,p2); ret=choice(drv(p1,c),drv(p2,c)); break;
  case P_GROUP: Group(p,p1,p2); {int p11=group(drv(p1,c),p2); ret=nullable(p1)?choice(p11,drv(p2,c)):p11;} break;
  case P_ONE_OR_MORE: OneOrMore(p,p1); ret=group(drv(p1,c),choice(empty,p)); break;
  case P_EXCEPT: Except(p,p1,p2); ret=nullable(drv(p1,c))&&!nullable(drv(p2,c))?empty:notAllowed; break;
  case P_RANGE: Range(p,cf,cl); ret=cf<=c&&c<=cl?empty:notAllowed; break;
  case P_CLASS: Class(p,cn); ret=in_class(c,cn)?empty:notAllowed; break;
  case P_ANY: ret=empty; break;
  case P_CHAR: Char(p,cf); ret=c==cf?empty:notAllowed; break;
  default: ret=0; assert(0);
  }
  new_memo(p,c); M_SET(ret);
  accept_m();
  return ret;
}
예제 #9
0
파일: tocman.cpp 프로젝트: cbiffle/runcible
static void copyToc(const QUrl &docUrl, Poppler::Document *doc, QDomNode node,
    QList<Choice> &choices, int indent) {
  while (!node.isNull()) {
    if (node.isElement()) {
      QDomElement el = node.toElement();
      QString destName = el.attribute("DestinationName", QString());
      if (!destName.isNull()) {
        Poppler::LinkDestination *dest = doc->linkDestination(destName);
        QUrl refUrl(docUrl);
        refUrl.setFragment("page:" + QString::number(dest->pageNumber() - 1));
        delete dest;
       
        QString displayName(QString(indent * 2, ' ') + el.nodeName());
        choices << Choice(displayName, refUrl.toString()); 
      }
    }
    if (node.hasChildNodes()) {
      copyToc(docUrl, doc, node.firstChild(), choices, indent + 1);
    }
    node = node.nextSibling();
  }
}
예제 #10
0
파일: Grid.cpp 프로젝트: ducknoir/audacity
bool ChoiceEditor::EndEdit(int WXUNUSED(row), int WXUNUSED(col),
                           const wxGrid* WXUNUSED(grid),
                           const wxString &WXUNUSED(oldval), wxString *newval)
{
    int sel = Choice()->GetSelection();

    // This can happen if the wxChoice control is displayed and the list of choices get changed
    if ((sel < 0) || (sel >= (int)(mChoices.GetCount())))
    {
        return false;
    }

    wxString val = mChoices[sel];
    bool changed = val != mOld;

    if (changed)
    {
        mValueAsString = val;
        *newval = val;
    }

    return changed;
}
예제 #11
0
파일: dice_game.c 프로젝트: jms0619/temp
int main(void)
{
	char answer='y';

	srand((int)time(NULL));

	Start();

	while(answer=='y')
	{
		BettingPrint();
		Choice();
		Progress();

		if(YourMoney()==0)
			break;
		else		
			answer=Question();
	}

	system("PAUSE");

	return 0;
}
예제 #12
0
파일: myai.cpp 프로젝트: dastbe/Yahtzee-AI
// Constructs a list of all valid choices for a given state.
// 
// Assumes that we only want to score after the second reroll
const std::list<Choice> MyAI::allValidChoices(const State state) const
{
	std::list<Choice> choice_list;

	// Append all scoring options if we've rerolled twice

	if (state.current_dice.turn == 3) 
	{
		if (state.isLegal(ACES)) choice_list.push_front(Choice(ACES));
		if (state.isLegal(TWOS)) choice_list.push_front(Choice(TWOS));
		if (state.isLegal(THREES)) choice_list.push_front(Choice(THREES));
		if (state.isLegal(FOURS)) choice_list.push_front(Choice(FOURS));
		if (state.isLegal(FIVES)) choice_list.push_front(Choice(FIVES));
		if (state.isLegal(SIXES)) choice_list.push_front(Choice(SIXES));
		if (state.isLegal(THREE_OF_A_KIND)) choice_list.push_front(Choice(THREE_OF_A_KIND));
		if (state.isLegal(FOUR_OF_A_KIND)) choice_list.push_front(Choice(FOUR_OF_A_KIND));
		if (state.isLegal(FULL_HOUSE)) choice_list.push_front(Choice(FULL_HOUSE));
		if (state.isLegal(SMALL_STRAIGHT)) choice_list.push_front(Choice(SMALL_STRAIGHT));
		if (state.isLegal(LARGE_STRAIGHT)) choice_list.push_front(Choice(LARGE_STRAIGHT));
		if (state.isLegal(YAHTZEE)) choice_list.push_front(Choice(YAHTZEE));
		if (state.isLegal(CHANCE)) choice_list.push_front(Choice(CHANCE));
	}


	// If I can roll, test all possible keep sets
	if (state.isLegal(ROLL))
	{
		for (std::list< boost::array<bool,5> >::const_iterator itr = keep_set_list.begin(); itr != keep_set_list.end(); ++itr)
			choice_list.push_front(Choice(ROLL,itr->data()));
	}

	return choice_list;
}
예제 #13
0
 forceinline typename ValRnd<View>::Choice
 ValRnd<View>::choice(const Space&, Archive& e) {
   return Choice(e.get());
 }
예제 #14
0
void FileChooser::UpdateBrowser() {
    browser()->SetDirectory(Choice());
}
예제 #15
0
파일: Grid.cpp 프로젝트: ducknoir/audacity
wxString ChoiceEditor::GetValue() const
{
    return mChoices[Choice()->GetSelection()];
}
예제 #16
0
파일: Grid.cpp 프로젝트: ducknoir/audacity
void ChoiceEditor::Reset()
{
    Choice()->SetSelection(mChoices.Index(mOld));
}
예제 #17
0
static int samechoice(int p1,int p2) {
  if(P_IS(p1,P_CHOICE)) {
    int p11,p12; Choice(p1,p11,p12);
    return p12==p2||samechoice(p11,p2);
  } else return p1==p2;
}