Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. LastGhostsMoves=[(0,0)]*4
  2.  
  3. def GhostAI():
  4. #deplacement Fantome
  5. # for F in Ghosts:
  6. # L = GhostsPossibleMove(F[0],F[1])
  7. # choix = random.randrange(len(L))
  8. # F[0] += L[choix][0]
  9. # F[1] += L[choix][1]
  10. global LastGhostsMoves
  11. for i in range(len(Ghosts)):
  12. CurrentCase=TBL[Ghosts[i][1]][Ghosts[i][0]]
  13. L=GhostsPossibleMove(Ghosts[i][0],Ghosts[i][1], CurrentCase)
  14. if CurrentCase==0 and (OppositeMove(LastGhostsMoves[i]) in L):
  15. L.remove(OppositeMove(LastGhostsMoves[i])) #Possible car LastGhostsMoves[i] est forcément dans L (Quand le fantome a déja bougé)
  16. choix = random.randrange(len(L))
  17. Ghosts[i][0] += L[choix][0]
  18. Ghosts[i][1] += L[choix][1]
  19. LastGhostsMoves[i]=L[choix]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement