// $Id: QuickStart.htm 119 2004-05-16 00:02:24Z ggs_mburo $ // This is a GGS file, licensed under the GPL
This is the first release and so far is known only to compile on a few machine/os/compiler combinations. Therefore you should first check that the unaltered source code compiles on your machine. If it doesn't compile email me, I would like to get it to work on more machines.
if (err = gs.Login("greedy","password")) {
Make the first parameter your program's login (8 characters max), the second parameter your program's password.
if (pmsg->sFrom=="n2") {
Change "n2" to your (human) login. This login controls the program; when it tells the program something, the program issues it as a command to GGS.
If you are adding your program to ODK the following troubleshooting guide may prove useful:
Error | Multiply defined: istream (or any other C++ standard library object) |
Issue | ODK requires new-style headers, e.g. <iostream> rather than the older <iostream.h> |
Solution | In your code, change #include <iostream.h>To #include <iostream> using namespace std; |
Error | anything related to BLACK, WHITE, EMPTY, DUMMY |
Issue | ODK defines the constants COsBoard::BLACK, etc. and you have #defined BLACK, etc. |
Solution | In your code, change #define BLACK 1to const int BLACK=1;which regards namespaces, is type-safe, and improves compiler error checking. |
To send a command to Lion, you output to the stream. From within a message handler you would say:
(*this) << "tell .chat Hello World!\n"; flush();To send the message "Hello World!" to the chat channel. Don't forget the '\n' (needed by the GGS parser) or the flush() which sends the message to GGS.
If your program doesn't have a learning book (i.e. learn from its mistakes in games) try 'rand' games which have a random starting position.
To write a very strong program, check out the papers by Michael Buro.
In ODK arrays, index 1 is for white and 0 is for black. This allows you to use game.pos.board.iMover as the index.