Computer Chess Club Archives


Search

Terms

Messages

Subject: moves[5] help with selection

Author: Joshua Haglund

Date: 22:26:57 01/10/03


Hi

I need some clarification with a piece of code.

<snip>

string menuChoice = " ";

	menuChoice = displayMenu();
	while (menuChoice != "exit")
		{
	        if (menuChoice == "xboard")
	xboard();
	   else if (menuChoice == "log")
	log();
           else if (menuChoice == moves[5]) <---right here with moves[5],
        moves();
        else
        cout << "Invalid move." << endl;

<snip>

IF moves(); looked like this:

void moves() {

string moves[5] {"e2e4", "d2d4", "Nf3", "f2f4", "c2c4"};
}

What I want to do is:

if I enter a string for example:

White(1): e2e4

I want to have moves(); to look _in_ the string array move[5] and look for
"e2e4"
and if it finds "e2e4" selecting it for further processes. I'm not sure if i'm
going about this the right way.

else if (menuChoice == moves[5]) <---- I want to look in moves[5] for a string.

Looking for some clarification,

Joshua
toneewa@yahoo.com





This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.