예제 #1
0
int16_t english_context_process( cell* C )
{
int16_t return_code, nv;

  return_code = NO_ACTION;

  if (n_ltr == 1 )
  //** single letter case: **
  {
    nv = get_nvers(C, 'O');

    if ( ( nv >= 0) && (C->next->flg&c_f_punct ) &&
         ( C->next->vers[0].let== APOSTROPH ) &&
         ( ( C->nextl ) && ( check_upper( C->nextl->vers[0].let ) ) ) )
    {  // case as: "O'Neel"
      vers_to_first_place( C, nv );
      return_code = CONTINUE_ACTION;
      goto ECP_Ret;
    }

    if ( ( nv >= 0) && (C->prev->flg&c_f_let ) &&
         ( C->prev->vers[0].let== '/' ) && ( C->prev->prev ) &&
         ( C->prev->prev->vers[0].let == 'I' ) )
    {  // case as: "I/O"
      vers_to_first_place( C, nv );
      return_code = CONTINUE_ACTION;
      goto ECP_Ret;
    }

    if ( !(C->next->flg&c_f_punct && C->next->vers[0].let=='.') )
    {
      if( language != PUMA_LANG_LITHUANIAN || C->vers[0].let != i_bottom_accent ) // Nick 4.09.2001
          LiliI(C);
      return_code = CONTINUE_ACTION;
      goto ECP_Ret;
    }
  }

  if ((n_ltr == 2) && (word_flag & AFTERAPOSTROPHE))
  /***  'll case ***/
  {
    if (apostr_ll(C))
        return_code = CONTINUE_ACTION;
    else
        return_code = NO_ACTION;
  }
ECP_Ret:
    return  return_code;
}
예제 #2
0
void test_irish_name_cur_sym( int16_t Let )
{
    switch ( fl_beg_irish_name )
    {
      case CAPITAL_M:
        if ( Let == 'c' )
          fl_beg_irish_name = LOWER_C;
        else
          if ( Let == 'a' )
            fl_beg_irish_name = LOWER_A;
          else
            fl_beg_irish_name = NO_IRISH_NAME;
        break;

      case LOWER_A  :
        if ( Let == 'c' )
          fl_beg_irish_name = LOWER_C;
        else
          fl_beg_irish_name = NO_IRISH_NAME;
        break;

      case LOWER_C  :
        if ( check_upper( (uchar)Let )  )
          fl_beg_irish_name = AFTER_C;
        else
          fl_beg_irish_name = NO_IRISH_NAME;
        break;

      case AFTER_C  :
      default       :
        if ( ( n_ltr == 0 ) && ( Let == 'M' ) )    // first letter
          fl_beg_irish_name = CAPITAL_M;
        else
          fl_beg_irish_name = NO_IRISH_NAME;
        break;
    }
}
예제 #3
0
파일: test-ctype.c 프로젝트: pnx/utils
static int check_alpha(int c) { return check_upper(c) || check_lower(c); }
예제 #4
0
파일: main.c 프로젝트: chadhao/Programming1
int main(int argc, char* argv[])
{
	struct dice a[5];
	struct board b = {-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1};
	int out = 0;
	
	while(1)
	{
		for (int i=0; i<5; i++)
		{
			a[i].is_hold = 0;
		}
		
		int i = 0;
		dice_random(a);
		while(1)
		{
			system("clear");
			printf("\n\n++++++++++++Yahtzee!++++++++++++\n\n\n");
			print_dice(a);
			printf("Time of rolls: %d\n", i+1);
			printf("\nControl Keys\n[r: roll dice] [t: stop roll]\n[q, w, e, a, s: hold or unhold each dice]\n\n");
			print_board(0, a, &b);
			if (i == 2)
			{
				break;
			}
			int input = getch();
			if (input == 116)
			{
				i = 0;
				break;
			}
			else if (input == 114)
			{
				dice_random(a);
			}
			else if (input == 113)
			{
				change_hold(0, a);
				continue;
			}
			else if (input == 119)
			{
				change_hold(1, a);
				continue;
			}
			else if (input == 101)
			{
				change_hold(2, a);
				continue;
			}
			else if (input == 97)
			{
				change_hold(3, a);
				continue;
			}
			else if (input == 115)
			{
				change_hold(4, a);
				continue;
			}
			else
			{
				continue;
			}
			i++;
		}
		
		while(1)
		{
			system("clear");
			printf("\n\n++++++++++++Yahtzee!++++++++++++\n\n\n");
			print_dice(a);
			printf("Finished rolling!\n\n");
			printf("Please assign your point to one category!\n");
			printf(COLOR_RED"Red number"COLOR_RESET);
			printf(" indicates that category is already assigned!\n");
			printf(COLOR_GREEN"Green number"COLOR_RESET);
			printf(" indicates the possible value of that category!\n\n");
			printf("Control Keys\n[x: exit] [1-6: assign point]\n\n");
		
			print_board(1, a, &b);
		
			int input = getch();
			if (input == 120)
			{
				out = 1;
				break;
			}
			else if (input == 49)
			{
				if (b.ones != -1)
				{
					continue;
				}
				b.ones = upper(1, a);
				check_upper(&b);
				break;
			}
			else if (input == 50)
			{
				if (b.twos != -1)
				{
					continue;
				}
				b.twos = upper(2, a);
				check_upper(&b);
				break;
			}
			else if (input == 51)
			{
				if (b.threes != -1)
				{
					continue;
				}
				b.threes = upper(3, a);
				check_upper(&b);
				break;
			}
			else if (input == 52)
			{
				if (b.fours != -1)
				{
					continue;
				}
				b.fours = upper(4, a);
				check_upper(&b);
				break;
			}
			else if (input == 53)
			{
				if (b.fives != -1)
				{
					continue;
				}
				b.fives = upper(5, a);
				check_upper(&b);
				break;
			}
			else if (input == 54)
			{
				if (b.sixes != -1)
				{
					continue;
				}
				b.sixes = upper(6, a);
				check_upper(&b);
				break;
			}
			else
			{
				continue;
			}
		}
		
		if (out)
		{
			printf("\nBye!\n");
			break;
		}
		if (b.sum != -1)
		{
			system("clear");
			printf("\n\n++++++++++++Yahtzee!++++++++++++\n\n\n");
			printf("Final Score\n\n");
			print_board(0, a, &b);
			printf("\nBye!\n");
			break;
		}
	}
	
	return 0;
}