Esempio n. 1
0
File: main.c Progetto: KnowNo/huawei
int main()
{
	Game game;	// 游戏数据的结构体变量

	// 初始化每位玩家的资金
	init_money(&game);
	// 初始化玩家
	init_players(&game);
	// 初始化地图
	init_map(&game);
	// 初始化游戏中的其他数据
	init_others(&game);

	// 输出地图
	output_map(&game);

	// 以下为游戏主要流程,可根据需要修改代码
	while (1)
	{
		// 此处写游戏主要流程

		// 此处写判断游戏是否结束的代码,所用的函数自己定义
		// 类似这样:
		// if (is_game_over(&game))
		// {
		//		break;
		// }
	}

	// 游戏所用资源的释放,如果使用了malloc函数分配内存,在这里调用free函数进行释放

	return 0;
}
Esempio n. 2
0
void init_server(void)
{
	printf("Initializing Data. \n");
	check_dir(LOG_PATH);

	printf("Loading Items. \n");
	init_items();

	printf("Loading Maps. \n");
	init_maps();

	printf("Loading Npcs. \n");
	init_npcs();

	printf("Loading Shops. \n");
	init_shops();

	printf("Loading Spells. \n");
	init_spells();

	printf("Initializing Player Data. \n");
	init_players();

	printf("Initializing Temp Player Data. \n");
	init_temp_player_index();

	printf("Data Initialized. \n");
}
Esempio n. 3
0
int tuxrts_init(char *object_name, char *map_name, int players)
{
    FILE *fp;

    object_counter = 0;

    if(!init_players(players, 1))
    {
       printf("No players created!\n");
       DEBUGMSG(debug_game, "No players created!");
       return 0;
    }

    fp = LoadObj("objects");
    if(fp == NULL)
    {
        printf("File not found!\n");
        DEBUGMSG(debug_game, "File not found!");
        return 0;
    }
    printf("Object files in memory!\n");
    if(objects_xml(fp))
    {
        printf("Error parsing file!");
        DEBUGMSG(debug_game, "Error loading the objects description file.\n");
        return 0;
    }
    printf("Object file parsed.\n");
   
    fp = LoadMap(map_name);
    if(fp == NULL)
    {
        DEBUGMSG(debug_game, "File not found!");
        return 0;
    }
    printf("Map file in memory.\n");

    if(map_xml(fp))
    {
        printf("Error parsing file!");
        DEBUGMSG(debug_game, "Error loading the map file.\n");
        return 0;
    }
    printf("Map file parsed!\n");
    if(create_gmaps(players))
    {
        printf("Couldn't generate grpah mesh!\n");
        return 0;
    }
    
    generate_map();


    if(!panel_init())
    {
        printf("Error loading GUI.\n");
        return 0;
    }
    return 1;
}
Esempio n. 4
0
int main(int argc, char *argv[])
{
  srand(time(NULL));
  int die1=0, die2=0;
  int numberPlayers =argc-1;
  std::vector<Monopoly::Player> players;
  players=init_players(players, numberPlayers, argv);
  
  std::cout<<std::endl;
  for(int i=0; i<numberPlayers; i++)
  {
    std::cout<<players[i].get_name()<<" at position "<<players[i].get_position()<<" and money £"<< players[i].get_money()<<std::endl;
  }
  std::cout<<std::endl;
 
  for(int j=0; j<30; j++)
  {
  for(int i=0; i<numberPlayers; i++)
  {
    std::cout<<players[i].get_name()<<" at position "<<players[i].get_position()<<" shake die...";
    die1=roll_die();
    die2=roll_die();
    std::cout<<die1 <<" "<<die2;
    players[i].move(die1+die2);
    std::cout<<" new position "<<players[i].get_position()<<std::endl;
  }
  }
  players.clear();  
   return 0;
}
Esempio n. 5
0
EXPORT int MM_formula_cmd(int action, Imodman *mm_, Arena *arena)
{
	if (action == MM_LOAD)
	{
		mm = mm_;
		lm = mm->GetInterface(I_LOGMAN, ALLARENAS);
		cmd = mm->GetInterface(I_CMDMAN, ALLARENAS);
		pd = mm->GetInterface(I_PLAYERDATA, ALLARENAS);
		chat = mm->GetInterface(I_CHAT, ALLARENAS);
		formula = mm->GetInterface(I_FORMULA, ALLARENAS);
		cfg = mm->GetInterface(I_CONFIG, ALLARENAS);

		if (!lm || !cmd || !pd || !chat || !formula || !cfg)
			return MM_FAIL;

		pdata_key = pd->AllocatePlayerData(sizeof(PData));
		if (pdata_key == -1)
			return MM_FAIL;

		mm->RegCallback(CB_PLAYERACTION, player_action, ALLARENAS);

		init_players();

		cmd->AddCommand("formula", Cformula, ALLARENAS, formula_help);
		cmd->AddCommand("unset", Cunset, ALLARENAS, unset_help);
		cmd->AddCommand("vars", Cvars, ALLARENAS, vars_help);

		return MM_OK;
	}
	else if (action == MM_UNLOAD)
	{
		cmd->RemoveCommand("formula", Cformula, ALLARENAS);
		cmd->RemoveCommand("unset", Cunset, ALLARENAS);
		cmd->RemoveCommand("vars", Cvars, ALLARENAS);

		mm->UnregCallback(CB_PLAYERACTION, player_action, ALLARENAS);

		free_players();

		pd->FreePlayerData(pdata_key);

		mm->ReleaseInterface(lm);
		mm->ReleaseInterface(cmd);
		mm->ReleaseInterface(pd);
		mm->ReleaseInterface(chat);
		mm->ReleaseInterface(formula);
		mm->ReleaseInterface(cfg);

		return MM_OK;
	}
	return MM_FAIL;
}
Esempio n. 6
0
int main(int argc, char *argv[])
{ 
  int numberPlayers = argc-1;

	Monopoly::Game game;
	Printer listener;

	listener.game = &game;

	game.registerUIListener(&listener);
  init_players(game, numberPlayers, argv);  
	game.startGame();

	return 0;
}
Esempio n. 7
0
void main(){

	stats s;	
	s.plys_in_game = 6;
	s.bigblind = 20;
	s.cards_on_table = 0;
	
	init_players(&s);
	init_window(&s);		
	
	while(1){	
		init_deck(dec);
		s.cards_on_table = 0;
		game(&s);
	}

}
Esempio n. 8
0
int main()
{
    // create the window to show your game 
    sf::RenderWindow *window;

    window=new sf::RenderWindow(sf::VideoMode(600, 600),"My window");
    window->setFramerateLimit(20);
    
    //Initialise the game objects
    init_players();

    // run the program as long as the window is open
    while (window->isOpen())
    {
        // check all the window's events that were triggered since the last iteration of the loop
        sf::Event event;

        while (window->pollEvent(event))
        {
            // "close requested" event: we close the window
            if (event.type == sf::Event::Closed)
                window->close();
        }


        handle_input();

        update();

        perform_ai();

        // clear the window with black color
        window->clear(sf::Color::White);
	    
        // draw everything here...
        display(window);

        // end the current frame
        window->display();
    }

    return 0;
}
Esempio n. 9
0
void NormalGame::init(Log *_log)
{
	STACKTRACE;
	Game::init(_log);

	team_table_size = 0;

	view->window->locate(0,0,0,0,0,0.9,0,1);

	tw_delete_file(home_ini_full_path("tmp.ini"));
	tw_delete_file(home_ini_full_path("fleets.tmp"));
	tw_set_config_file(home_ini_full_path("tmp.ini"));
	set_config_string (NULL, "Ignorethis", "");
	if (!log->playback) init_players();
	log_file(home_ini_full_path("tmp.ini"));
	if (log->playback) {
		for (int i = 0; true; i += 1) {
			char buffy[64];
			sprintf(buffy, "Player%d", i + 1);
			log_file(home_ini_full_path("tmp.ini"));
			const char *type = get_config_string(buffy, "Type", NULL);
			if (!type) break;
			const char *name = get_config_string(buffy, "Name", buffy);
			int channel = get_config_int(buffy, "Channel", -2);
			int ti = get_config_int(buffy, "Team", 0);
			add_player(create_control(channel, type), ti, name, buffy);
			player_fleet[i]->load(NULL, buffy);
			player_fleet[i]->save("fleets.tmp", buffy);
		}
	}

	prepare();
	init_objects();

	next_choose_new_ships_time = game_time + 200;

	// team and health indicators.
	indteamtoggle = 0;
	indhealthtoggle = 0;

	return;
}
Esempio n. 10
0
/**
* init_client(void)
*
* @brief Initializes client
* @param void
* @return void
*/
void init_client(void)
{
	printf("Initializing Data. \n");

	check_dir(LOG_PATH);
	check_tiles();
	check_sprites();
	check_items();
	check_spells();

	init_items();
	_sleep(100);
	init_maps();
	init_npcs();
	init_shops();
	init_spells();
	init_players();

	printf("Data Initialized. \n");
}
Esempio n. 11
0
File: main.c Progetto: callaa/luola
/* Do initializations that require datafiles */
static int load_data(void) {
    LDAT *graphics;
    graphics = ldat_open_file(getfullpath(DATA_DIRECTORY,"gfx.ldat"));
    if(graphics==NULL)
        return 1;

    init_critters(graphics);
    init_intro(graphics);
    init_game(graphics);
    init_selection(graphics);
    init_players(graphics);
    init_pilots(graphics);
    init_ships(graphics);
    init_specials(graphics);
    init_projectiles(graphics);

    ldat_free(graphics);

    return 0;
}
Esempio n. 12
0
int main() {
	char a[LETTER_NUM];
	cordinate_t c;
	new_char_set(a);
	printf("%s\n", a);
	perm_start = malloc(sizeof(permutes));
	perm_head = perm_start;
	permute (a, 0, LETTER_NUM-1);
	read_dict();
	possible_words();
	init_board();
	init_players();
	c.x = 0;
	c.y = 0;
	take_word(c, RIGHT, "fosfalo");
	calculate_word_score(c, RIGHT, HUMAN);
	print_board();
	printf("score: %d\n", players[HUMAN].score);
	free_data();

	return 0;
}
Esempio n. 13
0
/*! \brief Main menu screen
 *
 * This is the main menu... just display the opening and then the menu and
 * then wait for input.  Also handles loading a saved game, and the config menu.
 *
 * \param   c zero if the splash (the bit with the staff and the eight heroes)
 *            should be displayed.
 * \returns 1 if new game, 0 if continuing, 2 if exit
 */
int start_menu (int skip_splash)
{
   int stop = 0, ptr = 0, redraw = 1, a, b;
   DATAFILE *bg;
   BITMAP *staff, *dudes, *tdudes;

#ifdef DEBUGMODE
   if (debugging == 0) {
#endif
      play_music ("oxford.s3m", 0);
      /* Play splash (with the staff and the heroes in circle */
      if (skip_splash == 0) {
         bg = load_datafile_object (PCX_DATAFILE, "KQT_PCX");
         staff = create_bitmap_ex (8, 72, 226);
         dudes = create_bitmap_ex (8, 112, 112);
         tdudes = create_bitmap_ex (8, 112, 112);
         blit ((BITMAP *) bg->dat, staff, 0, 7, 0, 0, 72, 226);
         blit ((BITMAP *) bg->dat, dudes, 80, 0, 0, 0, 112, 112);
         clear_bitmap (double_buffer);
         blit (staff, double_buffer, 0, 0, 124, 22, 72, 226);
         blit2screen (0, 0);

         kq_wait (1000);
         for (a = 0; a < 42; a++) {
            stretch_blit (staff, double_buffer, 0, 0, 72, 226, 124 - (a * 32),
                          22 - (a * 96), 72 + (a * 64), 226 + (a * 192));
            blit2screen (0, 0);
            kq_wait (100);
         }
         for (a = 0; a < 5; a++) {
            color_scale (dudes, tdudes, 53 - a, 53 + a);
            draw_sprite (double_buffer, tdudes, 106, 64);
            blit2screen (0, 0);
            kq_wait (100);
         }
         draw_sprite (double_buffer, dudes, 106, 64);
         blit2screen (0, 0);
         kq_wait (1000);
         destroy_bitmap (staff);
         destroy_bitmap (dudes);
         destroy_bitmap (tdudes);
		 unload_datafile_object(bg);
         /*
            TODO: this fade should actually be to white
            if (_color_depth == 8)
            fade_from (pal, whp, 1);
            else
          */
         do_transition (TRANS_FADE_WHITE, 1);
      }
      clear_to_color (double_buffer, 15);
      blit2screen (0, 0);
      set_palette (pal);
      bg = load_datafile_object (PCX_DATAFILE, "TITLE_PCX");
      for (a = 0; a < 16; a++) {
         clear_to_color (double_buffer, 15 - a);
         masked_blit ((BITMAP *) bg->dat, double_buffer, 0, 0, 0, 60 - (a * 4),
                      320, 124);
         blit2screen (0, 0);
         kq_wait (a == 0 ? 500 : 100);
      }
      if (skip_splash == 0)
         kq_wait (500);
#ifdef DEBUGMODE
   } else {
      set_palette (pal);
      bg = load_datafile_object (PCX_DATAFILE, "TITLE_PCX");
   }
#endif

   reset_world ();

   /* Draw menu and handle menu selection */
   while (!stop) {
      if (redraw) {
         clear_bitmap (double_buffer);
         masked_blit ((BITMAP *) bg->dat, double_buffer, 0, 0, 0, 0, 320, 124);
         menubox (double_buffer, 112, 116, 10, 4, BLUE);
         print_font (double_buffer, 128, 124, _("Continue"), FNORMAL);
         print_font (double_buffer, 128, 132, _("New Game"), FNORMAL);
         print_font (double_buffer, 136, 140, _("Config"), FNORMAL);
         print_font (double_buffer, 144, 148, _("Exit"), FNORMAL);
         draw_sprite (double_buffer, menuptr, 112, ptr * 8 + 124);
         redraw = 0;
      }
      display_credits ();
      blit2screen (0, 0);
      readcontrols ();
      if (bhelp) {
         unpress ();
         show_help ();
         redraw = 1;
      }
      if (up) {
         unpress ();
         if (ptr > 0)
            ptr--;
         else
            ptr = 3;
         play_effect (SND_CLICK, 128);
         redraw = 1;
      }
      if (down) {
         unpress ();
         if (ptr < 3)
            ptr++;
         else
            ptr = 0;
         play_effect (SND_CLICK, 128);
         redraw = 1;
      }
      if (balt) {
         unpress ();
         if (ptr == 0) {        /* User selected "Continue" */
            if (snc[0] == 0 && snc[1] == 0 && snc[2] == 0 && snc[3] == 0
                && snc[4] == 0)
               stop = 2;
            else if (saveload (0) == 1)
               stop = 1;
            redraw = 1;
         } else if (ptr == 1) { /* User selected "New Game" */
            stop = 2;
         } else if (ptr == 2) { /* Config */
            clear (double_buffer);
            config_menu ();
            redraw = 1;

            /* TODO: Save Global Settings Here */
         } else if (ptr == 3) { /* Exit */
            unload_datafile_object (bg);
            klog (_("Then exit you shall!"));
            return 2;
         }
      }
   }
   unload_datafile_object (bg);
   if (stop == 2) {
      /* New game init */
      for (a = 0; a < MAXCHRS; a++)
         memcpy (&party[a], &players[a].plr, sizeof (s_player));
      init_players ();
      memset (progress, 0, SIZE_PROGRESS);
      memset (treasure, 0, SIZE_TREASURE);
      numchrs = 0;
      for (a = 0; a < NUMSHOPS; a++) {
         for (b = 0; b < SHOPITEMS; b++)
            shops[a].items_current[b] = shops[a].items_max[b];
      }
      for (b = 0; b < 2; b++) {
         for (a = 0; a < MAX_INV; a++)
            g_inv[a][b] = 0;
      }
   }
   return stop - 1;
}
Esempio n. 14
0
File: pac.c Progetto: stig/pac
static int main_game_loop(struct env *board, 
                struct creature *pac,
                struct creature *ghost, 
                int cnt)
{
        unsigned long time_to_sleep;
        enum dir_t direction;
        int i, won = 0;
        
        draw_board(board);
        box_print(0, 0, "Welcome. Hit any key to start :)");
        update_view();
        blocking_input();

        do {
                /* set up and place the players (ghosts etc) */
                if (!init_players(board, pac, ghost, cnt))
                        return 0;

                /* blank out screen, ready for action */
                reset_view();
		draw_board(board);

                time_to_sleep = INITIAL_DELAY;
                for (;;) {
			/* check for user input */
                        direction = get_user_input();
                        if (direction == QUIT) break;

                        move_pac(board, pac, direction);
                        draw_creature(board, pac);
			erase_tail(board, pac);

                        /* Move and draw N ghosts. */
                        for (i=0; i<cnt; i++) {
                                ghost_move(board, &(ghost[i]), i);
                                draw_creature(board, &(ghost[i]));
				erase_tail(board, &(ghost[i]));
                        }

                        /* Up the score if we got any cherries,
                         * then print the new (or old) score. */
                        pick_up_cherries(board, pac);
                        print_stat(board);

                        /* update the whole screen */
                        update_view();

                        /* Check if there's any more cherries to
                         * pick, otherwise the game is won. */
                        won = game_won(board);
                        if (won) break;

                        if (pac_caught(pac, ghost, cnt)) {
                                down_lives(board);
                                break;
                        }

                        /* 
			 * Sleep for a short while. This function is not
			 * ANSI/ISO-C.
                         */
                        usleep(time_to_sleep);
                        if (time_to_sleep > MIN_DELAY)
                                time_to_sleep -= DEC_DELAY;
                } 
        } while (direction != QUIT && !won && lives_left(board) > 0 && play_again());
        
        finish(won, lives_left(board));
        return 1;
}
void loadLogs(int gameCounter)
{

    FILE *playLog;

    int playNumber;
    char dateExtended[32];
    char playerName[30];
    int dimension;
    int i;
    int moveX;
    char moveY;
    int lineCounter=0;
    int headLinesNumber=6;
    char logName[255];

    sprintf(logName, "data/logs/TripletsLog-%d.txt", gameCounter);

    lineCounter=get_file_lines(logName);

    lineCounter-=headLinesNumber;

    lineCounter++; // to add the last line which doesn't have /n !!


    playLog = fopen(logName, "rt");
    if(playLog == NULL)
    {
        printf("\n\tERR: Unable to read Log!");
    }
    else
    {
        gameCounter=0;
        dimension=0;
        fscanf(playLog, "--Triplets Log--\n");
        fscanf(playLog, "Game #%d\n", &gameCounter);
        fscanf(playLog, "Matrix Dimension: %dx%d\n", &dimension, &dimension);
        fscanf(playLog, "Started on: %s\n", dateExtended);

        board_set_size(dimension);
        board_set_empty();
        clearscr();
        board_print_raw();
        init_players();

        for (i=0; i<lineCounter; i++)
        {
            printf("\nPress any key to print next move...");
            readchar();
            clearscr();
            fscanf(playLog, "Player %s ; Play %d ; Move [%d][%c]\n", playerName, &playNumber, &moveX, &moveY);


            board_set_content_row_col(moveX, moveY);
            if (i==lineCounter-1)
            {
                finish_gamePL(get_current_game_ptr()->board);
            }
            board_print_raw();
            printf("\nPlayer Name: %s - Play Number: %d - Move: [%d][%c]\n",playerName, playNumber, moveX, moveY); // was just to test if it's reading right

            cmp.tmp=cmp.current_player_move;                   //swap current player
            cmp.current_player_move=cmp.previous_player_move;  //
            cmp.previous_player_move=cmp.tmp;

        }
        printf("\nWINNER: %s\a\n", playerName);
        printf("\nPress any key to go back to menu...");
        readchar();



    }

    fclose(playLog);

}
Esempio n. 16
0
// TODO: add player payments for chance/chest
int main(int argc, char ** argv)
{
    struct timeval t1, t2;
    MPI_Init(&argc, &argv);
    gettimeofday(&t1, NULL);
    int rank, size;
    MPI_Comm_rank(MPI_COMM_WORLD, &globalrank);
    MPI_Comm_size(MPI_COMM_WORLD, &size);
    globalsize = size;
    srand(time(NULL) + globalrank);
    struct location board[BSIZE];
    struct player players[NUMPLAYERS];
    int itr = 10000;
    long long bills[4]; // how much you owe each player at end of round
    init_players(players);
    init_board(board);
    char plocation;
    int pvalue;
    int numcomms = 1;
    MPI_Group world_group;
    MPI_Comm_group(MPI_COMM_WORLD, &world_group);
    playerdata d;
    d.money[0] = 0;
    d.money[1] = 0;
    d.money[2] = 0;
    d.money[3] = 0;
    output = (FILE **) malloc(size * sizeof(FILE *));

    // if 1 process created just run sequentially
    if (size == 1)
    {
        int done[4] = {1, 1, 1, 1};
        while (itr)
        {
            itr--;
            int i;
            for (i = 0; i < NUMPLAYERS; i++)
            {
                plocation = 0;
                pvalue = 0;
                if (players[i].money > 0)
                {
                    move(players, board, i, &pvalue, &plocation);
                    if (plocation)
                    {
                        board[plocation].owner = i;
                        players[i].money -= pvalue;
                    }
                }
                else
                {
                    players[i].order = -1;
                    if (done[i])
                    {
                        remove_properties(board, i);
                        done[i] = 0;
                    }
                }
            }
        }
        gettimeofday(&t2, NULL);
        results(players, board);
        double exectime = (t2.tv_sec - t1.tv_sec) * 1000000 + ((t2.tv_usec - t1.tv_usec));
        printf("Exec Time %lf\n", exectime);
        return 0;
    }

    // create a communicator for each monopoly game (for n > 4)
    MPI_Group * gamesel;
    MPI_Comm * games;
    int ranksel[4];
    if (size > 4)
    {
        numcomms = size / 4;
        games = (MPI_Comm *) malloc(numcomms * sizeof(MPI_Comm));
        gamesel = (MPI_Group *) malloc(numcomms * sizeof(MPI_Group));
        int i;
        for (i = 0; i < numcomms; i++)
        {
            ranksel[0] = 4 * i;
            ranksel[1] = 4 * i + 1;
            ranksel[2] = 4 * i + 2;
            ranksel[3] = 4 * i + 3;
            MPI_Group_incl(world_group, 4, ranksel, &gamesel[i]);
            MPI_Comm_create(MPI_COMM_WORLD, gamesel[i], &games[i]);
        }
    }
    else
    {
        // n < 4 so use MPI_COMM_WORLD
        games = (MPI_Comm *) malloc(1 * sizeof(MPI_Comm));
        games[0] = MPI_COMM_WORLD;
        numcomms = 1;
    }

    // create an MPI type so that we can use our player data struct in MPI communication calls
    const int nitems = 5;
    int blocklengths[5] = {4, 1, 1, 1, 1};
    MPI_Datatype types[5] = {MPI_LONG_LONG, MPI_INT, MPI_CHAR, MPI_CHAR, MPI_CHAR};
    MPI_Datatype MPI_MONO_DATA;
    MPI_Aint offsets[5];
    offsets[0] = offsetof(playerdata, money);
    offsets[1] = offsetof(playerdata, pvalue);
    offsets[2] = offsetof(playerdata, plocation);
    offsets[3] = offsetof(playerdata, order);
    offsets[4] = offsetof(playerdata, trade);
    MPI_Type_create_struct(nitems, blocklengths, offsets, types, &MPI_MONO_DATA);
    MPI_Type_commit(&MPI_MONO_DATA);

    MPI_Comm_rank(games[globalrank / 4], &rank);

#ifdef DEBUG
    char fname[10];
    snprintf(fname, 10, "mon%d.dbg", globalrank);
    output[globalrank] = fopen(fname, "w");
    fprintf(output[globalrank], "MAIN begin loop\n");
    print_board_info(board);
#endif
    // run the game for 40000 turns (10000 per player)
    while (itr > 0)
    {
        itr--;
        pvalue = 0;
        plocation = 0;
        d.trade = 0;
        d.order = rank;
#ifdef DEBUG
        fprintf(output[globalrank], "MAIN tag 1 rank %d\n", rank);
#endif
        move(players, board, rank, &pvalue, &plocation);
        d.pvalue = pvalue;
        d.plocation = plocation;
#ifdef DEBUG
        fprintf(output[globalrank], "using comm %d\n", globalrank / 4);
        if (games[globalrank / 4] != MPI_COMM_WORLD)
        {
            fprintf(output[globalrank], "COMM ERROR\n");
        }
#endif
        send_info(&d, players, board, rank, games[globalrank / 4], MPI_MONO_DATA);
#ifdef DEBUG
        fprintf(output[globalrank], "MAIN tag 3 rank %d\n", rank);
        print_board_info(board);
#endif
    }
    
#ifdef DEBUG
    fprintf(output[globalrank], "MAIN last tag rank %d\n", rank);
#endif
    // get results from each process
    gather_results(players, board, games, numcomms, globalrank);
    gettimeofday(&t2, NULL);
    if (globalrank == 0)
    {
        results(players, board);
    }


#ifdef DEBUG
    fclose(output[globalrank]);
#endif
    double exectime = (t2.tv_sec - t1.tv_sec) * 1000000 + ((t2.tv_usec - t1.tv_usec));
    if (globalrank == 0)
    {
        printf("Exec Time %lf\n", exectime);
    }
    MPI_Finalize();

    return 0;
}