Re: A85: AI


[Prev][Next][Index][Thread]

Re: A85: AI




look inside.

-Greg

EMAIL: l0rdg0at@juno.com; lordgoat@somethingorother.com;
l0rdg0at@hotmail.com; milewskg@stuy.edu
ICQ: 9437474     AOL IM: l0rdg0at42

On Fri, 09 Oct 1998 16:23:41 PDT "Robert Caldwell" <rc_ware@hotmail.com>
writes:
>
>Actually, it's a great idea, there's a game made in qbasic called 
>something like "Robots."  You basically have a robot that has 3 parts: 

well, there was a game called CROBOTS that came out in 1986 that was a c
compiler and simulator of the bots.  there have been numerous ports to
pascal, java, qbasic, and even asm.  now it's my turn to bring it to the
85.   oh, yeah, i need to find a romcall that the 86 can't emulate.  LONG
LIVE THE 85!! lemme post the crobots crap at the end of this.

> 
>scanner, gun, and wheels.  The wheels can go forward, back, and rotate 
>
>left or right a certain degree.  Above which is a "turret" which faces 
>
>in a different angle to the wheels, and has the ability to "turn" and 
>"fire."  Above the gun is another "turret" with a scanner which faces 
>in 
>a different degree as the other 2.  The scanner only scans in one 
>direction and has 3 major scans:  distance, object, and friend/foe.  
>All 
>three of these are done at once.  Distance is from 0 (close combat, 
>destruction this close would cause self damage) to 16 (maximum 
>distance 
>the "gun" reaches).  Object is a number from 0 to 4: 0=too far for 
>scan 
>(nothing within 16 units), 1=robot, 2=obstruction, 3=wall.  Each robot 
>
>is tagged, and if this tag on the "robot" in scan is equal to the tag 
>of 
>the robot scanning (meaning friendly robot), then it's 0, if not 1...
>bit   meaning
>7     friend/foe
>6-5   object
>4-0   distance
>The robot also had a damage counter (256 points divided as the player 
>wishes for each of the three parts), and an auto-destruct which 
>damages 
>quite a bit in 0 range and a little in 1 range.
>
>Just giving a standpoint other than mice to use as the AI character.  
>I 
>loved this program, but I lost it when I formatted my drive (couldn't 
>find it on the net either).
>
>I hope you like the info I gave.
>
>-Rob
>p.s.  I have a massive headache, so if any of this doesn't make sense, 
>I 
>blame it on my head.
>p.p.s.  You could add other stuff like a fueling "dock" or repair 
>"area."
>
>

        5-1.  Battlefield

        The battlefield is a 1,000 by 1,000 meter square.  A wall 
        surrounds the perimeter, so that a robot running into the wall
        will incur damage.

        The lower left corner has the coordinates x = 0, y = 0; the upper
        right corner has the coordinated x = 999, y = 999.

        The compass system is oriented so that due east (right) is 0
        degrees, 90 is north, 180 is west, 270 is south.  One degree
        below due east is 359.


                         135    90   45
                             \  |  / 
                              \ | /
                        180 --- x --- 0
                              / | \
                             /  |  \ 
                         225   270   315


        The scanner is an optical device that can instantly scan any
        chosen heading, 0-359.  The scanner has a maximum resolution of  
        +/- 10 degrees.  This enables the robot to quickly scan the field
        at a low resolution, then use maximum resolution to pinpoint an
        opponent.


        5-3.  Robot defense 
        The only defense available are the motor drive and status
        registers.  The motor can be engaged on any heading, 0-359, in
        speeds from 0-100 percent of power.  There are acceleration and
        deacceleration factors.  A speed of 0 stops the motor.  Turns can
        be negotiated at speeds of 50% and less, in any direction.  Of
        course, the motor drive can be engaged any time, and is necessary
        on offense when a target is beyond the 700 meter range of the
        cannon.

        Certain status registers provide feedback to the robot. The
        primary registers indicate the percent of damage, and current x
        and y locations on the battlefield.  Another register provides
        current drive speed.


        5-4.  Disabling opponents

        A robot is considered dead when the damage reaches 100%.  Percent
        of damage is inflicted as follows:

                2% - collision into another robot (both robots in a    
                     collision receive damage) or into a wall.  A
                     collision also causes the motor drive to disengage,
                     and speed is reduced to 0.
                3% - a missile exploding within a 40 meter radius.
                5% - a missile exploding within a 20 meter radius.
               10% - a missile exploding within a 5 meter radius.

        Damage is cumulative, and cannot be repaired.  However, a robot
        does not loose any mobility, fire potential, etc. at high damage
        levels.  In other words, a robot at 99% damage performs equally
        as a robot with no damage.


(erm... fixed width makes it ok)

           +------------------------------------+ 1 fubar.r
           |                                    |  D% 015   Sc 218
           |                          \|/ 1     |  Sp 000   Hd 090
           |     (missile exploding)  -#-       | ------------------
           |                          /|\       | 2 snafu.r
        (y |                                    |  D% 050   Sc 275
           |              +        (missiles    |  Sp 100   Hd 180
        a  |                     +   flying)    | ------------------
        x  |   2                                | 3 bimbo.r
        i  |                                    |  D% 000   Sc 045
        s) |                 3                  |  Sp 000   Hd 000
           |                /                   | ------------------
           |          (robots) ----\            | 4 kumquat.r
           |                         4          |  D% 100   Sc 050
           |                                    |  Sp 000   Hd 335
           |                                    | 
           |                                    |
           +------------------------------------+ CPU Cycle: 4500

        (x=0,y=0)         (x axis)

        scan (degree,resolution)  
        The scan() function invokes the robot's scanner, at a specified
        degree and resolution.  scan() returns 0 if no robots are
        within the scan range or a positive integer representing the
        range to the closest robot.  Degree should be within the range
        0-359, otherwise degree is forced into 0-359 by a modulo 360
        operation, and made positive if necessary.  Resolution controls
        the scanner's sensing resolution, up to +/- 10 degrees.
        Examples:
           range = scan(45,0); /* scan 45, with no variance */
           range = scan(365,10); /* scans the range from 355 to 15 */


        cannon (degree,range)
        The cannon() function fires a missile heading a specified range
        and direction.  cannon() returns 1 (true) if a missile was fired,
        or 0 (false) if the cannon is reloading.  Degree is forced into
        the range 0-359 as in scan().  Range can be 0-700, with greater
        ranges truncated to 700.
        Examples:
           degree = 45;    /* set a direction to test */
           if ((range=scan(degree,2)) > 0) /* see if a target is there */
             cannon(degree,range);  /* fire a missile */

        drive (degree,speed)
        The drive() function activates the robot's drive mechanism, on a 
        specified heading and speed.  Degree is forced into the range
        0-359 as in scan().  Speed is expressed as a percent, with 100 as
        maximum.  A speed of 0 disengages the drive.  Changes in
        direction can be negotiated at speeds of less than 50 percent.
        Examples:
           drive(0,100);  /* head due east, at maximum speed */
           drive(90,0);   /* stop motion */

        damage()
        The damage() function returns the current amount of damage
        incurred.  damage() takes no arguments, and returns the percent
        of damage, 0-99. (100 percent damage means the robot is
        completely disabled, thus no longer running!) 
        Examples:
          d = damage();       /* save current state */
          ; ; ;               /* other instructions */
          if (d != damage())  /* compare current state to prior state */
          {
            drive(90,100);    /* robot has been hit, start moving */
            d = damage();     /* get current damage again */
          } 


        speed ()
        The speed() function returns the current speed of the robot.
        speed() takes no arguments, and returns the percent of speed,
        0-100.  Note that speed() may not always be the same as the last
        drive(), because of acceleration and deacceleration.
        Examples:
          drive(270,100);   /* start drive, due south */
          ; ; ;             /* other instructions */
          if (speed() == 0) /* check current speed */
          {
            drive(90,20); /* ran into the south wall, or another robot*/
          }


        loc_x ()
        loc_y ()
        The loc_x() function returns the robot's current x axis location.
        loc_x() takes no arguments, and returns 0-999.
        The loc_y() function is similar to loc_x(), but returns the
        current y axis position.
        Examples:
           drive (180,50);  /* start heading for west wall */
           while (loc_x() > 20)
             ;              /* do nothing until we are close */
           drive (180,0);   /* stop drive */


        rand (limit)
        The rand() function returns a random number between 0 and limit, 
        up to 32767.
        Examples:
          degree = rand(360);     /* pick a random starting point */
          range = scan(degree,0); /* and scan */


        sqrt (number)
        The sqrt() returns the square root of a number.  Number is made
        positive, if necessary.
        Examples:
           x = x1 - x2;     /* compute the classical distance formula */
           y = y1 - y2;     /* between two points (x1,y1) (x2,y2) */
           distance = sqrt((x*x) - (y*y)); 

        sin (degree)
        cos (degree)
        tan (degree)
        atan (ratio)

        These functions provide trigometric values.  sin(), cos(),
        and tan(), take a degree argument, 0-359, and returns the
        trigometric value times 100,000.  The scaling is necessary since
        the CROBOT cpu is an integer only machine, and trig values are
        between 0.0 and 1.0.  atan() takes a ratio argument that has been
        scaled up by 100,000, and returns a degree value, between -90 and
        +90.  The resulting calculation should not be scaled to the
        actual value until the final operation, as not to lose accuracy.
        See programming examples for usage


as you can see, i have a shitload of work to do.  i liked xc1701 II's
ability to track a guy in an array... perhaps that may save me some time.
 i'm working on this project with a good friend of mine, who ISN'T on
this list.   we plan to beta test on you guys. distribution is not
permitted.  source code will NOT be released until (maybe) final version.
 porting to other calcs will be handled by us.

-Greg

___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
or call Juno at (800) 654-JUNO [654-5866]


References: