<commit_before>/*
 * This file is part of the chess-at-nite project [chess-at-nite.googlecode.com]
 *
 * Copyright (c) 2009-2010 by
 *   <NAME>
 *   <NAME>
 *   <NAME>
 *   <NAME>
 *
 * For the full copyright and license information, please visit:
 *   http://chess-at-nite.googlecode.com/svn/trunk/doc/LICENSE
 */

#include "common/globals.h"
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>

#ifdef WIN32
#include <conio.h>
#else
#include "common/unixio.c"
#endif

#include "common/define.h"
#include "model/MoveGenerator.h"
#include "model/Game.h"
#include "player/Player.h"
#include "player/HumanPlayer.h"
#include "player/ComputerPlayer.h"
#include "control/CLI.h"
#include "common/extra_utils.h"
#include "control/PGN.h"
#include "control/XBoard.h"

void test();

int main(int argc, char **argv) {
#ifdef DEBUG
    cerr << "!!!!!!!!!!!!!!!!!!!!!!!!\n";
    cerr << "!!! DEBUG MODE IS ON !!!\n";
    cerr << "!!!!!!!!!!!!!!!!!!!!!!!!\n";
#endif
    srand(time(NULL));
    init_globals();
    bool xboard_mode = false;
    int user_option = 0;
    if (argc > 1) {
        string tmp(argv[1]);
        if (tmp == "xboard") {
            xboard_mode = true;
        } else {
            user_option = atoi(argv[1]);
        }
    }
    else
    {
        //check cin for "xboard" message
        string inp;
        int check_time = get_ms() + 5000;    //check for 500 msecs
        while(get_ms() < check_time)
        {
#ifdef WIN32
          if(kbhit())
          {
              char ch = getch();
#else
          int chi;
          if(kbdhit(&chi))
          {
              char ch = char(chi);
#endif
              inp += ch;
              if(inp == "xboard")
              {
                xboard_mode = true;
                break;
              }
          }
        }
    }

#ifdef COMMAND_LINE
    if (xboard_mode) {
        XBoard xboard;
        xboard.start();
    } else if (user_option > 0) {
        CLI cli(user_option);<commit_msg>commented out some Unix specific code (additional dependancies to other library)<commit_after>/*
 * This file is part of the chess-at-nite project [chess-at-nite.googlecode.com]
 *
 * Copyright (c) 2009-2010 by
 *   <NAME>
 *   <NAME>
 *   <NAME>
 *   <NAME>
 *
 * For the full copyright and license information, please visit:
 *   http://chess-at-nite.googlecode.com/svn/trunk/doc/LICENSE
 */

#include "common/globals.h"
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>

#ifdef WIN32
#include <conio.h>
#else
//#include "common/unixio.h"    //for future use
#endif

#include "common/define.h"
#include "model/MoveGenerator.h"
#include "model/Game.h"
#include "player/Player.h"
#include "player/HumanPlayer.h"
#include "player/ComputerPlayer.h"
#include "control/CLI.h"
#include "common/extra_utils.h"
#include "control/PGN.h"
#include "control/XBoard.h"

void test();

int main(int argc, char **argv) {
#ifdef DEBUG
    cerr << "!!!!!!!!!!!!!!!!!!!!!!!!\n";
    cerr << "!!! DEBUG MODE IS ON !!!\n";
    cerr << "!!!!!!!!!!!!!!!!!!!!!!!!\n";
#endif
    srand(time(NULL));
    init_globals();
    bool xboard_mode = false;
    int user_option = 0;
    if (argc > 1) {
        string tmp(argv[1]);
        if (tmp == "xboard") {
            xboard_mode = true;
        } else {
            user_option = atoi(argv[1]);
        }
    }
    else
    {
        //check cin for "xboard" message
        string inp;
        int check_time = get_ms() + 500;    //check for 500 msecs
        while(get_ms() < check_time)
        {
#ifdef WIN32
          if(kbhit())
          {
              char ch = getch();
#else
          int chi;
          if(false) //kbdhit(&chi)) //for future usage
          {
              char ch = char(chi);
#endif
              inp += ch;
              if(inp == "xboard")
              {
                xboard_mode = true;
                break;
              }
          }
        }
    }

#ifdef COMMAND_LINE
    if (xboard_mode) {
        XBoard xboard;
        xboard.start();
    } else if (user_option > 0) {
        CLI cli(user_option);
{'fraction_non_alphanumeric': 0.16356056890632664, 'fraction_numerical': 0.01152525747915645, 'mean_word_length': 2.0692249811888637, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2169276', 'n_tokens_mistral': 1457, 'n_tokens_neox': 1388, 'n_words': 334}