Pacman AI
Author |
Message |
Montyman77
|
Posted: 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
|
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
stas054
|
Posted: 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...
|
|
|
|
|
![](images/spacer.gif) |
Montyman77
|
Posted: Sat Jun 13, 2009 3:59 pm Post subject: Re: Pacman AI |
|
|
ok well here is the attatchment
Description: |
|
![](http://compsci.ca/v3/pafiledb/images/icons/clip.gif) Download |
Filename: |
mario-pacman.zip |
Filesize: |
152.03 KB |
Downloaded: |
76 Time(s) |
|
|
|
|
|
![](images/spacer.gif) |
|
|