Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- LastGhostsMoves=[(0,0)]*4
- def GhostAI():
- #deplacement Fantome
- # for F in Ghosts:
- # L = GhostsPossibleMove(F[0],F[1])
- # choix = random.randrange(len(L))
- # F[0] += L[choix][0]
- # F[1] += L[choix][1]
- global LastGhostsMoves
- for i in range(len(Ghosts)):
- CurrentCase=TBL[Ghosts[i][1]][Ghosts[i][0]]
- L=GhostsPossibleMove(Ghosts[i][0],Ghosts[i][1], CurrentCase)
- if CurrentCase==0 and (OppositeMove(LastGhostsMoves[i]) in L):
- L.remove(OppositeMove(LastGhostsMoves[i])) #Possible car LastGhostsMoves[i] est forcément dans L (Quand le fantome a déja bougé)
- choix = random.randrange(len(L))
- Ghosts[i][0] += L[choix][0]
- Ghosts[i][1] += L[choix][1]
- LastGhostsMoves[i]=L[choix]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement