Home Crobots Crobots32 Manual Competition Download


[ Yahoo! ] options

Crobots32 Manual

     #####  ######  ####### ######  ####### #######  #####   #####   #####
    #     # #     # #     # #     # #     #    #    #     # #     # #     #
    #       #     # #     # #     # #     #    #    #             #       #
    #       ######  #     # ######  #     #    #     #####   #####   #####
    #       #   #   #     # #     # #     #    #          #       # #
    #     # #    #  #     # #     # #     #    #    #     # #     # #
     #####  #     # ####### ######  #######    #     #####   #####  #######

    (c)  Copyright 1998 - 2001, All rights reserved.

    CROBOTS is copyrighted by:

    Mikhail Verkhovski

    1.  License agreement:

    You may make copies of this program, manual, and other files and give
    it to your friends or includes it in the library of to non-profit
    computer club.

    Expressly forbid any for-profit the lucks from selling this software
    and manual, either separately or as part of to software "library".



    2.  Introduction

    One supposes that the reader knows the handbook original 'crobots.doc'
    of Tom Poindexter.  This handbook with the program 'crobots.exe'
    can be downloaded, as an example, from:


    2-1.  Description

    Crobots32 is the program of control of the crobots for Windows9X/ME/NT.
    It supports almost all of the existing crobots.  The main
    reason that has pushed the author to create
    'crobots32' was strong desire to avoid the death of the
    matches of the crobots.  The author hopes that the new program that
    does not have the limits for the characteristics of the crobots
    will permit to develop the new generation of more flexible and powerful

    2-2.  Problems of compilation

    The original program 'crobots.exe' is also a compiler from a dialetto
    of the language C. In order to separate the two things
    the author has decided to use a true compiler (Microsoft (r)
    32-bit Optimizing compiler Version 11) to compile the
    crobots.  Unfortunately the dialetto used in 'crobots.exe' is not 
    a subset of C. That is not all of the existing crobots can
    be compiled immediately.  As an example:

    - the program rabbit.r of Tom Poindexter contains not defined local
      variable 'd'

    - the program abyss.r of Daniel Nuzzo, contains the expression


      that was not recognized by the compiler

    Fortunately these errors are rare and easy repairable. The almost
    all existing crobots was compiled and executed without

    2-3.  New features 

    There are two new important features:

    - extended debug log ('trace' function)
    - cooperation between crobots ('message' function) 

    2-4.  Hardware and software

    In order to execute 'crobots32' one needs a PC with installed
    Windows9X/ME/2K/XP or WindowsNT.  The crobots are to be compiled
    with a 32-bit compiler.  The author uses the Microsoft (R) 32-bit
    Optimizing compiler Version 11 distributed with Microsoft (R)
    Visual C++ 5.0.

    2-5.  Customer interface 

    The program 'crobots32' does not use menu and windows.
    It starts from command line in a DOS window.
    'crobots32' can be executed in special way (supervised mode). In
    this mode it's output can be simply used in order,
    to design the current situation in the battle field.
    The example 'crobcons32' is included in the distribution package.

    2-6.  Distribution

    The distribution package 'crobots32.zip' contain the following files:

    crobots32.exe - program of control of the crobots
    crobint32.obj - linked-in interface module
    crob32.bat - batch of compilation of the crobots
    crobcons32.c - example of the graphical application
    crobcons32.exe - compiled example
    crobdummy32.c - dummy file for controlled compilation
    crobdummy32.obj - compiled dummy file
    coop.r - example crobot of cooperation
    coop.exe - compiled example
    crobots32.txt - this handbook in Italian

    3.  Compilation of the crobot

    To compile a crobot is used the DOS command:

    crob32 robot.r

    The compilation process is divided in two steps.

    1) the batch compiles the crobot file as a c-program and tries
       to execute a link with the module 'crobdummy32.obj' (that it
       contains definitions of the "admitted" functions) using the
       option 'nodefaultlib'. This step is used for control of the
       calls to the run-Time library functions and to the functions
       of Windows that are not allowed in crobots.

    2) If the first step of compilation is finished without errors, the
       batch recompiles the crobot and executes the link with interface
       'crobint32.obj' - the connection module with the kernel 'crobots32'.

    The compilation result is the file 'robot.exe' that can be started
    in background from 'crobots32'.

    4.  Execution of 'crobots32'
    4-1.  Command line options

    'crobots32' is started in a window DOS with command:

         crobots32 [flags] <crobot_1> [... <crobot_n>] [>file]

    The too long execution can be interrupted with <Ctrl<>Break>.

    The valid flags are:

    -d<file> - specify the name of file for logging. Some specific 
       information will be printed here by 'crobots32'. It includes
       the positions and characteristics of crobots and the missiles, the
       demands for crobots etc

    -g<number> - repeate the game with specific number. Normally the game
       number is chosen randomly in interval 0 - 32767 and visualized 
       in the program output (see the example of the output of 'crobots32').
       The '-g' flag gives the possibility to repeate the specific

    -l<number>  - defines the maximum number of the cycles for a battle;
       if the flag is not specified (or the value is negative) the maximum
       number is infinity.

    -m<number>  -  specifiy the number of the battles in a game. Value
       di default is 1.

    -s - defines a 'supervised mode' of execution.  In this way all the
       internal kernel information is printed in standard output and can
       be used to design the field of the battle (see 'crobcons32.c').
       In supervised mode the first character of each line of output is a
       control character followed by a space.

    the control characters have following means:

    C - collision
    E - error
    M - position of the missile
    O - information line (is printed only)
    P - position of crobot
    R - request of one crobot
    X - explosion

    -t <number> - defines the time (in milleseconds) of slowing down for
       each cycle of execution.  Value of default is 0.  The use of this
       parameter permits to visualize the game in comprehensible way.

    -w <number>  - defines the number of the winners in each battle.
       The battle ends if the number of living crobots become smaller or equal
       to the given number. Value of default is 1.

    The maximum number of the crobots in each battle field is 8.

    4-2.  Examples

    1) Compile and make a battle of three crobots:

       crob32 robot1.r
       crob32 robot2.r
       crob32 robot3.r
       crobots32 robot1 robot2 robot3

    2) Repeate the game number 25637 with debug:

       crobots32 -g 25637 -d crobots32.log robot1 robot2 robot3

    3) Execute a match of 50 battles, limiting number of cycles to 200.000
       and to save the result:

       crobots32 -m 50 -l 200000 robot1 robot2 > save

    4-3. Priority

    The crobots executed with 'crobots32' do not have the
    preestablished limits of the dimensions (that depend only on the
    physical capacity of the used computer). For this reason
    the mechanism of penalization of the long crobots was introduced.
    On the beginning of the game 'crobots32' assigns to every crobot an
    integer number greter or equal to 10 - it's priority.
    The most short crobot (as dimensions of the file.exe) has priority 10.
    The priority of each other crobot depends on it's length:

    priority = (size - min_size)/512 + 10;

    During the game the frequency with which 'crobots32' executes the
    requests from each crobot is equal to it's priority.  That is the
    requests from the long crobots are executed with the less frequency.

    4-4.  Example of the output of 'crobots32'
    the output of the command:

    crobots32 -m10 counter rook

    is the following:

    1    Crobots 32-bit Control Utility, Version 1.11 for Windows95/NT
    2    Copyright (c) 1998 by Mikhail Verkhovski.  All rights reserved
    3    GameNumber=14136
    4    Crobots:
    5    1: counter (size=55808, priority=11)
    6    2: rook (size=55296, priority=10)
    8    Match         1        2 
    9    -------------------------
    10       1:   4075---  4075:17
    11       2:   7874---  7874:04
    12       3:   6218:00  6218---
    13       4:   3274---  3274:02
    14       5:  10970:50 10970---
    15       6:   3314:00  3314---
    16       7:   9597:83  9597---
    17       8:   3754---  3754:02
    18       9:   3182:00  3182---
    19      10:   6009:10  6009---
    20   -------------------------
    21   Total:        6        4 

    The first two lines are the program identification.
    The third line specifies the game number. This game can be
    repeated using the -g parameter.
    The next two lines are the partecipant information, their length
    and priority.

    Le lines 10-19 specify the 10 battles between the two crobots.
    Each line contains:
         - the battle number
         - the number of cicles for each crobot 
         - the final damaging (-- means the crobot is died)
    For examle the number 10970:50 in 14 line means the crobot
    'counter' has finished 5th battle with damage 50 after 10970

    The line 21 gives the total number of sucsessfull battles for each

    5. Specifications

    5-1. Extentions

    In a difference with traditional 'crobots' in the program executed with
    'crobots32' are allowed all the expressions of the c-language. All
    types of the variables, structures, pointers, #define etc. The function
    'main' receives an integer parameter, comprised between 1 and 8 (included).
    It is an identification number of the crobot (see as an example coop.r).
    For various crobots in field the identification numbers are different.

    5-2. Limitations
    Every crobot is a c-program. The main rule of 'crobots' remains the same:
    every crobot is only one file, all the necessary staff must be defined in
    it.  The #include are prohibited as the calls to whichever function except
    those listed.

    6. Functions

    6-1. List of available functions

    1)   int cannon (int angle, int range);
         int damage ();
         int drive (int angle, int speed);
         int loc_x ();
         int loc_y ();
         int message (int key, int mess);
         int scan (int angle, int range);
         int speed ();

    2)   int atan (int arg);
         int cos (int arg);
         int rand (int arg);
         int sin (int arg);
         int sqrt (int arg);
         int tan (int arg);
         int trace (char *format, ...);

    All the functions except 'trace' and 'message' are described in the
    original handbook 'crobots.doc'. It is important that the functions
    of the first group produce the request to the kernel 'crobots32' and,
    therefore, they slow down the execution. The functions of the second
    group are executed locally (in 'crobint32.obj').

    6-2. trace

    Function 'trace' is used to print the value of the internal variables
    of a crobot. On the first call 'trace' opens for append the log file
    with the name '<crobotsnamei>_identificator'. To close the log file
    the only one parameter (void *)0 is to be specified.
    For example:
                                       /* open log file and          */
                                       /* prints the values of x e y */
         trace ("x=%d y=%d\n", x, y);
         . . . . . .
         trace ((void *)0);            /* close the log file         */

    'trace' return 0 if it was the error in log file opening and 
    1 in the other case. 

    6-3. message

    Function ' message' is used for organize the coordination and cooperation
    between the crobots. After the call, the kernel 'crobots32 ' memorizes
    the value of the parameter 'mess' with the key 'key'. If an other
    crobot (or the same one) in the next moment will call 'message' with
    the same key, the value of 'mess' will be replaced with a new one,
    while the old value will be returned to caller. The valid range of the key
    'key' is comprised between 0 and 32767 (included). 'mess' is a whichever
    integer number. Initially the values for all the keys are equal to 0.

    For example:

         ret = message (1000, 1);      /* ret = 0, memorized 1     */
         ret = message (1000, 2);      /* ret = 1, memorized 2     */

    7. Contour

    7-1. crobcons32

    'crobcons32 ' is an example of the execution in 'supervised mode'.
    'crobcons32 ' adds to the parameter ' - s' to command line and starts
    'crobots32 ' using the function 'popen'. The standart output of the
    last one is analyzed in order to design the battle. To observe the
    battle between robot1 and robot2, as an example, can be useed the
    following command:

         crobcons32 -t1 robot1.r robot2.r

    7-2. coop.r

    'coop.r' is an example of cooperation between the crobots. When started
    in more copies, it stabilizes the hierarchy and passes the order from
    the general to the last soldier. It contains the position to catch up.
    After that, always using the order of the general, all the crobots run
    simultaneously, forming one species of military parade.
    The following command can be used to observe the parade:

         crobcons32 -t1 -l10000 coop coop coop coop coop

Mail:  Crobots32

Last change:  March,26 2002