
-----------------------------------
pluckster
Wed Jan 12, 2005 6:12 pm

Random Directions Problem
-----------------------------------
yes after i got the pics and directions to work, the program wouldnt make the ants go up and down just side to side


% Animal AI Food

View.Set ("title:Ant Farm: Real Life")
setscreen ("graphics:1000;650")
setscreen ("offscreenonly")

%The Ant Record
type ants :
    record
        y : int
        x : int
        movey : int
        movex : int
        movecount : int
        memory : boolean
        energy : int
    end record

var pic : array 1 .. 9 of int
var ant : array 1 .. 8 of ants
var foody : int
var foodx : int
var q, p, o, z : int

%Direction proc
procedure Direction
    for s : 1 .. 8

        randint (q, 1, 50)


        randint (p, 0, 50)

        o := (p + q)

        case o of
            label 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25 :
                ant (s).movex := 1
            label 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50 :
                ant (s).movey := 1
            label 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75 :
                ant (s).movex := -1
            label 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100 :
                ant (s).movey := -1
        end case
    end for
end Direction

%MoveCount proc
procedure MoveCount

    for f : 1 .. 8
        randint (z, 1, 200)
        ant (f).movecount := z
    end for

end MoveCount

%MovingUp proc
procedure MovingUp

    for i : 1 .. 8
        if ant (i).movecount = 0 or ant (g).y = 0 or ant (g).x 