from evonet import EvoNet
from PIL import Image
import matplotlib.pyplot as plt

import cProfile

def run():
    game = EvoNet( grid_width=52, grid_height=52, tile_size=8, water_percentage=0.5, num_agents=4)

    game._setup()
    game.init()

    for x in range(3000):
    #while True: 
        if game.game_over():
           
            #break
            game.reset()
        #time.sleep(0.05)
        #dt = game.clock.tick_busy_loop(30)
        dt = game.clock.tick(30) 
        #dt = 10
        game.step(dt)
        print(game.getScore())

        if x == 10001:
            observations = game.getScreenRGB()
            print(observations)
            #img = Image.fromarray(observations[0], 'RGB')
           # img = Image.fromarray(observations, 'RGB')
            #img.save('my.png')
          #  img.show()

            imgplot = plt.imshow(observations)
            plt.show()
           
        #print(game.step(dt))
        #print(game.getScreenRGB())
        #pygame.display.update()

run()
#cProfile.run('run()', 'evo_sm.profile')
@@ -1,46 +1,40 @@
-from evonet import EvoNet
+import numpy as np%0A
 %0Afrom 
-PIL
+ple
  import 
 Imag
@@ -33,79 +33,39 @@
 ort 
-Image%0Aimport matplotlib.pyplot as plt%0A%0Aimport cProfile%0A%0Adef run():%0A    
+PLE%0Afrom evonet import EvoNet%0A%0A
 game
@@ -74,17 +74,16 @@
  EvoNet(
- 
 grid_wid
@@ -84,21 +84,37 @@
 id_width
+ 
 =52, 
+%0A              
 grid_hei
@@ -120,16 +120,30 @@
 ight=52,
+%0A             
  tile_si
@@ -149,11 +149,26 @@
 ize=
-8
+4
 , 
+%0A              
 wate
@@ -189,101 +189,74 @@
 .5, 
-num_agents=4)%0A%0A    game._setup()%0A    game.init()%0A%0A    for x in range(3000):%0A    #while 
+%0A              num_agents=2)%0A%0Aenv = PLE(game, display_screen=
 True
-: 
+,
 %0A   
@@ -264,538 +264,314 @@
     
-if game.game_over():%0A           %0A            #break%0A            game.reset()%0A        #time.sleep(0.05)%0A        #dt = game.clock.tick_busy_loop(30)%0A        dt = game.clock.tick(30) %0A        #dt = 10%0A        game.step(dt)%0A        print(game.getScore
+        fps=100,%0A                force_fps=False, %0A                num_steps=1, %0A                frame_skip=1, %0A                add_noop_action=False)%0Aenv.init
 ()
-)
 %0A%0A
-        if x == 10001:%0A            observations = game.getScreenRGB()%0A            print(observations)%0A            #img = Image.fromarray(observations%5B0%5D, 'RGB')%0A        
+actions = list(env.game.getActions())%0Aprint(%22Actions: %7B%7D%22.format(actions))%0A%0Awhile True:%0A%0A
    
-#
  i
-mg = Image.fromarray(observations, 'RGB')%0A            #img.save('my.png')%0A          #  img.show
+f env.game_over():%0A        env.reset_game
 ()%0A%0A    
     
@@ -570,228 +570,111 @@
     
-   
-     imgplot = plt.imshow(observations)%0A            plt.show()%0A           %0A        #print(game.step(dt))%0A        #print(game.getScreenRGB())%0A        #pygame.display.update()%0A%0Arun()%0A#cProfile.run('run()', 'evo_sm.profile')
+next_action = np.random.choice(actions)%0A    reward = env.act(next_action)%0A%0A   #print(env.getFrameNumber())%0A

UPDATE example.py use PLE interface now