Exemple #1
0
int main(void)
{  
  printf("\nwelcome to the Tic-Tac-Toe game. \n");
  print_boardwithNum();

  while(1)
  {
  initialize_board();
  choose_difficulty();
  if(whoisthefirst() == 0)
  {
    com = 'O';
    user = '******';
  }
  else
  {
    com = 'X';
    user ='******';
  }

  game_starts();
    if(restart() != 1)
      break;   
  }
  return 0;
}
Exemple #2
0
int
main(int argc, char *argv[])
{
    parse_options(argc, argv);
    if (difficulty < MIN_DIFFICULTY) {
        choose_difficulty();
    }

    calculate_sudoku();
    print_grid();
    return 0;

#ifdef CURSED
    int num = 0;

    printf("f**k\n");
    /* initialize your non-curses data structures here */
    //printgrid();

    (void) signal(SIGINT, finish);      /* arrange interrupts to terminate */

    initscr();      /* initialize the curses library */
    draw_grid();
    //(void) newterm();
    keypad(stdscr, TRUE);  /* enable keyboard mapping */
    (void) nonl();         /* tell curses not to do NL->CR/NL on output */
    (void) cbreak();       /* take input chars one at a time, no wait for \n */
#if 0
    (void) echo();         /* echo input - in color */
#else
    (void) noecho();
#endif

    if (has_colors()) {
        start_color();

        /*
         * Simple color assignment, often all we need.  Color pair 0 cannot
         * be redefined.  This example uses the same value for the color
         * pair as for the foreground color, though of course that is not
         * necessary:
         */
        init_pair(1, COLOR_RED,     COLOR_BLACK);
        init_pair(2, COLOR_GREEN,   COLOR_BLACK);
        init_pair(3, COLOR_YELLOW,  COLOR_BLACK);
        init_pair(4, COLOR_BLUE,    COLOR_BLACK);
        init_pair(5, COLOR_CYAN,    COLOR_BLACK);
        init_pair(6, COLOR_MAGENTA, COLOR_BLACK);
        init_pair(7, COLOR_WHITE,   COLOR_BLACK);
    }
    init_pair(8, COLOR_WHITE, COLOR_BLACK);
    bkgd(COLOR_PAIR(8));//wbkgd();

    set_cell(GY_0, GX_0);

    for (;;)
    {
        int c = getch();     /* refresh, accept single keystroke of input */
        handle_ch(c);
        attrset(COLOR_PAIR(num % 8));
        num++;

        /* process the command keystroke */
    }

    finish(0);               /* we're done */
#endif /* CURSED */
}