Ejemplo n.º 1
0
    private AccelerationVector ChooseAcceleration(PlayingdInfo info)
    {
        // Get your own sphere.
        //
        // Other sphere information is the same.
        Sphere myself = info.players[roundInfo.yourIndex];

        // Position.
        int x = myself.x;
        int y = myself.y;

        // Velocity.
        int vx = myself.vx;
        int vy = myself.vy;

        // Other information.
        int index    = myself.index;
        bool inArena = myself.inArena;

        // --------------------------------------------------------------
        // Your code begins here.
        // --------------------------------------------------------------

        // You are expected to return an AccelerationVector.
        AccelerationVector result = new AccelerationVector();

        // Return dummy value.
        result.dVx = roundInfo.maxSpeedVariation;
        result.dVy = 0;

        // --------------------------------------------------------------
        // Your code ends here.
        // --------------------------------------------------------------

        return result;
    }
Ejemplo n.º 2
0
    public AccelerationVector OnPlayRequest(PlayingdInfo info)
    {
        if (null == roundInfo || !info.players[roundInfo.yourIndex].inArena)
        {
            return null;
        }

        AccelerationVector result = ChooseAcceleration(info);

        // Quick check.
        if (result.dVx * result.dVx + result.dVy * result.dVy > roundInfo.maxSpeedVariation * roundInfo.maxSpeedVariation)
        {
            Console.WriteLine("*** Acceleration is too big.");
        }

        return result;
    }