I wrote a two-month black and white game program and found that there was a long history of GGS, an online game.

Source: Internet
Author: User

1. What is odk?
The full name of odk is Othello Development Kit, which is a set of development functions that can be connected to the GGS (the generic game server

. GGS is a platform on the Internet that provides various chess and Game competitions. odk only uses the black and white components.

. There are many clients connecting to GGS. The most famous one on Windows is lion.

If you already have a black and white game program, you can use odk to connect your program to GGS within 15 minutes.

The user fights.

2. How to Use odk?
Odk uses many STL libraries in C ++, such as string, vector, and graph classes. Therefore, the C ++ compiler is necessary to use odk. Management

Any c ++ compiler can be used, but I only use Borland C ++ Builder 6 and Borland C ++ command line compiler.

5.5. For example, the content of MK. Bat written by myself is as follows.

Rem -------------
Bcc32 main getmove ggsmessage ggsobjects ggsstream odkstream osmessage osobjects sockbuf
Del *. OBJ
Del *. TDS
Del *. Bak
Rem -------------

If you are using VC, select the "Project/settings..." menu and go to the "Link" page to add ws2_32.lib to your job.

Cheng Li; otherwise, the connection cannot be successful. In addition, you need to enable rtti, go to the "C/C ++" page, and select "category" to "C ++ language"

Select "enable run-time type information (rtti )".

You can compile the program once to confirm that the program can be compiled normally. Then, you can connect to GGS quickly.

.

3. How can I connect my program to GGS?
Modify the two files in odk.
1) in the main. cpp File
If (ERR = Gs. Connect ("external.nj.nec.com", 5000 )){
The server here is changed to Opal. cs. ualbert ta. ca, which may be the same in odk, but the lion is logged on to Opal. cs. ualbert ta. ca,

Lion is indispensable, so it is better to change it.

If (ERR = Gs. login ("greedy", "password ")){
Change the first parameter to your username (up to 8 characters) and the second parameter to your password. Note: I have never tried saving the user name

Can I log on at the time? If not, I can use lion to apply for one.

2) In the odkstream. cpp File
If (PMSG-> sfrom = "N2 "){
Change "N2" here to your control user name. The following describes the ram user name.

3) after completing the preceding steps, compile the code again. If the code is compiled, run the code to check the effect. Normally, you should be able to connect to GGS.

And displays the latest message.

4. How can you compete with other users?
1) first, you need to have two users on the GGS. It doesn't matter whether you register. One of them is used in the above program and logs in as a program;

The other is to use lion to log on. This is to control the user name. After using lion to log on, you should be able to see your program user name in the user list.

Then you should talk to your program User Name (click it on the user name), so that your program will be based on your instructions

. For example, if you enter "ta 8 ant", wait a moment and your program should start playing chess with ant. After "quit" is entered,

Wait a moment and you will see that your program has exited. (Note: ant is a permanent program on the GGS. It is not strong but weak. Generally

Users who are new to GGS like to fight against it. By the way, the user name of my program in GGS is nowcan.

You can play against my program .) Of course, you have not added your own chess function, but use the example in odk.

Undoubtedly, your program won't win ant.

2) add your smart modules to odk. This is easy. You only need to replace the getmove () function in getmove. cpp. The specific method is acceptable.

Refer to the Code in odk. After you replace this function, your program can connect to GGS. Then you can check with ant next time.

3) There is a place to note. Although the GGS is not registered, it can also be used for the competition, but it cannot calculate the score. Many of the above users -- especially Cheng

Sort users-do not accept competitions with no scores. Therefore, the challenges to some users may not be accepted by the other party. There is no way to do this.

.

5. odk has many other details. You can refer to the documents attached to odk.

Odk: http://vip.6to23.com/nowcan1/ai/ODK.rar

LION: http://vip.6to23.com/nowcan1/ai/lion083.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.