Пример #1
0
static options_t
chooseOptions( modus_t mode )
{
	options_t options;
	int h, w;

	options.mode = mode;
	if( options.mode == TIMEMODE ){
		drawText("Enter the time limit (in minutes):\n");
		options.initialSeconds = 60 * askInt( 1, MAX_MINUTES );
		raiseErrorIf( errorCode() == NOERROR, errorCode(), options );
	}

	drawText("Enter the dimensions of the board "
			"(rows and columns space separated):\n");
	ask2Int( MIN_TAB_DIM, &h, MAX_TAB_DIM, MIN_TAB_DIM, &w, MAX_TAB_DIM );
	raiseErrorIf( errorCode() == NOERROR, errorCode(), options );

	options.height = h;
	options.width = w;

	drawText("Enter the number of colors with which you wish to play:\n");
	options.numColors = askInt( MIN_COLORS, MAX_COLORS );
	raiseErrorIf( errorCode() == NOERROR, errorCode(), options );

	drawText("Enter the number of pieces that are initially on the board:\n");
	options.initialTokens = askInt(1, options.width * options.height );
	raiseErrorIf( errorCode() == NOERROR, errorCode(), options );

	drawText("Enter the number of pieces that make a line:\n");
	options.tokensPerLine = askInt( MIN_TOK_PER_LINE,
										min( options.width, options.height ) );
	raiseErrorIf( errorCode() == NOERROR, errorCode(), options );

	drawText("Enter the number of pieces that are added on each turn:\n");
	options.tokensPerTurn = askInt(1, options.width * options.height );
	raiseErrorIf( errorCode() == NOERROR, errorCode(), options );

	return options;
}
Пример #2
0
void advanced_ecm (void)
{
	unsigned long m_thread, m_b, m_n, m_num_curves;
	long	m_c;
	double	m_k, m_bound1, m_bound2;

	m_k = 1.0;
	m_b = 2;
	m_n = 0;
	m_c = -1;
	m_bound1 = 50000.0;
	m_bound2 = 0.0;
	m_num_curves = 100;

	m_thread = 1;
	if (NUM_WORKER_THREADS > 1)
		askNum ("Worker number", &m_thread, 1, NUM_WORKER_THREADS);

	askDbl ("k in k*b^n+c", &m_k, 1.0, 1.0e15);
	askNum ("b in k*b^n+c", &m_b, 2, 1000000000);
	askNumNoDflt ("n in k*b^n+c", &m_n, 100, 600000000);
	askInt ("c in k*b^n+c", &m_c, -2000000000, 2000000000);
	askDbl ("Bound #1", &m_bound1, 100.0, 1.0e15);
	askDbl ("Bound #2", &m_bound2, 0.0, 1.0e15);
	askNum ("Curves to test", &m_num_curves, 1, 100000);

	if (askOkCancel ()) {
		struct work_unit w;
		memset (&w, 0, sizeof (w));
		w.work_type = WORK_ECM;
		w.k = m_k;
		w.b = m_b;
		w.n = m_n;
		w.c = m_c;
		w.B1 = m_bound1;
		w.B2_start = 0;
		w.B2 = m_bound2;
		w.curves_to_do = m_num_curves;
		w.curve = 0.0;
		addWorkToDoLine (m_thread - 1, &w);
		if (!WORKER_THREADS_ACTIVE)
			linuxContinue ("\nWork added to worktodo.ini file.  Another mprime is running.\n", ALL_WORKERS, FALSE);
		askOK ();
	}
}
Пример #3
0
static modeOption_t
chooseMode()
{
	drawText("Enter the game mode [1-5]:\n"
			"  1. Single player normal mode\n"
			"  2. Single player time mode\n"
			"  3. Two players\n"
			"  4. Recover game from file\n"
			"  5. Quit\n" );

	switch( askInt(1,5) ){
		case 1: return MODE0;
		case 2: return MODE1;
		case 3: return MODE2;
		case 4: return READFROMFILE;
		case 5:
		default: return QUIT;
	}
}