example.py 460 B

1234567891011121314151617181920
  1. import time
  2. import random
  3. from p4 import *
  4. def J1(m,p):
  5. return random.randint(0,len(m))
  6. def J2(m,p):
  7. return random.randint(0,len(m))
  8. A=P4(J1,J2,6,7)
  9. while A.get_match()[0]:
  10. time.sleep(0.00012)
  11. if A.get_state()[0]=="PJ":
  12. print(A.get_state()[2]," a place : ",A.get_state()[1])
  13. A.update()
  14. print("Verdict: ",A.get_match()[1])
  15. x = '\n'.join([''.join(['{:4}'.format(item) for item in row]) for row in A.get_matrice()])
  16. print(x)