Exemple #1
0
void			lemipc(int ac, char **av)
{
	t_info		*info;

	info = init(ac, av);
	print_board(info->game, 0);
	while (is_last(info))
		;
	while (42)
	{
		sem_op(info->semid, -1);
		print_board(info->game, 1);
		is_dead(info);
		if (is_last(info))
			shmclear(&info, 1);
		if (info->lead)
			find(info);
		else
			listen_lead(info);
		print_board(info->game, 0);
		sem_op(info->semid, 1);
		usleep(TIMEOUT);
	}
	shmclear(&info, 2);
}
void Board::simulate_game()
{
  unsigned int moves = 0;

  print_board();

  while (!game_over)
  {
    switch (current_player)
    {
      case Square::BLACK:
        do_best_move();
        break;

      case Square::WHITE:
        do_random_move();
        break;

      default:
        printf("default in simulate_game?\n");
        break;
    }

    print_board();

    if (game_over)
    {
      printf("Game over after %u moves\n", moves);
      break;
    }

    ++moves;
  }
}
/*
 * This is the main loop of the connect four game.  It first prints a 
 * welcome message, allocates the board, and then begins the game loop
 */
int main()
{
	puts("Welcome to Connect Four\n");

	int* board = new_board();
    
	while (1)
	{
		print_board(board);

		int column = -1;

		// Get human input until they enter a valid choice...
		while (1)
		{
			printf("Enter your move (column number): ");
			scanf("%d", &column);

			if (column < 0 || column >= WIDTH)
			{
				printf("Input a valid choice (0 - 6).\n");
			}
			else if (place(board, column, 1) == 0)
			{
				printf("That column is full.\n");
			}
            else
            {
                break;
            }
		}
        // Did the human input make him or her win?
        if (check_win(board, 1) != 0)
        {
            print_board(board);
            printf("Player 1 wins!\n");
            break;
        }

		// Do the AI's move...
		int ai_column = get_next_move(evaluate_board(board));
		place(board,ai_column, 2);

		// Did the AI's move cause it to win?
        if (check_win(board, 2) != 0)
        {
            print_board(board);
            printf("Player 2 wins!\n");
            break;
        }
	}

	free(board);

	exit(EXIT_SUCCESS);
}
Exemple #4
0
int main(int argc, char **argv) {
	if (argc < 3) {
		printf("Usage: ./gol <infile> <print>\n");
		return 0;
	}

	FILE *f = fopen(argv[1], "r");
	int to_print = strtol(argv[2], NULL, 10);

	// Check if we opened the file
	if (f != NULL) { 
		int num_rows = 0;
		int num_cols = 0;
		int num_iterations = 0;
		int num_pairs = 0;
		double total_time = 0.0;
		
		// read numbers
		fscanf(f, "%d\n%d\n%d\n%d", &num_rows, &num_cols, &num_iterations, &num_pairs);

		// set up board
		board_t *board = init_board(f, num_rows, num_cols, num_pairs);

		// set up timing
		struct timeval start_time;
		struct timeval end_time;
		gettimeofday(&start_time, NULL);

		// run iterations
		int i = num_iterations;
		while (board_next(board, &i)) {
			if (to_print) {
				print_board(board, num_iterations - i);
				usleep(200000);
				clear(num_rows + 4);
			}
			i--;
		}

		// get end time
		gettimeofday(&end_time, NULL);
		total_time = ((end_time.tv_sec + (end_time.tv_usec/1000000.0)) - (start_time.tv_sec + (start_time.tv_usec/1000000.0)));

		// print final board
		print_board(board, num_iterations);

		printf("total time for %d iteration%s of %dx%d world is %f sec\n", num_iterations, (num_iterations != 1) ? "s" : "", num_rows, num_cols, total_time);
		fclose(f);
		board_free(board);
	} else {
		printf("There was an error opening '%s'\n", argv[1]);
		return 1;
	}

	return 0;
}
Exemple #5
0
//ask the user for a play
void get_play(Board board) {
	int enter_row, enter_col;
	while(1){ //while still true, keep going through this loop
		printf("Enter row a row between 0-%d and a column between 0-%d: ", board.row - 1, board.col - 1);
		scanf("%d %d", &enter_row, &enter_col);
		enter_row = board.row - enter_row - 1;
		if (in_bounds(board, enter_row, enter_col)) {
			if (board.tile[enter_row][enter_col].revealed == '!') {
				if (option_2(board, enter_row, enter_col)) {
					break;
				}
				else {
					continue;
				}
			}
			else if (board.tile[enter_row][enter_col].revealed == '?') {
				if (option_3(board, enter_row, enter_col)) {
					break;
				}
				else {
					continue;
				}
			}
			else if (board.tile[enter_row][enter_col].revealed == '#') {
				if (option_1(board, enter_row, enter_col)) {
					reveal_board(board, enter_row, enter_col, 0); 
					break;
				}
				else {
					continue;
				}
			}
			else {
				printf("This tile is already revealed.\n");
				continue;
			}
		}
		else {
			continue;
		}
	}
	if (check_win(board)) {
			print_board(board);
			printf("You Won!!\n");
			exit (0); //end the program because the game is over and the user has lost 
	}

	if (isgameover(board)) {
			print_board(board);
			printf("You Lost :(\n");
			exit(0); //end the program because the game is over and the user has lost
	}
	return;
}
Exemple #6
0
void doisjogadores(char **board) {
    system("clear");
    print_usage2();
    print_board(board);
    while ((!game_over(board) && (!someone_wins(board, 'O')))) {
        while(1) {
            printf("\n\t\t\tVez de jogador 1:\n");
            if (jogada(board,'X')) {
                break;
                //print_board(board)
            }
        }
        if(game_over(board) || someone_wins(board, 'X'))
            break;
        system("clear");
        print_board(board);

        while (1) {
            printf("\n\t\t\tVez de jogador 2:\n");
            if(jogada(board,0)) {
                break;
            }
        }
        system("clear");
        print_board(board);
    }
    system("clear");
    print_board(board);
    if (someone_wins(board, 'X')) {
        printf("\t\t\t\t\t\t\t\tJogador 1 ganhou!\n");

        enter();

        getchar();
        ultimos(board, 1);
    } else if (someone_wins(board, 'O'))  {
        printf("\t\t\t\t\t\t\t\tJogador 2 ganhou!\n");

        enter();


        getchar();
        ultimos(board, 2);
    } else {
        printf("\t\t\t\t\t\t\t\tFoi um empate!\n");

        enter();
        getchar();
        getchar();
    }


}
void play_game() {
	char name[50];
	printf("Hi!\n\nI am Z3TA.\n\nWhat's your name: ");
	scanf("%s", name);
	int play_first = 0;
	printf("\n\nDo you want to play first? 1 - Yes, 0 - No:  ");
	scanf("%d", &play_first);
	printf("\n\n\nX: Z3TA\nO: %s\n\n\n",name);
	if(!play_first) {
			while(!board_full(board) && !check_win(board)) {
			computer_move();
			printf("Z3TA just made a move...\n");
			print_board();
			if(board_full(board) || check_win(board)) {
				break;
			}
			player_move();
			printf("%s just made a move...\n", name);
			print_board();
		}
	}

	else {
			while(!board_full(board) && !check_win(board)) {
			player_move();
			printf("%s just made a move...\n", name);
			print_board();
			if(board_full(board) || check_win(board)) {
				break;
			}
			computer_move();
			printf("Z3TA just made a move...\n");
			print_board();
		}
	}

	printf("\n\n------------------------------\n\n");
	if(check_win(board) == 0) {
		printf("It's a DRAW!\n");
	}
	else if(check_win(board) == 1) {
		printf("%s WON!\n", name);
	}
	else {
		printf("Z3TA WON!\n");
	}
	printf("\n------------------------------\n");
}
Exemple #8
0
void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) {
  (void)recognizer;
  (void)window;

  static short idx = 0;
  static short userTurn = 1;
  
  if(userTurn == 1) {
    if(idx < 4) {
      input[idx++] = X_VALUE(xoffset);
      input[idx++] = Y_VALUE(yoffset);
    }
  
    if(idx == 4) {
      input[idx] = 10;
      userTurn = 0;
      idx = 0;
      chess_move(input);
    }
  }
  else {
    input[0] = 10;
    userTurn = 1;
    idx = 0;
    text_layer_set_text(&strBoardLayer, "thinking...");
    chess_move(input);
  }
  print_board();
}
Exemple #9
0
int main( int argc, char *argv[] )
{
    atexit(end);

    running = 0;
    level = 0;

    init_gui( &argc, argv );

    if( parse_args( &argc, argv ) < 0 )
        exit(0);

    if( init_game( &argc, argv ) < 0 )
        exit(0);

    if( argc > 1 )
    {
        print_usage(argv[0]);
        exit(0);
    }

    print_board();
    start_gui();

    end();
    exit(0);/*Jules : on ne devrait jamais arriver ici mais bon... */
    return 0; /*Vinz : ici encore moins mais restons standards */
}
Exemple #10
0
int main(int argc, const char *argv[])
{
    fb_info fb_v;
    fb_info * temp;
	pthread_t id;
	int ret;
    Dot mid;
    mid.x = 512;
    mid.y = 275;
    char ip_address[20];
    int mode;
    create_fb(&fb_v);
    system("clear");
    mode = startup(fb_v, ip_address);
    draw_pic(fb_v,OFFSET - 20,0,940,720,gImage_chessboard);
    draw_pic(fb_v,OFFSET - 120,200,100,100,gImage_chessboard);
    draw_pic(fb_v,OFFSET - 120,500,100,100,gImage_chessboard);
    draw_piece(fb_v,OFFSET - 70,250,40,0x00000000);
    draw_piece(fb_v,OFFSET - 70,550,40,0xffffffff);
    print_board(fb_v,23,30,30,OFFSET,15,0x00000000);
    temp = &fb_v;
    if((ret = pthread_create(&id, NULL, (void *) mouse_test,(void *)temp)) != 0)
    {
        printf("Create pthread error!\n");
        exit(1);
    }
    if(mode == 1)
        udp_server(fb_v);
    else
        udp_client(fb_v, ip_address);
    return 0;
}
Exemple #11
0
static int device_open(struct inode *inode, struct file *file)
{
	char wins[WINBUF];

	if (Device_Open)
		return -EBUSY;
	
	Device_Open++;
	if (ai_turn) {
		ai_turn = FALSE;
		if (make_ai_move(PLAYER_X)) 
			winner = PLAYER_X;

	}

	if (ai_two_in_a_row(PLAYER_O) == -1)
		winner = PLAYER_O;

	print_board(msg);

	if (winner != NO_PLAYER) {
		memset(wins,0,sizeof(wins));
		sprintf(wins,"\n %c wins (send '%s' to restart')\n", winner, RESET_COMMAND);
		strcat(msg,wins);
	}

	msg_Ptr = msg;
	try_module_get(THIS_MODULE);

	return SUCCESS;
}
Exemple #12
0
main()
{
	int i,j;			/* counters */
	int a[DIMENSION*DIMENSION+1];
	boardtype board;		/* Seduko board structure */
	boardtype temp;

	read_board(&board);
	print_board(&board);
	copy_board(&board,&temp);


	for (fast=TRUE; fast>=FALSE; fast--) 
		for (smart=TRUE; smart>=FALSE; smart--) {

			printf("----------------------------------\n");
			steps = 0;
			copy_board(&temp,&board);
			finished = FALSE;
		
			backtrack(a,0,&board);
			/*print_board(&board);*/

			printf("It took %d steps to find this solution ",steps);
			printf("for fast=%d  smart=%d\n",fast,smart);


		}
}
Exemple #13
0
int test_move(char *fen, int side, char *move, int move_correct)
{
	IS_CHECKMATE = IS_DRAW = 0;
	B b = fen_to_board(fen);
	print_board(b);
	printf("\n");
	Move m = find_move(b, side, 180);
	if(m == atomove(move, b) && move_correct) {
		printf("CORRECT\n\n");
		goto SUCESS;
	} else if(m != atomove(move, b) && !move_correct) {
		printf("CORRECT\n\n");
		print_move(m);
		printf("\n%s\n", movetoa(m));
		goto SUCESS;
	} else goto FAILURE;
	SUCESS:
		printf("\n\n#############################\n");
		free(b);
		return 1;
	FAILURE:
		printf("FAILURE: ");
		print_move(m);
		printf("\n%s\n", movetoa(m));
		printf("\n\n#############################\n");
        free(b);
        return 0;
}
Exemple #14
0
int main(void)
{
	init_data();
	print_board();
	mouse_doing();
	return 0;
}
Exemple #15
0
int			player(t_gboard *p4, char *cl, int player)
{
	int		move;
	int		win;

	move = -1;
	while (move == -1)
	{
		ft_putendl("Your turn you mud !");
		if ((move = ft_player()) == -1)
		{
			ft_putstr(cl);
			p4->error = COL_STR;
		}
		else
		{
			ft_putstr(cl);
			move = ft_play(p4, move, player);
		}
		print_board(p4);
		if (move != -1)
			win = check_win(p4, player);
	}
	return (win);
}
Exemple #16
0
int user_action(char board1[BOARD_SIZE][BOARD_SIZE], char board2[BOARD_SIZE][BOARD_SIZE], char user) {
	switch (user) {
		case 'a': 
			add_cell(board2) ;
			break ;

		case 'r':
			remove_cell(board2) ;
			break ;

		case 'n':
			apply_rules(board1, board2) ;
			break ;

		case 'q':
			return 0 ;

		case 'p':		
			while (1) {
				apply_rules(board1, board2) ;	
				copy_board(board1, board2) ;
				printf("\033[2J\033[H") ;
				usleep(500000) ;
				print_board(board1) ;			
			}
	}
	return 1 ;
}
int main(int argc, char *argv[])
{
    cint_t board_a[BOARD_HEIGHT][BOARD_WIDTH] = {
        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        { 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0 },
        { 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0 },
        { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 },
        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0 },
        { 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0 },
        { 0, 1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 1, 0 },
        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
        { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
    };
    cint_t board_b[BOARD_HEIGHT][BOARD_WIDTH];

    cint_t *origin = (cint_t *) board_a
         , *dest   = (cint_t *) board_b;

    for (;;) {
        next_state(origin, dest);

        system("clear");
        print_board(dest);
        sleep(1);

        cint_t *tmp = origin;
        origin = dest;
        dest = tmp;
    }

    return 0;
}
Exemple #18
0
//begin main
int main (void) {

	char current[BOARD_SIZE][BOARD_SIZE] ;
	char future[BOARD_SIZE][BOARD_SIZE] ;

	initialize_board(current, ' ') ;
	initialize_board(future, ' ') ;

	char choice ;	
	int stillgoing = 1;

	while (stillgoing) {
		
		printf("\033[2J\033[H") ;

		copy_board(current, future) ;
		print_board(current) ;	

		printf("Please enter one of the following:\n a: to add a new cell\n r: to remove a cell\n n: to advance the simulation\n q: to quit\n p: to play the game forever\n") ;
		scanf("%c", &choice) ;
		
		stillgoing = user_action(current, future, choice) ;		
	}
	return 0 ;

}	//end main
Exemple #19
0
int main(int argc, const char *argv[])
{
	init_data();
	print_board();
	mouse_doing();
/*
	save_bg(512, 367);
	draw_cursor(512, 367);
	sleep(1);
	restore_bg(512, 367);
	draw_cursor(612, 300);
*/

//	fb_circle(500, 400, 100, 0x00ffff00);
/*
	fb_line(0, 0, fb_v.w-1, fb_v.h-1, 0x00ff00ff);
	fb_line(fb_v.w-1, 0, 0, fb_v.h-1, 0x00ccff00);
	fb_line(300, fb_v.h-1, 400, 0, 0x00ff00bb);
*/

/*
	int i, j;
	for (i = 0; i < 100; i++)
	{
		for (j = 0; j < 100; j++)
		{
			fb_one_pixel(500+i, 300+j, 0x0000ff00);
		}
	}
*/

	return 0;
}
Exemple #20
0
int main()
{
  int color = 1;
  int z;

  srand( (unsigned)time( NULL ) );
  for (;;) {
    z = play_one_move(color);
    printf("moves=%4d, color=%d, z=%d\n",moves, color, get81(z));
    print_board();

    record[moves] = z;
    moves++;
    if ( moves == MAX_MOVES ) {
      printf("max moves!\n");
      break;
    }
    if ( z == 0 && moves >= 2 && record[moves-2] == 0 ) {
      printf("two pass\n");
      break;
    } 

    color = flip_color(color);
  }

  return 0;
}
Exemple #21
0
//program to implement the game of minesweeper
//user enters the name of the executable, the row and column dimensions, number of mines, and optionally a seed for random number generator 
int main(int argc, char** argv){
	
	Board board; //intitialize the board with struct type Board
	
  	int row = 0; //intialize the number of rows
  	int column = 0; //initialize the number of columns
  	int mine = 0; //intiialize the number of mines
  	read_args(argc, argv, &row, &column, &mine);
  	board.row = row;
  	board.col = column;
  	board.mine = mine;


	board.seed = generate_seed(argv);
	board.tile = create_board(board); //create the board
	mine_location_generator(board);
	print_board(board);
	play_is_valid(board);



	destroy_board(board); //when the game is over destroy the board

  return 0;
}
Exemple #22
0
/*********************************************************//*
   Print board and allow human player to enter next move
*/
int human_step(
               int player,
               int m,
               int move[],
               int board[10][10]
              )
{
  char line[256];
  int c=0,i;
  print_board( stdout,board,move[m-2],move[m-1] );
  while( c == 0 && !feof(stdin)) {
    printf("next move for %c ? ",sb[player]);
    fgets(line,256,stdin);
    i = 0;
    while( i < 256 && line[i] != '\0'
          &&( line[i] < '1' || line[i] > '9' ))
      i++;
    if( i < 256 && line[i] != '\0' ) {
      c = line[i] - '0';
      if( board[move[m-1]][c] != EMPTY ) {
        c = 0;
      }
    }
  }
  move[m] = c;
  return( make_move( player,m,move,board ));
}
Exemple #23
0
void				game_loop(t_env *e)
{
	int before_check_die;

	before_check_die = 0;
	print_board(e);
	refresh();
	while (e->nb_proc_in_life > 0 && e->nb_cycle < e->nb_cycle_max)
	{
		++e->nb_cycle;
		if (before_check_die >= e->c_to_die)
		{
			check_champ_cycle(e);
			check_proc_cycle(e);
			before_check_die = 0;
			if (e->nb_proc_in_life == 0)
				return ;
		}
		++before_check_die;
		if (e->verbose & VERBOSE_CYCLE)
			ft_printf("It is now cycle %d\n", e->nb_cycle);
		proc_loop(e);
		if (have_opt('c', e->opt))
			ncurses_loop(e);
	}
	if (!have_opt('c', e->opt) && have_opt('d', e->opt))
		print_memory(e->mem);
}
Exemple #24
0
/* Check the validity of the move */
BOOL check_validity(void)
{
	char s[256];
	int i;
	BOOL found;

	if (to != 999)
	{
		/* loop through the moves to see if it's legal */
		found = FALSE;
		for (i = 0; i < first_move[1]; ++i) {
			if (gen_dat[i].m.b.from == from && gen_dat[i].m.b.to == to) 
			{
				found = TRUE;

				/* get the promotion piece right */
				if (gen_dat[i].m.b.bits & 32) {
					switch (s[4]) 
					{
					case 'N':
						break;
					case 'B':
						i += 1;
						break;
					case 'R':
						i += 2;
						break;
					default:
						i += 3;
						break;
					}
				}
				break;
			}
		}

		if (!found || !makemove(gen_dat[i].m.b)) {
			printf("Illegal move.\n");
			if (is_mini) {
				draw_message("     ","Nope");
			}
			else {
				pz_draw_header("Illegal move !");
			}
			return FALSE;
		}
		else {
			ply = 0;
			gen_moves();
			print_board();

			print_result();
			to = 999;
			return TRUE;
		}
	} /* if to != 999 */
	else {
		return FALSE;
	}
}
Exemple #25
0
int ask_for_move(board_t board) {
    int move;
    char validstr[5];
    char *validpos = validstr;

    print_board(board);

    for(move=0; move<4; move++) {
        if(execute_move(move, board) != board)
            *validpos++ = "UDLR"[move];
    }
    *validpos = 0;
    if(validpos == validstr)
        return -1;

    while(1) {
        char movestr[64];
        const char *allmoves = "UDLR";

        printf("Move [%s]? ", validstr);

        if(!fgets(movestr, sizeof(movestr)-1, stdin))
            return -1;

        if(!strchr(validstr, toupper(movestr[0]))) {
            printf("Invalid move.\n");
            continue;
        }

        return strchr(allmoves, toupper(movestr[0])) - allmoves;
    }
}
Exemple #26
0
void test_playout()
{
  flag_test_playout = 1;
  playout(1);
  print_board();
  print_sgf();
}
Exemple #27
0
int
main(void)
{
	bool win = FALSE;
	int move, max_moves;
	int player;

	print_instructions();
	max_moves = DIM * DIM;	/* Maximum number of moves in a game */

	while (TRUE) {
		initialize_board();
		for (move = 1; move <= max_moves; move++) {
			player = move % 2 == 0 ? 2 : 1;
			win = do_move(player);
			print_board();
			if (win) {
				printf("Player %d, you WON!\n\n", player);
				break;		/* out of for loop */
			}
		}
		/*
		 * If we got here by falling through the loop, then it is a
		 * tie game.
		 */
		if (!win)
			printf("Tie Game!\n\n");
		if (!ask_yesno("Do you wish to play again?"))
			break;			/* out of while loop */
	}
	return 0;
}
Exemple #28
0
void manually_place_ships(char board[10][10], Ship boat)
{
	int direction = 0, row_start = 0, col_start = 0, valid = -1;

	system("cls");
	print_board(board, 10, 10);
	while(valid != 1)
	{
		if(valid == 0)
		{
			printf("Please place in a valid spot\n");
			valid = -1;
		}
		generate_manual_start_pt (&boat, &row_start, &col_start);
		generate_manual_direction (&direction);
		if((direction == 1) && ((boat.ship_length + row_start) > 10))
		{
			valid = 0;
		}
		else if((direction == 0) && ((boat.ship_length + col_start) > 10))
		{
			valid = 0;
		}
		else if(check_ship_place(board, row_start, col_start, direction, boat.ship_length, boat.ship_symbol) == 0)
		{ 
			valid = 0;
		}
		else{ valid = 1; }
	}
	place_ship (board, row_start, col_start, direction, boat.ship_length, boat.ship_symbol);
}
Exemple #29
0
int main(int argc, char const *argv[])
{
    
    int i,j;
    size = atoi(argv[1]);
    srand(time(NULL));
    int vx = rand() % size;
    int vy = rand() % size;

    board = (int**) malloc(size*sizeof(int*));
    
    for (i = 0; i < size; i++)
        board[i] = (int*) malloc(size*sizeof(int));
    
    for(i = 0; i < size; i++){
        for(j = 0; j < size; j++){
            board[i][j]=0;
        }
    }
    
    board[vx][vy] = 99;
    //print_board(board);
    rec_spilt_matrix(0,0,size-1,size-1,vx,vy);
    board[vx][vy] = 0;
    print_board(board);
    
    return 0;
}
Exemple #30
0
void bench() {
	
	/*char p[] = "2rr3k/pp3pp1/1nnqbN1p/3pN3/2pP4/2P3Q1/PPB4P/R4RK1 w - - 0 1";*/
	char p[] = "r2q1rk1/1ppnbppp/p2p1nb1/3Pp3/2P1P1P1/2N2N1P/PPB1QP2/R1B2RK1 b - - ";
	/*char p[] = "8/pR1b1kpp/8/8/3p2n1/3P4/P4qPP/Q6K b - - 0 28";
	char p[]="8/5kpp/2K5/p5q1/6P1/5P2/8/2q5 w - - 0 53";
	2rr3k/pp3pp1/1nnqbN1p/3pN3/2pP4/2P3Q1/PPB4P/R4RK1 w - - 0 1
	*/
	double nps;
	unsigned int start_time, end_time, delta, c;
	nps = 0;
	delta = 0;

	/* Important area for testing */
	for (c = 0;c < 5;c++) {
			set_position(p);
			init_data();
			print_board();
			tree.max_depth = 8;
			tree.delta_time = (10 * 60 * 1000);
			start_time = time_elapsed();
			find_best_move(IO_CONSOLE,NEW_SEARCH);
			end_time = time_elapsed();
			nps += Nodes;
			delta += (end_time - start_time);
			}

	nps /= (double)(delta);
	nps *= 1000.0;
	printf("Nodes per second: %d\n", (int)nps);
	}