Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: moves[5] help with selection

Author: Odd Gunnar Malin

Date: 01:26:50 01/11/03

Go up one level in this thread


On January 11, 2003 at 01:26:57, Joshua Haglund wrote:

>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


Hi.

You realy need to start with something easier than a chessengine to get grab of
standard programming trick.
In addition to David's recomandation you could also look at Bruce Eckel's,
Thinking in C++. This book is free for downloading in pdf/html format so you can
start immediate.
You can download the book from:
http://64.78.49.204/

The first game we all made was MasterMind so I suggest you start with that to
get used to think game-logic.

Odd Gunnar



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.