Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Pacman AI
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Montyman77




PostPosted: Sat Jun 13, 2009 11:47 am   Post subject: Pacman AI

What is it you are trying to achieve?
An Ai system for a pacman game


What is the problem you are having?
i want them to move randomly around until they are in line with pacman then they go after him
but i can't get them to detect intersections


Describe what you have tried to solve this problem
Turing:


%&& AI1
%%attempt at detecting intersections then randomly picking a path
 if whatdotcolor (badx1-20, bady1 + (Pic.Height (spiny) div 2)) = 192 or whatdotcolor (badx1-20, bady1 + (Pic.Height (spiny) div 2)) = 14 then
    decision1:=1
    end if
   

    if whatdotcolor (badx1 + Pic.Width (spiny)+20, bady1 + (Pic.Height (spiny) div 2)) = 192 or whatdotcolor (badx1 + Pic.Width (spiny)+20, bady1 + (Pic.Height (spiny) div 2)) = 14 then
       if decision1=1 then decision1:=Rand.Int(1,2)
    end if
    end if

    if whatdotcolor (badx1 + (Pic.Width (spiny) div 2), bady1 + Pic.Height (spiny)+20) = 192 or whatdotcolor (badx1 + (Pic.Width (spiny) div 2), bady1 + Pic.Height (spiny)+20) = 14 then
        if decision1=1 or decision1=2 then
        decision1:=Rand.Int(1,3)
        end if
      end if

    if whatdotcolor (badx1 + (Pic.Width (spiny) div 2), bady1-20) = 192 or whatdotcolor (badx1 + (Pic.Width (spiny) div 2), bady1-20) = 14 then
        if decision1=1 or decision1=2 or decision1=3 then
        decision1:=Rand.Int(1,4)
    end if
    end if
    %acting on the decision
    if decision1=1 then badx1+=1
    elsif decision1=2 then badx1-=1
    elsif decision1=3 then bady1+=1
    else bady1-=1
    end if



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
stas054




PostPosted: Sat Jun 13, 2009 3:17 pm   Post subject: RE:Pacman AI

I think you need to paste the entire code so people can take a look at it.. you forgot variables...
Montyman77




PostPosted: Sat Jun 13, 2009 3:59 pm   Post subject: Re: Pacman AI

ok well here is the attatchment


mario-pacman.zip
 Description:

Download
 Filename:  mario-pacman.zip
 Filesize:  152.03 KB
 Downloaded:  76 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: